2
This file is part of hugin.
4
hugin is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 2 of the License, or
7
(at your option) any later version.
9
hugin is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with hugin. If not, see <http://www.gnu.org/licenses/>.
21
* Created on: May 25, 2010
22
* @author Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
28
#include "MakefileItem.h"
30
#include "VariableRef.h"
38
* Represents a makefile rule, including Prerequisite and Command.
41
class MAKEIMPEX Rule : public PrimaryMakefileItem
43
std::vector<string> targets;
44
std::vector<string> prerequisites;
45
std::vector<string> commands;
53
virtual string toString();
56
* Adds a target string.
59
void addTarget(const string& t)
64
* Adds a Variable as a Target. A VariableRef is taken from the Variable and added.
67
void addTarget(Variable& t)
69
addTarget(t.getRef().toString());
71
void addTarget(Variable* t)
73
addTarget(t->getRef().toString());
76
* Adds a string as a prerequisite.
79
void addPrereq(string p)
81
prerequisites.push_back(p);
84
* Adds a Variable as a prerequisite. A VariableRef is taken from the Variable and added.
87
void addPrereq(Variable& p)
89
addPrereq(p.getRef().toString());
91
void addPrereq(Variable* p)
93
addPrereq(p->getRef().toString());
95
/** Adds an other rule as a prerequisite for this rule */
96
void addPrereq(Rule& r)
98
for(std::vector<string>::iterator i = r.targets.begin(); i != r.targets.end(); i++)
103
void addPrereq(Rule* r)
108
* Adds a string as a command to the Rule.
111
void addCommand(string c,bool doEcho=true,bool ignoreErrors=false)
123
commands.push_back(command);