diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1576b0c..85886f5 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "paramproc.h" | 5 | #include "paramproc.h" |
6 | #include "staticstring.h" | 6 | #include "staticstring.h" |
7 | #include "build.h" | 7 | #include "build.h" |
8 | #include "action.h" | ||
8 | 9 | ||
9 | class Param : public ParamProc | 10 | class Param : public ParamProc |
10 | { | 11 | { |
@@ -14,17 +15,23 @@ public: | |||
14 | sCache(".build.cache"), | 15 | sCache(".build.cache"), |
15 | bDebug( false ), | 16 | bDebug( false ), |
16 | bPostDebug( false ), | 17 | bPostDebug( false ), |
17 | sView("plain") | 18 | sView("plain"), |
19 | bInfo( false ), | ||
20 | bCleanMode( false ) | ||
18 | { | 21 | { |
19 | addHelpBanner("Build r?\n\n"); | 22 | addHelpBanner("Build r?\n\n"); |
20 | addParam("file", 'f', &sFile, | 23 | addParam("file", 'f', &sFile, |
21 | "Set the input script, default: build.conf"); | 24 | "Set the input script, default: build.conf"); |
25 | addParam("info", 'i', &bInfo, | ||
26 | "Display useful info about the loaded config file.", NULL, "true" ); | ||
27 | addParam("clean", 'c', &bCleanMode, | ||
28 | "Clean instead of checking the given action.", NULL, "true" ); | ||
22 | addParam('p', mkproc(Param::procViewPercent), | 29 | addParam('p', mkproc(Param::procViewPercent), |
23 | "Switch to percent view."); | 30 | "Switch to percent view."); |
24 | addParam('m', mkproc(Param::procViewMake), | 31 | addParam('m', mkproc(Param::procViewMake), |
25 | "Switch to 'make' style view."); | 32 | "Switch to 'make' style view."); |
26 | addParam("cache", &sCache, | 33 | addParam("cache", &sCache, |
27 | "Set an alternative cache file." ); | 34 | "Set an alternative cache file, default: .build.cache" ); |
28 | addParam('d', &bDebug, | 35 | addParam('d', &bDebug, |
29 | "Display debug info instead of building", NULL, "true" ); | 36 | "Display debug info instead of building", NULL, "true" ); |
30 | addParam('D', &bPostDebug, | 37 | addParam('D', &bPostDebug, |
@@ -67,6 +74,8 @@ public: | |||
67 | //Viewer *pViewer; | 74 | //Viewer *pViewer; |
68 | bool bDebug; | 75 | bool bDebug; |
69 | bool bPostDebug; | 76 | bool bPostDebug; |
77 | bool bInfo; | ||
78 | bool bCleanMode; | ||
70 | 79 | ||
71 | private: | 80 | private: |
72 | }; | 81 | }; |
@@ -84,6 +93,15 @@ int main( int argc, char *argv[] ) | |||
84 | pBuild = bld.load( prm.sFile.c_str() ); | 93 | pBuild = bld.load( prm.sFile.c_str() ); |
85 | pBuild->setCache( prm.sCache ); | 94 | pBuild->setCache( prm.sCache ); |
86 | pBuild->setView( prm.sView ); | 95 | pBuild->setView( prm.sView ); |
96 | if( prm.bCleanMode ) | ||
97 | pBuild->setMode( Action::actClean ); | ||
98 | |||
99 | if( prm.bInfo ) | ||
100 | { | ||
101 | pBuild->printInfo(); | ||
102 | delete pBuild; | ||
103 | return 0; | ||
104 | } | ||
87 | if( prm.bDebug ) | 105 | if( prm.bDebug ) |
88 | { | 106 | { |
89 | printf("\n\n----------\nDebug dump\n----------\n"); | 107 | printf("\n\n----------\nDebug dump\n----------\n"); |
@@ -111,9 +129,12 @@ int main( int argc, char *argv[] ) | |||
111 | printf("\n\n----------\nDebug dump\n----------\n"); | 129 | printf("\n\n----------\nDebug dump\n----------\n"); |
112 | pBuild->debugDump(); | 130 | pBuild->debugDump(); |
113 | } | 131 | } |
132 | delete pBuild; | ||
114 | return 1; | 133 | return 1; |
115 | } | 134 | } |
116 | 135 | ||
117 | delete pBuild; | 136 | delete pBuild; |
137 | |||
138 | return 0; | ||
118 | } | 139 | } |
119 | 140 | ||