The Makefile
The BDL modules and forms used by the application in this chapter can be compiled and linked in Genero Studio using the Application-level Execute or Build options. If you prefer command line tools you can compile and link using a Makefile. This file is interpreted by the make utility, which is a well-known tool to build large programs based on multiple sources and forms.
The make utility reads the dependency rules defined in the Makefile for each program component, and executes the commands associated with the rules.
This section only describes the Makefile used in this example. For more details about Makefiles, see Using makefiles in the Genero Business Development Language User Guide.
01
all:: orders
02
03
orders.42m: orders.4gl
04
fglcomp -M orders.4gl
05
06
orderform.42f: orderform.per
07
fglform -M orderform.per
08
09
custlist.42m: custlist.4gl
10
fglcomp -M custlist.4gl
11
12
custlist.42f: custlist.per
13
fglform -M custlist.per
14
15
stocklist.42m: stocklist.4gl
16
fglcomp -M stocklist.4gl
17
18
stocklist.42f: stocklist.per
19
fglform -M stocklist.per
20
21
MODULES=\
22
orders.42m\
23
custlist.42m\
24
stocklist.42m
25
26
FORMS=\
27
orderform.42f\
28
custlist.42f\
29
stocklist.42f
30
31
orders:: $(MODULES) $(FORMS)
32
fgllink -o orders.42r $(MODULES)
33
34
run::
35
fglrun orders
36
37
clean::
38
rm -f *.42?
- Line
01
defines theall
dependency rule that will be executed by default, and depends from the ruleorders
described on line31
. You execute this rule with make all , or make since this is the first rule in the Makefile. - Lines
03
and04
define a dependency to compile the orders.4gl module into orders.42m. The file on the left (orders.42m) depends from the file on the right ( orders.4gl ), and the command to be executed is fglcomp -M orders.4gl . - Lines
06
and07
define a dependency to compile the orderform.per form. - Lines
09
and10
define a dependency to compile the custlist.4gl module. - Lines
12
and13
define a dependency to compile the custlist.per form. - Lines
15
and16
define a dependency to compile the stocklist.4gl module. - Lines
18
and19
define a dependency to compile the stocklist.per form. - Lines
21
thru24
define the list of compiled modules, used in the globalorders
dependency rule. - Lines
26
thru29
define the list of compiled form files, used in the globalorders
dependency rule. - Lines
31
and32
is the global 'orders
' dependency rule, defining modules or form files to be created. - Lines
34
and35
define a rule and command to execute the program. You execute this rule with make run. - Lines
37
and38
define a rule and command to clean the directory. You execute this rule with make clean.