[Bio] / ReleaseTools / Makefile.top Repository:
ViewVC logotype

Annotation of /ReleaseTools/Makefile.top

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (view) (download)

1 : efrank 1.14 ########################################################################
2 :     # Top level makefile for ReleaseTools. Will be copied into work
3 :     # directory as Makefile. Our job here is to define basic environment
4 :     # and then iterate over the checked outpackages in the work directory,
5 :     # invoking make methods there. This is one level! Not recursive.
6 : efrank 1.1 #
7 : efrank 1.14 # Ed Frank, Argonne National Laboratory
8 :     # Based upon work of Bob Jacobsen, Lawrence Berkeley National Lab
9 :     ########################################################################
10 :    
11 :    
12 :     ########################################################################
13 :     # The basic environment, macros etc. Our only external environment
14 :     # variables are:
15 :     # RTDIST
16 :     # RTARCH
17 :     # RTCURRENT
18 :     ########################################################################
19 : efrank 1.2
20 :    
21 :     SHELL = /bin/sh
22 :    
23 : efrank 1.14 # these two used to be "if ndef". why?
24 :    
25 :     export PWD := $(shell pwd)
26 :     export TOPDIR := $(shell /bin/pwd)
27 : efrank 1.2
28 :     # expect includes of the form #include "PackageName/item.h"
29 :     CPPFLAGS += -I$(PWD)
30 : olson 1.9 LDFLAGS += -L$(PWD)/$(RTARCH)/lib
31 : efrank 1.13 MAKEINCLUDE := -I$(PWD)/ReleaseTools
32 :    
33 :     # this isn't right...should look at rtDist to figure out
34 :     # where THIS workdir came from
35 : efrank 1.2
36 :     ifdef RTCURRENT
37 : olson 1.9 CPPFLAGS += -I$(RTDIST)/releases/$(RTCURRENT)/$(RTARCH)/include
38 :     LDFLAGS += -L$(RTDIST)/releases/$(RTCURRENT)/$(RTARCH)/lib
39 : efrank 1.13 MAKEINCLUDE += -I$(RTDIST)/releases/$(RTCURRENT)/ReleaseTools
40 : efrank 1.2 endif
41 :    
42 : efrank 1.14 libdir = $(PWD)/$(RTARCH)/lib
43 :     bindir = $(PWD)/$(RTARCH)/bin
44 :     cgidir = $(PWD)/$(RTARCH)/CGI
45 :     workdir =$(PWD)/$(RTARCH)/tmp
46 :     tutdir = $(PWD)/$(RTARCH)/Tutorial
47 : efrank 1.2
48 : efrank 1.17 TOOL_HDR := $(TOPDIR)/$(RTARCH)/tool_hdr
49 :     TOOL_HDR_PY := $(TOPDIR)/$(RTARCH)/tool_hdr_py
50 : efrank 1.13
51 : efrank 1.2 PACKAGES := $(subst /,, $(dir $(wildcard */Makefile)))
52 :    
53 : efrank 1.14 #
54 :     # OVERRIDES is a macro passed into children-makes to guide them.
55 :     #
56 :    
57 :     OVERRIDES = \
58 :     $(MAKEINCLUDE) \
59 :     TOPDIR=$(TOPDIR) \
60 :     TOOL_HDR=$(PWD)/$(RTARCH)/tool_hdr \
61 :     TOOL_HDR_PY=$(PWD)/$(RTARCH)/tool_hdr_py \
62 :     libdir=$(libdir) \
63 :     bindir=$(bindir) \
64 :     cgidir=$(cgidir) \
65 :     PKGNAME=$(basename $@) \
66 :     CPPFLAGS="$(CPPFLAGS)" \
67 :     LDFLAGS="$(LDFLAGS)" \
68 :     workdir=$(workdir)/$(basename $@) \
69 :     tutdir=$(tutdir)
70 :    
71 :     ########################################################################
72 :     #
73 :     # Targets- these are actually done by the packages, except for
74 :     # a few setup-like things, eg., installdirs.
75 :     #
76 :     # Note that the behavior of package makefiles is centralized
77 :     # into ReleaseTools/standard.mk. The package makefiles only
78 :     # define a few macros to define their needs, whenever possible.
79 :     #
80 :     ########################################################################
81 :    
82 : efrank 1.15 .PHONY: lib bin schematools stDeclFiles stGeneratedFiles clean test purge check_env
83 : efrank 1.14
84 :     # if you change all: make sure all: in standard.mk is consistent.
85 :    
86 :     all: Makefile installdirs decouple schematools lib bin
87 :    
88 : efrank 1.15 schematools: stDeclFiles stGeneratedFiles
89 :    
90 : efrank 1.14 # The rule is that all the lib targets from the various packages can
91 :     # be built in any order. After that, all teh bins can go, again in
92 :     # any order. But there are a *very few* things that need to be built
93 :     # first and perhaps in order. The decouple: target handles those.
94 :     # The $(wildcard foo) trick returns an empty list of foo is not
95 :     # present, e.g., the package is not checked out. This lets the
96 :     # decouple target be declared without forcing people to check out
97 :     # those packages, i.e., they can just run off the versions in the
98 :     # base release. Thus, decouple is for from-scratch release builds
99 :     # and for development of these few, special core packages.
100 :    
101 : efrank 1.17 decouple: $(wildcard ReleaseTools) $(wildcard KahDataServices) $(TOOL_HDR) $(TOOL_HDR_PY)
102 : efrank 1.14
103 :    
104 :    
105 :    
106 :     # Use the PACKAGES macro to transform lib, bin, etc., targets
107 :     # into package level dependencies, e.g., lib -> PkgA.lib, PkgB.lib
108 :     # Rules below then cause PkgA.lib to do a make in PkgaA on lib:
109 :    
110 :     ALL.LIB = check_env $(foreach var,$(PACKAGES),$(var).lib)
111 :     lib: Makefile $(ALL.LIB)
112 :    
113 :     ALL.BIN = check_env $(foreach var,$(PACKAGES),$(var).bin)
114 :     bin: Makefile $(ALL.BIN)
115 :    
116 : efrank 1.15 ALL.STDECLFILES = check_env $(foreach var,$(PACKAGES),$(var).stDeclFiles)
117 :     stDeclFiles: Makefile $(ALL.STDECLFILES)
118 :    
119 :     ALL.STGENERATEDFILES = check_env $(foreach var,$(PACKAGES),$(var).stGeneratedFiles)
120 :     stGeneratedFiles: Makefile $(ALL.STGENERATEDFILES)
121 : efrank 1.14
122 :     ALL.TEST = check_env $(foreach var,$(PACKAGES),$(var).test)
123 :     test: Makefile $(ALL.TEST)
124 :    
125 :     ALL.CLEAN = check_env $(foreach var,$(PACKAGES),$(var).clean)
126 :     #clean: $(ALL.CLEAN)
127 : efrank 1.7
128 : efrank 1.14 clean: Makefile check_env purge installdirs
129 : olson 1.11
130 : efrank 1.14 purge: check_env
131 :     rm -rf $(RTARCH)/bin $(RTARCH)/lib $(RTARCH)/tmp $(RTARCH)/CGI
132 :    
133 :     # Make sure the top-level makefile is up to date
134 :     # the wildcard below only returns something if ReleaseTools is checked out.
135 :     # Otherwise, if ReleaseTools was not checked out, make would complain and
136 :     # quit about "no such file"
137 :    
138 :     Makefile: $(wildcard ReleaseTools/Makefile.top)
139 :     echo $(wildcard ReleaseTools/Makefile.top)
140 : olson 1.11 cp ReleaseTools/Makefile.top Makefile
141 :     @echo ""
142 :     @echo "A new makefile was installed; please rerun your make command."
143 :     @echo ""
144 :     @exit 1
145 :    
146 : olson 1.12 check_env:
147 :     ifndef RTARCH
148 :     @echo ""
149 :     @echo "FIG build environment is not properly configured."
150 :     @echo "Did you source fig-user-env ?"
151 :     @echo ""
152 :     @exit 1
153 :     endif
154 : efrank 1.4
155 : efrank 1.14 ##
156 :     # Targets to setup the expected directory structure for the
157 :     # work directory. The work directory should be created
158 :     # with the mkworkdir command.
159 :     ###
160 :    
161 : efrank 1.6 # If make installdirs is called when no packages are checked out,
162 :     # then lib and tmp are not made. So we add two rules here
163 :     # to handle that case.
164 :    
165 : redwards 1.16 installdirs: check_env $(libdir) $(bindir) $(cgidir) $(cgidir)/Html $(cgidir)/Html/css $(workdir) $(tutdir)
166 : olson 1.12 - mkdir -p $(tutdir) $(tutdir)/python $(tutdir)/perl
167 : efrank 1.6 - mkdir -p $(libdir)
168 :     - mkdir -p $(workdir)
169 : olson 1.9 - mkdir -p $(bindir)
170 :     - mkdir -p $(cgidir)
171 : olson 1.10 - mkdir -p $(cgidir)/p2p
172 : efrank 1.4
173 : efrank 1.5 # the subdirs are for putting python pyc etc. into
174 :    
175 :     $(libdir): $(foreach var,$(PACKAGES),$(libdir)/$(var).installdirs)
176 :    
177 :     $(libdir)/%.installdirs:
178 :     - mkdir -p $(@:.installdirs=)
179 : efrank 1.14 - mkdir -p $(@:.installdirs=)Gen
180 :     - touch $(@:.installdirs=)Gen/__init__.py
181 : efrank 1.4
182 : olson 1.12 $(bindir):
183 : efrank 1.4 - mkdir -p $(bindir)
184 :    
185 :     $(cgidir):
186 : olson 1.11 - mkdir $(cgidir)
187 :     - mkdir $(cgidir)/p2p
188 : efrank 1.8
189 : olson 1.12 $(tutdir):
190 :     - mkdir $(tutdir)
191 :     - mkdir $(tutdir)/python
192 :     - mkdir $(tutdir)/perl
193 :    
194 : efrank 1.8 $(cgidir)/Html:
195 :     mkdir -p $(cgidir)/Html
196 : efrank 1.4
197 : redwards 1.16 $(cgidir)/Html/css:
198 :     mkdir -p $(cgidir)/Html/css
199 :    
200 : efrank 1.4 $(workdir): $(foreach var,$(PACKAGES),$(workdir)/$(var).installdirs)
201 :    
202 :     $(workdir)/%.installdirs:
203 :     - mkdir -p $(@:.installdirs=)
204 :    
205 : efrank 1.2
206 :    
207 : efrank 1.14 ########################################################################
208 :     # Rules
209 :     #
210 :     # These rules convert PACKAGENAME.rule into make operations
211 : efrank 1.17 # in PACKAGENAME. Real rules live in standard.mk
212 : efrank 1.14 ########################################################################
213 : efrank 1.2
214 : efrank 1.14 %.all:
215 :     @$(MAKE) -C $(@:.lib=) $(OVERRIDES) all
216 : efrank 1.2
217 :     %.lib:
218 : olson 1.11 @$(MAKE) -C $(@:.lib=) $(OVERRIDES) lib
219 : efrank 1.2
220 :     %.bin:
221 : olson 1.11 @$(MAKE) -C $(@:.bin=) $(OVERRIDES) bin
222 : efrank 1.2
223 : efrank 1.14 %.schematools:
224 :     @$(MAKE) -C $(@:.schematools=) $(OVERRIDES) schematools
225 :    
226 : efrank 1.15 %.stDeclFiles:
227 :     @$(MAKE) -C $(@:.stDeclFiles=) $(OVERRIDES) stDeclFiles
228 :    
229 :     %.stGeneratedFiles:
230 :     @$(MAKE) -C $(@:.stGeneratedFiles=) $(OVERRIDES) stGeneratedFiles
231 :    
232 : efrank 1.2 %.test:
233 : olson 1.11 @$(MAKE) -C $(@:.test=) $(OVERRIDES) test
234 : efrank 1.2
235 :     %.clean:
236 : olson 1.11 @$(MAKE) -C $(@:.clean=) $(OVERRIDES) clean
237 : efrank 1.2
238 : efrank 1.14 # implementation of the decouple: steps that just build whole packages
239 :     # the .PHONY here lets us defer to the lib and bin in the package
240 :    
241 :     .PHONY: KahDataServices
242 :     KahDataServices:
243 :     # this one we do by hand and a little out of order...
244 :     # we must get bin done here to have the programs that
245 :     # implement schematools target.
246 :     @$(MAKE) -C $(@:.clean=) $(OVERRIDES) lib
247 :     @$(MAKE) -C $(@:.clean=) $(OVERRIDES) bin
248 :     @$(MAKE) -C $(@:.clean=) $(OVERRIDES) schematools
249 :    
250 :     .PHONY: ReleaseTools
251 :     ReleaseTools:
252 :     @$(MAKE) -C $(@:.clean=) $(OVERRIDES) all
253 :    
254 : efrank 1.17 ##
255 :     # generation of the tool_header files. part of decouple
256 :     # these live in $(TOPDIR)/$(RTARCH) but should live
257 :     # in $(libdir).
258 : efrank 1.18 #
259 :     # We use the wildcard trick again so that we have the dependency
260 :     # only if ReleaseTools is checked out. If not checked out, we
261 :     # are by definition satisfied with makeScriptHeaders in the base
262 :     # release. Note we must make the dependency be on the source file,
263 :     # not the $(bindir) file because if the latter does not exist, the
264 :     # wildcard fails and there's no dependency! But if the ReleaseTools/make*
265 :     # exists and is newer, then we just defer to the ReleaseTools target
266 :     # used above for decouple:
267 : efrank 1.17 ##
268 :    
269 : efrank 1.18
270 : efrank 1.19 $(TOPDIR)/$(RTARCH)/tool_hdr: $(wildcard ReleaseTools/makeScriptHeaders)
271 : efrank 1.17 cd $(TOPDIR); $(bindir)/makeScriptHeaders $(TOPDIR)
272 :    
273 : efrank 1.19 $(TOPDIR)/$(RTARCH)/tool_hdr_py: $(wildcard ReleaseTools/makeScriptHeaders)
274 : efrank 1.17 cd $(TOPDIR); $(bindir)/makeScriptHeaders $(TOPDIR)
275 :    
276 : efrank 1.19 ReleaseTools/makeScriptHeaders: ReleaseTools

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3