(file) Return to Rules.mk CVS log (file) (dir) Up to [Development] / JSOC

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

Karen Tian
Powered by
ViewCVS 0.9.4