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