summaryrefslogtreecommitdiff
path: root/gen_makefile.py
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-05-16 03:37:58 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-05-16 03:37:58 +0100
commitc3319558848de337019f8f1440ef7884ae6e4d66 (patch)
tree985586b070e2079ad613cb7693deadd4ee810f6c /gen_makefile.py
parent0869578a58a0f0cc40bff344aaa0797bc026c81c (diff)
added code to handle c and c++ in the main
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'gen_makefile.py')
-rwxr-xr-xgen_makefile.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/gen_makefile.py b/gen_makefile.py
index 55eb161..fb91242 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -21,7 +21,6 @@
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
-
class makefile_generator():
def __init__(self):
self._binary = 'a.out'
@@ -125,8 +124,26 @@ class makefile_generator_cpp(makefile_generator):
super().__init__()
+import sys
+
+def usage(prgname):
+ print("Usage: %s C" % (prgname), file=sys.stderr)
+ print(" %s c" % (prgname), file=sys.stderr)
+ print(" %s C++" % (prgname), file=sys.stderr)
+ print(" %s c++" % (prgname), file=sys.stderr)
+
def main():
- generator = makefile_generator_c()
+ if len(sys.argv) < 2:
+ usage(sys.argv[0])
+ return
+
+ if sys.argv[1] == 'c' or sys.argv[1] == 'C':
+ generator = makefile_generator_c()
+ elif sys.argv[1] == 'c++' or sys.argv[1] == 'C++':
+ generator = makefile_generator_cpp()
+ else:
+ usage(sys.argv[0])
+ return
generator.gen()