summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools/makefilehandler.h
blob: 77045fe948d9e789e84d709d5ed144708e5f2a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
  KDevelop Autotools Support
  Copyright (c) 2005 by Matt Rogers <[email protected]>

***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
***************************************************************************
*/
#ifndef MAKEFILEHANDLER_H
#define MAKEFILEHANDLER_H

/**
 * This class is responsible for taking the data from the Makefile.am parser
 * and providing various data list view items can use in the automake manager
 * widget
 * @author Matt Rogers
 */
namespace AutoTools {
class ProjectAST;
}

class MakefileHandler
{
public:
    MakefileHandler();
    ~MakefileHandler();

    /**
     * Parse a folder that has supported makefiles in it. The following files
     * will be looked for in the following order:
     * \li Makefile.am.in
     * \li Makefile.am
     * \li Makefile.in
     *
     * \param folder, the folder to parse
     * \param recursive if true, subfolders will be parsed - defaults to true
     */
    void parse( const QString& folder, bool recursive = true );

    /**
     * Get the AST for a certain path
     * \param folderPath the path of the folder to get an AST for
     * \return the AST that represents a particular folder
     */
    AutoTools::ProjectAST* astForFolder( const QString& folderPath );

    /**
     * Check if a string is an automake variable
     * \return true if it is an automake variable, false otherwise
     */
    bool isVariable( const QString& item ) const;

    /**
     * Find the value for the variable specified by \p variable
     * \param variable The name of the variable to look for
     * \param ast the AST to use to look for the variable in
     * \return the value to substitute for the variable
     */
    QString resolveVariable( const QString& variable,
                             AutoTools::ProjectAST* ast );


private:
    class Private;
    Private* d;
};

#endif

//kate: space-indent on; indent-width 4;