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.

The Makefile:
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?
Note:
  • Line 01 defines the all dependency rule that will be executed by default, and depends from the rule orders described on line 31. You execute this rule with make all , or make since this is the first rule in the Makefile.
  • Lines 03 and 04 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 and 07 define a dependency to compile the orderform.per form.
  • Lines 09 and 10 define a dependency to compile the custlist.4gl module.
  • Lines 12 and 13 define a dependency to compile the custlist.per form.
  • Lines 15 and 16 define a dependency to compile the stocklist.4gl module.
  • Lines 18 and 19 define a dependency to compile the stocklist.per form.
  • Lines 21 thru 24 define the list of compiled modules, used in the global orders dependency rule.
  • Lines 26 thru 29 define the list of compiled form files, used in the global orders dependency rule.
  • Lines 31 and 32 is the global 'orders' dependency rule, defining modules or form files to be created.
  • Lines 34 and 35 define a rule and command to execute the program. You execute this rule with make run.
  • Lines 37 and 38 define a rule and command to clean the directory. You execute this rule with make clean.