This program will used to create a make file in either VMS or UNIX platform. We can use this as reusable module to import in some other program to generate make file in both platforms.
#Program to create executable in either VMS or UNIX platform: import osimport sys def make(project_name, param = ""): """Builds a project with unit test directives on. - project_name the name of the project. - param (optional) but can be set to any parameter (taken by make.com) for VMS and only "nodebug" for UNIX. """ project_name = project_name.lower() if sys.platform == "OpenVMS": option = '' if param: option = ' /' + param make_command = '$ pre_c_defines = "define=(""UNITTEST"")"\n' \ '$ pre_cxx_defines = "define=(""UNITTEST"")"\n' \ '$ sym_comp_c_defines = "/define=UNITTEST"\n' \ '$ sym_comp_cxx_defines = ' \ '"/define=(UNITTEST,__USE_STD_IOSTREAM)"\n' \ '$ make ' + project_name + option + '\n' else: # UNIX platform option = '' if param is "nodebug" and isdebug(): # This is the same as release command which is currently undefined. option = 'unset sym_debug;. setdef.ksh > /dev/null\n' make_command = option + \ 'export sym_proc_parm="define=UNITTEST"\n' \ 'export sym_comp_parm="-DUNITTEST"\n' \ 'rmake ' + project_name os.system(make_command) return
that is some ugly ass code