1 arta 1.1 # Note: this design uses target-specific flags, because it's the only
2 # way to get the value of a variable that's different for each
3 # subdirectory, $(d), into the build recipes. Once you go that way,
4 # you can as well use the feature to specify (extra) objects and
5 # libraries to be linked or archived.
6
7
8 # Standard stuff
9
10 .SUFFIXES:
11 .SUFFIXES: .c .o
12
13 all: targets
14
15 # Subdirectories, in random order
16
|
42 arta 1.1
43 %.o: %.f
44 $(FCOMP)
45
46 # If a .f file is to be compiled more than one, the Rules.mk file that
47 # contains the rules for that .f file exists in a subdirectory of the
48 # directory that contains the .f file. As a result, the stem of the
49 # of the corresponding .o file is the child of the stem of the .f file.
50 %.o: ../%.f
51 $(FCOMP)
52
53 %.o: %.c
54 $(COMP)
55
56 # If a .c file is to be compiled more than one, the Rules.mk file that
57 # contains the rules for that .c file exists in a subdirectory of the
58 # directory that contains the .c file. As a result, the stem of the
59 # of the corresponding .o file is the child of the stem of the .c file.
60 %.o: ../%.c
61 $(COMP)
62
63 arta 1.1 %: %.o
64 $(LINK)
65
66 %: %.c
67 $(COMPLINK)
68
69
70 # These two targets collect real targets, i.e. ones that can be built.
71
72 .PHONY: targets
73 targets: $(TGT_BIN) $(TGT_LIB)
74
75 # These targets merely contain commands to be executed, i.e. they collect
76 # only .PHONY targets, even if they're not explicitly marked as such.
77 # The install target does not collect dependencies (other than for forcing
78 # things to be built) because it's always considered 'out of date' anway as
79 # it's a .PHONY target. Instead, it collects installation commands that will be
80 # ran in addition to the standard ones to install the known targets.
81
82 .PHONY: clean
83 clean:
84 arta 1.1 rm -f $(CLEAN)
85
86 # Prevent make from removing any build targets, including intermediate ones
87
88 .SECONDARY: $(CLEAN)
89
|