Make rules for compiling Informix
Posted in 1991
Path: emory!att!linac!uwm.edu!cs.utexas.edu!asuvax!ncar!csn!cherokee!cherokee!bruce From: bruce@patton.USWest.COM ( Bruce W. Hoylman x5806 ) Newsgroups: comp.databases.informix Message-ID: <BRUCE.91Oct25175349@patton.USWest.COM> Date: 26 Oct 91 00:53:49 GMT Sender: news@cherokee.uswest.com (Telegraph Row) Organization: U S West Advanced Technologies Nntp-Posting-Host: patton.uswest.com Here is a set of make rules (I use GNU make) that have been used, tried and true, forever it seems like. They work exceptionally well for my needs. Hope you can use them. They allow you to build Informix code (forms, reports, 4gl, esql/c) from the command line using a make facility. Again, it has some GNU make-isms, so modify accordingly if you want to use them. An example Makefile follows. Mix and match these rules in files for including into the Makefile according to your build needs. Credit to Alex Stevens who set the direction for these macros initially. The GNU copyleft applies here. These are posted solely as examples of how to use GNU make with Informix code and are not intended to reflect correctness or anything remotely viewed as a standard. Just something that's been thrown together. Later ... --------------------------->8 CUT HERE 8<--------------------------- # This is the stand.macros file # # Standard GNU Make include. # Begin with standard target directories. # These macros reflect a layout of the source. They can be set to # what you prefer. MYLIB =../lib/ MYBIN =../bin/ MYDATA =../data/ MYMACROS = ../env/ MYDBS = ../dbs/ # Set up macros affecting rules and commands, VPATH too # expensive and these two paths correlate better! override CFLAGS := $(CFLAGS) -O $(addprefix -I,$(subst :, ,$(INCLUDEPATH))) vpath %.h $(INCLUDEPATH) override LDFLAGS := $(LDFLAGS) $(addprefix -L,$(subst :, ,$(LIBPATH))) vpath %.a $(LIBPATH) # These are basically tuning parameters, i.e. the standard # build time dropped around 90% with removal of implicit # processing. .SUFFIXES: .SUFFIXES: .o .a .c .h .l .y .macros # Stop GNU make from doing odd things with libraries # and considering SCCS and RCS implicit stuff. Have # yet to figure out how to terminate source checking! -l% : %.macros : %.h : %.c : % : %,v % : RCS/%,v % : s.% % : SCCS/s.% --------------------------->8 CUT HERE 8<--------------------------- # This is the infx.macros file # # Informix suffixes and rules # Include this set of rules if you are building 4gl/esql exclusively. AR = ar ARFLAGS = ru C4GL = c4gl FORMBLD = form4gl FORMBLDFLAGS = -s HELPBLD = mkmessage .SUFFIXES: .4gl .frm .per .ec .hlp .msg %.4gl : %.ec : %.msg : %.o : %.4gl $(C4GL) $(CFLAGS) -c $< rm -f $(<:.4gl=.c) $(<:.4gl=.ec) (%.o) : %.4gl $(C4GL) $(CFLAGS) -c $< $(AR) $(ARFLAGS) $@ $(<:.4gl=.o) ranlib $@ rm -f $(<:.4gl=.c) $(<:.4gl=.ec) $(<:.4gl=.o) %.o : %.ec $(C4GL) $(CFLAGS) -c $< rm -f $(<:.ec=.c) (%.o) : %.ec $(C4GL) $(CFLAGS) -c $< $(AR) $(ARFLAGS) $@ $(<:.ec=.o) ranlib $@ rm -f $(<:.ec=.c) $(<:.ec=.o) $(MYDBS)%.frm : %.per $(FORMBLD) $(FORMBLDFLAGS) $(<:.per=) mv $(@F) $@ $(MYDBS)%.hlp : %.msg $(HELPBLD) $(<) $(<:.msg=.hlp) mv $(@F) $@ --------------------------->8 CUT HERE 8<--------------------------- # This is the sperinfx.macros file # # Macros for the sql based rules in informix land. # Include these rules if you are building perform forms ESQL = esql AR = ar ARFLAGS = ru C4GL = c4gl CPERF = cperf SFORMBLD = sformbld SFORMOPTIONS = -q .SUFFIXES: .frm .per .o .4gl .ec .c %.per: %.ec: %.4gl: %.o : %.ec $(ESQL) $(CFLAGS) -c $< rm -f $(<:.ec=.c) (%.o) : %.ec $(ESQL) $(CFLAGS) -c $< $(AR) $(ARFLAGS) $@ $% rm -f $(<:.ec=.c) $(<:.ec=.o) $(MYDBS)%.frm : %.per $(SFORMBLD) $(SFORMOPTIONS) $(<:.per=) mv $(@F) $@ (%.o) : %.4gl $(C4GL) $(CFLAGS) -c $< $(AR) $(ARFLAGS) $@ $% rm -f $(<:.4gl=.c) $(<:.4gl=.ec) $(<:.4gl=.o) (%.o) : %.c $(CC) $(CFLAGS) -c $< $(AR) $(ARFLAGS) $@ $% rm -f $% --------------------------->8 CUT HERE 8<--------------------------- # Example Makefile. The names have been changed to protect the innocent. # # # Makefile to build the version of sperform a_form that is used; # add/update/query forms and also the form itself. Set the MACROPATH # value to point to where the above macro files reside. # include $(MACROPATH)stand.macros include $(MACROPATH)sperinfx.macros override CFLAGS := $(CFLAGS) -DDEBUG LIBS = -llibname FORMS = $(MYDBS)a_form.frm all: $(FORMS) $(MYBIN)a_form @- echo form updated. $(MYBIN)a_form: \\ an_object1.o \\ an_object2.o \\ an_object3.o \\ an_object4.o $(CPERF) $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -f \\ *.c clobber: rm -f \\ *.o $(FORMS) \\ $(MYBIN)cr_form \\ -- Bruce W. Hoylman (303-541-6557) -- bruce@USWest.COM if [ -n ${CYCLE} -a ${SOIL_SAMPLE} ]; then __o echo '** stump fault -- biker dump **'; fi >/dev/bummer -\\<, "Cold Filtered, because you don't know what that means." ......O/ O...