diff options
-rwxr-xr-x | gen_makefile.py | 21 |
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() |