FREE C4gl Makefile - Holiday special
Posted in 1994
Friends of INFORMIX: I had numerous requests for a makefile with rules to get from 4GL to exe, so I'll post it here to make it a bit easier to obtain. The AOL editor won't allow me to "attach" a file, so I had to "copy/paste" the makefile into the AOL mail editor. It probably loses in the translation the TAB chars, but the price is right, eh? This is not the perfect and only way to do it, and there's probably better makefiles around. Any improvements would be gladly accepted! This one will get you started if you've never used make, and of course you can always improve it! To use: Copy the makefile to a file called "program.mk" or whatever you want. Save this master version to be copied again. Edit the copy, put in the program references for a particular program, and MAKE as follows: "make -f program.mk" I must confess I'm new to RDS--my latest project is all RDS without any c4gl--so the RDS stuff may need to be "enhanced". Remember, if it's documented, it's a feature, not documented, it's a bug. :-) Tim Schaefer The Computer Business Co, Inc. ###################### 4GL MAKE RULES ############################ .SUFFIXES: .per .per~ .frm .a .o .c .c~ .ec .4gl~ .4gl .per~.per: ${GET} ${GFLAGS} $< .c~.c: ${GET} ${GFLAGS} $< .c.o: @echo "--------------------------------- .c.o" $(CC) -c $(CFLAGS) $*.c 2>&1 .c.a: @echo "--------------------------------- .c.a" $(CC) -c $(CFLAGS) $*.c 2>&1 $(AR) $(ARFLAGS) $@ $*.o rm -f $*.o .ec.c: @echo "--------------------------------- .ec.c" $(FGLC2) -4GL $*.ec .ec.o: @echo "--------------------------------- .ec.o" $(FGLC2) -4GL $*.ec $(CC) -c $(CFLAGS) $*.c 2>&1 $(RM) $*.c .ec.a: @echo "--------------------------------- .ec.a" $(FGLC2) -4GL $*.ec $(CC) -c $(CFLAGS) $*.c 2>&1 $(AR) $(ARFLAGS) $@ $*.o $(RM) $*.o $*.c .4gl.ec: @echo "--------------------------------- .4gl.ec" $(FGLC) $*.4gl .4gl.c: @echo "--------------------------------- .4gl.c" $(FGLC) $*.4gl $(FGLC2) -4GL $*.ec $(RM) $*.ec .4gl.o: @echo "--------------------------------- .4gl.o" $(FGLC) $*.4gl $(FGLC2) -4GL $*.ec $(CC) -c $(CFLAGS) $*.c 2>&1 $(RM) $*.c $*.ec .4gl.a: @echo "--------------------------------- .4gl.a" $(FGLC) $*.4gl $(FGLC2) -4GL $*.ec $(CC) -c $(CFLAGS) $*.c 2>&1 $(AR) $(ARFLAGS) $@ $*.o $(RM) $*.o $*.c $*.ec .per.frm: $(FORMFGL) $< ######################################################################### INFDIR=/usr/informix CC=cc -I${INFDIR}/incl CFLAGS=-O # # LIBS out of c4gl # VI the c4gl script to confirm the libraries! # # 4.1 version LIBS=${INFDIR}/lib/lib4gl.a ${INFDIR}/lib/libnforms.a ${INFDIR}/lib/libfesql.a -lcurses # 2.1 version # LIBS=${INFDIR}/lib/lib4gl.a ${INFDIR}/lib/libforms.a ${INFDIR}/lib/libsql.a -lcurses FGLC=${INFDIR}/lib/fglc FGLC2=${INFDIR}/lib/fglc2 ESQL=${INFDIR}/bin/esql LIBDIR=${INFDIR}/lib FORMFGL=${INFDIR}/bin/form4gl RM=/bin/rm ######################################################################### GLOBALS = FOBJS = ########################################################################## ##### # Note: FILES is a list of the 4GL source files you want catted together # if you're using RDS. # CFILES - optional, maybe use for documentation ? ########################################################################## ##### FILES = CFILES = COBJS = EXE = FRMS = SFGOBJS = fgiusr.o $(COBJS) ########################################################################## # # RDS OBJECTS ########################################################################## # SFGI = S_${BASE_FGL_FILE}.4gi SFGO = S_${BASE_FGL_FILE}.4go # Single catted together file of all your source: SFGL = S_${BASE_FGL_FILE}.4gl # RDS runtime: NFGO = R_${BASE_FGL_FILE} # RDS DEBUG runtime: NFDB = D_${BASE_FGL_FILE} # Runner shell script created for you: RUN_SH = R_${BASE_FGL_FILE}.sh # Debug shell script created for you: DBG_SH = D_${BASE_FGL_FILE}.sh # Basic C compile version: # all: $(EXE) $(FRMS) $(SFGL) # Compile RDS and C version: all: $(EXE) $(FRMS) $(SFGL) $(SFGO) $(SFGI) $(NFGO) $(NFDB) $(EXE): $(GLOBALS) $(FOBJS) $(COBJS) $(CC) $(CFLAGS) $(GLOBALS) $(FOBJS) $(COBJS) $(LIBS) -o $(EXE) ls -l $(EXE) strip $(EXE) ls -l $(EXE) $(NFGO): $(SFGOBJS) cfglgo $(SFGOBJS) -o $(NFGO) -s @echo "$(NFGO) $(SFGO)" > $(RUN_SH) chmod 755 $(RUN_SH) $(NFDB): $(SFGOBJS) cfgldb $(SFGOBJS) -o $(NFDB) -s @echo "$(NFDB) $(SFGO)" > $(DBG_SH) chmod 755 $(DBG_SH) $(SFGI): $(SFGO) cat $(SFGO) > $(SFGI) $(SFGO): $(SFGL) fglpc $(SFGL) ######################################################################### # NOTE: Put the word "GLOBALS" in the actual globals file indented # a space or two to prevent it from being commented-out. ######################################################################### $(SFGL): $(FILES) cat $(FILES) | sed 's/^GLOBALS/#GLOBALS/' > $(SFGL) ######################################################################### # Put your target: source rules here for all your files. # Add as you go. If you want to create a dependency on your GLOBALS # file put it next to all your other files. # # Example: If program01.4gl was your globals file, then: # # program.o: program.4gl program01.o # # program01.o: program01.4gl # # program02.o: program02.4gl program01.o # # etc.... #########################################################################