Re: Make files
Posted in 1993
hwigoda@seg7.mnc.mot.com (Hal Wigoda) writes: >Can someone send me an example of a make file that duplicates >what 'Program Compile' does under the 4gl menu system? here a little more than you asked for, my tempplate Makefiles for both c compiled and RDS. I'm no Makefile expert, so any suggestions on changes would be welcome. ================ Dennis J. Pimple Informix CSE / Denver ----------------------------- C Compiled Makefile --------------------- # This module provides a framework for a Makefile for applications # using Informix C compiled version # # Search and replace the following patterns: # # aaaa/AAAA - Application name # bbbb - Perform screen name # cccc - Table name # dddd - Database name # ########### # INFORMIX PROFESSIONAL SERVICES ####### # ## Denver, Colorado ###### # ### ================================================ ##### # #### File: %M% SCCS: %I% %P% #### # ##### Program: Makefile for dddd Database ### # ###### Client: ## # ####### Author: # ########### Date: %G% %U% # define any perform screens used in DBA activities # (using sperform rather than an application) below. PERFORMS= dddd.frm # list all applications below ALL= $(PERFORMS) aaaa.4ge aaaa.4gh # this says that the command "make all" will remake everything all: $(ALL) #the command "make pers" will make the forms listed in PERFORMS above pers: $(PERFORMS) ls -l *.frm # note that make files can execute any unix command, so # "make nuke" will remove everything but source code nuke: rm -rf *.o *.frm *.4ge *.4gh # "make newdb" is used whenever the database is changed. We remove # the *.4gl and *.per object code so that the definitions using the # LIKE table.column syntax know what we're talking about. # This isn't as handy as in the RDS version, # because we're also nuking "c" object code. newdb: rm -rf *.o *.frm *.4ge make all # define any modules that will be in every executable below COMMON= globals.o lib.o # define forms seperately from the program code, so we can show # dependance without trying to include the .frm files into the # executable. FAAAA= bbbb.frm # C files as well as 4gl files should be in this list AAAA= $(COMMON) aaaa.o # everything on the line after the colon defines what object code # needs to be up-to-date. The rest just tells make what to do to # make the executable current. The "$@" syntax signifies the file on # the left of the colon. aaaa.4ge: $(AAAA) $(FAAAA) c4gl -s $(AAAA) -o $@ ls -l $@ # this makes the ascii help file aaaa.hlp into the # object file aaaa.4gh # In the OPTIONS section of the modules, the help file need to be # defined: OPTIONS HELP FILE "aaaa.4gh" HELP= aaaa.4gh aaaa.4gh: aaaa.hlp mkmessage aaaa.hlp aaaa.4gh help: $(HELP) # DEPENDENCIES .DEFAULT: c4gl -s $(<:.o=.4gl) # SUFFIX RULES .SUFFIXES : .4gl .o .frm .per .c .hlp # The "$<" syntax means the part of the file to the left of the # period (eg: for xxx.4gl; $< means the xxx part) .4gl.o: c4gl -c $< # the "-" in front of the form4gl signifies that make shouldn't quit # when an error is encountered. This is done so that the warning # errors form4gl sometimes generates doesn't stop the make. # We can tell if the compile was successful if the .frm file is # there, so the ls -l will fail on an actual failure # (as opposed to error) # finally, do the rm after the ls -l so that any warning .err file # is not saved. .per.frm: - form4gl -q $* ls -l $*.frm rm -rf $*.err .per: - form4gl -q $* ls -l $*.frm rm -rf $*.err .c.o: cc -c $< .c: cc -c $@ .hlp.4gh: mkmessage $< ------------------------------- RDS Makefile -------------------------- # This module provides a framework for a Makefile for applications # using Informix RDS # # Search and replace the following patterns: # # aaaa/AAAA - Application name # bbbb - Perform screen name # cccc - Table name # dddd - Database name # eego - Customized runner # eedb - Customized debugger # ########### # INFORMIX PROFESSIONAL SERVICES ####### # ## Denver, Colorado ###### # ### ================================================== ##### # #### File: %M% SCCS: %I% %P% #### # ##### Program: Makefile for dddd Database ### # ###### Client: ## # ####### Author: # ########### Date: %G% %U% # define any perform screens used in DBA activities # (using sperform rather than an application) below. PERFORMS= dddd.frm # list all applications below ALL= $(PERFORMS) aaaa.4gi aaaa.4gh # this says that the command "make all" will remake everything all: $(ALL) # the command "make pers" will make the forms listed in PERFORMS above pers: $(PERFORMS) ls -l *.frm # note that make files can execute any unix command, so # "make nuke" will remove everything but source code nuke: rm -rf *.4go *.o *.frm *.4gi *.4gh # "make newdb" is used whenever the database is changed. We remove # the *.4gl and *.per object code so that the definitions using the # LIKE table.column syntax know what we're talking about. newdb: rm -rf *.4go *.frm *.4gi make all # define any modules that will be in every executable below COMMON= globals.4go lib.4go # define forms seperately from the program code, so we can show # dependance without trying to include the .frm files into the # executable. FAAAA= bbbb.frm AAAA= $(COMMON) aaaa.4go # everything on the line after the colon defines what object code # needs to be up-to-date. The rest just tells make what to do to # make the executable current. The "$@" syntax signifies the file on # the left of the colon. aaaa.4gi: $(AAAA) $(FAAAA) cat $(AAAA) > $@ ls -l $@ # customized runner. This is how rds handles c code EEGO= fgiusr.c eego.o eego: $(EEGO) cfglgo $(EEGO) -o$@ ls -l $@ # customized debugger. We use the same c define, # but compile it differently eedb: $(EEGO) cfglgo $(EEGO) -o$@ ls -l $@ # this makes the ascii help file aaaa.hlp into the object file aaaa.4gh # In the OPTIONS section of the modules, the help file need to be # defined: OPTIONS HELP FILE "aaaa.4gh" HELP= aaaa.4gh aaaa.4gh: aaaa.hlp mkmessage aaaa.hlp aaaa.4gh help: $(HELP) # DEPENDENCIES .DEFAULT: fglpc $(<:.4go=.4gl) # SUFFIX RULES .SUFFIXES : .4gl .4go .frm .per .c .o .hlp # The "$<" syntax means the part of the file to the left of the # period (eg: for xxx.4gl; $< means the xxx part) .4gl.4go: fglpc $< .4gl: fglpc $@ # the "-" in front of the form4gl signifies that make shouldn't quit # when an error is encountered. This is done so that the warning errors # form4gl sometimes