Using makefiles

Describes how to define program construction rules in makefiles.

Most UNIX™ platforms provide the make utility program to compile projects. The make program is an interpreter of makefiles. These files contain directives to compile and link programs and/or generate other kind of files.

When developing on Microsoft™ Windows™ platforms, you may use the NMAKE utility provided with Visual C++. However, this tool does not have the same behavior as the UNIX make program. To have a compatible make on Windows, you can install a GNU make or third party UNIX tools such as Cygwin.

For more details about the make utility, see the platform-specific documentation.

The follow example shows a typical makefile for Genero applications:

#------------------------------------------------------
# Generic makefile rules to be included in Makefiles
.SUFFIXES: .42s .42f .42m .42r .str .per .4gl .msg .hlp 
FGLFORM=fglform -M 
FGLCOMP=fglcomp -M 
FGLLINK=fglrun -l 
FGLMKMSG=fglmkmsg 
FGLMKSTR=fglmkstr 
FGLLIB=$$FGLDIR/lib/libfgl4js.42x 
all::
.msg.hlp:
        $(FGLMKMSG) $*.msg $*.hlp
.str.42s:
        $(FGLMKSTR) $*.str $*.42s
.per.42f:
        $(FGLFORM) $*.per
.4gl.42m:
        $(FGLCOMP) $*.4gl 
clean::
        rm -f *.hlp *.42? *.out
#-----------------------------
# Makefile example 
include Makeincl 
FORMS=\
 customers.42f\
 orderlist.42f\
 itemlist.42f 
MODULES=\
 customerInput.42m\
 zoomOrders.42m\
 zoomItems.42m 
customer.42x: $(MODULES)
        $(FGLLINK) -o customer.42x $(MODULES)
all:: customer.42x $(FORMS)