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 arta 1.6 # you can as well use the feature to specify (extra) objects and
|
5 arta 1.1 # libraries to be linked or archived.
6
7
8 # Standard stuff
9
10 .SUFFIXES:
|
11 arta 1.6 .SUFFIXES: .c .o
|
12 arta 1.1
13 all: targets
14
15 # Subdirectories, in random order
16
|
17 arta 1.2 dir := base
18 -include $(SRCDIR)/$(dir)/Rules.mk
|
19 arta 1.6
|
20 arta 1.2 dir := proj
|
21 arta 1.6 -include $(SRCDIR)/$(LOCALIZATIONDIR)/includes.mk
|
22 arta 1.1
23 # Non-default targets
24 idl: $(LIBJSOC_MAIN_SOCK_I)
25 dsds: $(LIBSOIJSOC) $(LIBDSDS)
26 examples: $(EXAMPLES)
27 sums: $(SUMS_BIN)
28 universe: targets idl dsds examples sums $(LIBDSPUTIL)
29
30 # General directory-independent flags (MUST BE DEFINED BEFORE THE SECTION
31 # "General directory-independent rules"
32 $(FPICOBJ): CF_TGT := $(CF_TGT) -fPIC
33
34 $(FIOBJ): CF_TGT := $(CF_TGT) -DFLIB
35
36 $(IIOBJ): CF_TGT := $(CF_TGT) -DIDLLIB
37
38 # General directory-independent rules
39 %.c: %.pgc
40 $(ECPG)
|
41 karen 1.3 %.c: %.i
42 $(SWIG)
|
43 arta 1.1
44 %.o: %.f
45 $(FCOMP)
46
|
47 arta 1.4 %.o: %.f90
48 $(FCOMP)
49
|
50 arta 1.1 # If a .f file is to be compiled more than one, the Rules.mk file that
|
51 arta 1.6 # contains the rules for that .f file exists in a subdirectory of the
52 # directory that contains the .f file. As a result, the stem of the
|
53 arta 1.1 # of the corresponding .o file is the child of the stem of the .f file.
54 %.o: ../%.f
55 $(FCOMP)
56
|
57 arta 1.4 %.o: ../%.f90
58 $(FCOMP)
59
|
60 arta 1.1 %.o: %.c
61 $(COMP)
62
63 # If a .c file is to be compiled more than one, the Rules.mk file that
|
64 arta 1.6 # contains the rules for that .c file exists in a subdirectory of the
65 # directory that contains the .c file. As a result, the stem of the
|
66 arta 1.1 # of the corresponding .o file is the child of the stem of the .c file.
67 %.o: ../%.c
68 $(COMP)
69
70 %: %.o
71 $(LINK)
72
73 %: %.c
74 $(COMPLINK)
75
76
77 # These two targets collect real targets, i.e. ones that can be built.
78
79 .PHONY: targets
80 targets: $(TGT_BIN) $(TGT_LIB)
81
82 # These targets merely contain commands to be executed, i.e. they collect
|
83 arta 1.6 # only .PHONY targets, even if they're not explicitly marked as such.
|
84 arta 1.1 # The install target does not collect dependencies (other than for forcing
85 # things to be built) because it's always considered 'out of date' anway as
86 # it's a .PHONY target. Instead, it collects installation commands that will be
87 # ran in addition to the standard ones to install the known targets.
88
89 .PHONY: clean
90 clean:
91 rm -f $(CLEAN)
92
93 # Prevent make from removing any build targets, including intermediate ones
94
95 .SECONDARY: $(CLEAN)
|