1 |
williamc |
1.21 |
# useful make internals
|
2 |
|
|
empty:=
|
3 |
|
|
space:=$(empty) $(empty)
|
4 |
|
|
|
5 |
|
|
#
|
6 |
|
|
# reset make default variables
|
7 |
|
|
#
|
8 |
|
|
CXX:=
|
9 |
|
|
FC:=
|
10 |
|
|
|
11 |
williamc |
1.1 |
#
|
12 |
|
|
# Preliminaries
|
13 |
|
|
#
|
14 |
sashby |
1.32 |
# Path to debug libs:
|
15 |
|
|
DEBUGLIBDIR=$(LOCALTOP)/lib/$(SCRAM_ARCH)/debug $(RELEASETOP)/lib/$(SCRAM_ARCH)/debug
|
16 |
|
|
LIBDIR=$(DEBUGLIBDIR) $(LOCALTOP)/lib/$(SCRAM_ARCH) $(RELEASETOP)/lib/$(SCRAM_ARCH) $(PRIORITY_LIBDIR)
|
17 |
williamc |
1.18 |
CXXFLAGS+=$(CXXUSERFLAGS)
|
18 |
|
|
JAVA_CLASSDIR=$(LOCALTOP)/lib/$(SCRAM_ARCH)
|
19 |
sashby |
1.26 |
UNAME:=$(shell uname)
|
20 |
williamc |
1.1 |
#
|
21 |
|
|
# Make sure nobody tries to run this directly through gmake
|
22 |
|
|
#
|
23 |
|
|
ifndef DefaultMakefile
|
24 |
|
|
all: exit
|
25 |
|
|
endif
|
26 |
|
|
|
27 |
williamc |
1.18 |
# Quiet setting for <Build> tags
|
28 |
|
|
QUIET = no
|
29 |
|
|
ifeq ($(QUIET),yes)
|
30 |
|
|
_quietbuild_ = @echo "Creating $<...";
|
31 |
|
|
_quietstamp_ = @
|
32 |
|
|
else
|
33 |
|
|
_quietbuild_ =
|
34 |
|
|
_quietstamp_ = @
|
35 |
|
|
endif
|
36 |
|
|
|
37 |
|
|
#
|
38 |
|
|
# Generic scram build target
|
39 |
|
|
#
|
40 |
|
|
scrambuild_% :
|
41 |
|
|
@dir=$(subst scrambuild_,,$@); \
|
42 |
|
|
if [ -d $(LOCALTOP)/$(INTsrc)/$$dir ]; then \
|
43 |
|
|
echo "------- Building ---- $$dir -----------"; \
|
44 |
sashby |
1.24 |
cd $(LOCALTOP)/$(INTsrc)/$$dir; $(SCRAM) build; \
|
45 |
williamc |
1.18 |
fi
|
46 |
|
|
|
47 |
williamc |
1.21 |
#
|
48 |
|
|
# Get local mods
|
49 |
|
|
#
|
50 |
|
|
ifdef LatestBuildFile
|
51 |
|
|
include ${LatestBuildFile}
|
52 |
|
|
endif
|
53 |
|
|
|
54 |
|
|
#
|
55 |
|
|
# get build requirements Class
|
56 |
|
|
#
|
57 |
|
|
ifdef DefaultBuildFile
|
58 |
|
|
include ${DefaultBuildFile}
|
59 |
|
|
endif
|
60 |
williamc |
1.18 |
|
61 |
williamc |
1.14 |
# -- storage of libraries
|
62 |
williamc |
1.21 |
librarystore:=$(SCRAMSTORE_lib)
|
63 |
sashby |
1.32 |
debuglibrarystore:=$(librarystore)/debug
|
64 |
williamc |
1.20 |
INTlib:=$(SCRAMSTORENAME_lib)
|
65 |
williamc |
1.14 |
libsavaillocal=$(notdir $(wildcard $(librarystore)/*))
|
66 |
|
|
libsavailbase=$(notdir $(wildcard $(RELEASETOP)/$(INTlib)/*))
|
67 |
|
|
libsavail=$(sort $(libsavailbase) $(libsavaillocal))
|
68 |
|
|
libslocal=$(foreach var,$(lib),$(filter lib$(var).a, $(libsavail)))
|
69 |
|
|
libslocal_I=$(foreach var,$(lib_I),$(filter lib$(var).a, $(libsavail)))
|
70 |
|
|
libslocal_d=$(foreach var,$(lib_d),$(filter lib$(var).a, $(libsavail)))
|
71 |
williamc |
1.1 |
|
72 |
|
|
#
|
73 |
|
|
# Pointing to file storage locations for the various types
|
74 |
|
|
#
|
75 |
|
|
# -- src code and unspecified types
|
76 |
|
|
VPATH:=$(LOCALTOP)/$(ClassDir):$(RELEASETOP)/$(ClassDir)
|
77 |
|
|
# -- .o files will be kept in the working directory
|
78 |
|
|
vpath %.o $(LOCALTOP)/$(workdir):$(RELEASETOP)/$(workdir)
|
79 |
|
|
|
80 |
|
|
#
|
81 |
|
|
ifdef ReqDependencies
|
82 |
|
|
always:$(LOCALTOP)/$(workdir)/PackageReqs
|
83 |
williamc |
1.11 |
$(LOCALTOP)/$(workdir)/PackageReqs:$(ReqDependencies)
|
84 |
williamc |
1.18 |
$(SCRAMPERL) $(TOOL_HOME)/BuildPackageReqs $@ $?
|
85 |
williamc |
1.1 |
endif
|
86 |
|
|
|
87 |
williamc |
1.18 |
|
88 |
williamc |
1.9 |
#
|
89 |
williamc |
1.18 |
# Group Settings
|
90 |
|
|
#
|
91 |
|
|
ifdef SCRAM_GROUPSDIR
|
92 |
|
|
-include $(SCRAM_GROUPSDIR)
|
93 |
|
|
endif
|
94 |
|
|
|
95 |
williamc |
1.21 |
# -- compilers.mk - to be removed when contents of compiler.mk expunged
|
96 |
|
|
include ${TOOL_HOME}/compilers.mk
|
97 |
|
|
|
98 |
sashby |
1.26 |
# -- Try adding SWIG stuff here
|
99 |
|
|
export TOPDIR=$(RELEASETOP)/src
|
100 |
|
|
export USERDIR=$(LOCALTOP)/src
|
101 |
|
|
# Set base of ANAPHE distro:
|
102 |
|
|
ifeq ($(UNAME),Linux)
|
103 |
|
|
export LHCXX_BASE=/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2
|
104 |
sashby |
1.27 |
# Also need a OBJY thing here:
|
105 |
|
|
export OBJY_VERS=6.1
|
106 |
|
|
export OBJY_DIR=$(LHCXX_BASE)/Objectivity/$(OBJY_VERS)
|
107 |
sashby |
1.26 |
endif
|
108 |
sashby |
1.27 |
|
109 |
sashby |
1.26 |
export LHCXXTOP=/afs/cern.ch/sw/lhcxx
|
110 |
|
|
export BFARCH
|
111 |
|
|
|
112 |
|
|
PYDIRS = $(wildcard $(USERDIR)/*/*/python/)
|
113 |
sashby |
1.23 |
|
114 |
sashby |
1.26 |
#
|
115 |
williamc |
1.9 |
# Site settings
|
116 |
|
|
#
|
117 |
|
|
clientmakefile=$(LOCALTOP)/$(INTwork)/clientmakefile
|
118 |
williamc |
1.17 |
-include $(clientmakefile)
|
119 |
williamc |
1.1 |
|
120 |
|
|
#
|
121 |
|
|
# get build targets
|
122 |
|
|
#
|
123 |
|
|
include ${TOOL_HOME}/toolrules.mk
|
124 |
|
|
|
125 |
|
|
#
|
126 |
|
|
# -- Some tool setups which dont yet have a home
|
127 |
|
|
#
|
128 |
williamc |
1.18 |
CPPFLAGS += $(addprefix -I,$(PRIORITY_INCLUDE)) $(INCLUDEPATH)
|
129 |
williamc |
1.1 |
|
130 |
|
|
#
|
131 |
|
|
# now add our includepath
|
132 |
|
|
#
|
133 |
sashby |
1.31 |
INCLUDEPATH:=$(filter-out -I$(LOCALTOP)/${INTsrc}, $(INCLUDEPATH))
|
134 |
|
|
INCLUDEPATH+=-I$(LOCALTOP)/${INTsrc}
|
135 |
|
|
INCLUDEPATH:=$(filter-out -I$(RELEASETOP)/${INTsrc}, $(INCLUDEPATH))
|
136 |
|
|
INCLUDEPATH+=-I$(RELEASETOP)/${INTsrc}
|
137 |
williamc |
1.1 |
|
138 |
williamc |
1.5 |
#
|
139 |
|
|
# Dependency information
|
140 |
|
|
#
|
141 |
williamc |
1.9 |
-include dependencies.mk
|
142 |
williamc |
1.5 |
|
143 |
williamc |
1.1 |
#
|
144 |
|
|
# Process Subdirs
|
145 |
|
|
#
|
146 |
|
|
ifdef SUBDIRS
|
147 |
williamc |
1.12 |
$(SUBDIRS)::
|
148 |
williamc |
1.1 |
@echo ------- Building ---- $@ -----------
|
149 |
williamc |
1.18 |
@if [ -d $(LOCALTOP)/$(ClassDir)/$@ ]; then \
|
150 |
sashby |
1.24 |
cd $(LOCALTOP)/$(ClassDir)/$@; $(SCRAM) build; \
|
151 |
williamc |
1.18 |
else echo SCRAM Warning : $@ does not exist; \
|
152 |
|
|
fi
|
153 |
williamc |
1.1 |
endif
|
154 |
|
|
|
155 |
|
|
#
|
156 |
|
|
# -- Some error trapping and debug targets
|
157 |
|
|
#
|
158 |
|
|
|
159 |
|
|
dummy:
|
160 |
|
|
|
161 |
|
|
|
162 |
williamc |
1.18 |
.PHONY: help clean
|
163 |
|
|
help::
|
164 |
|
|
@echo "--------------------------------------------------------"
|
165 |
|
|
ifndef BINMODE
|
166 |
|
|
help::
|
167 |
|
|
@echo "General Targets"
|
168 |
|
|
@echo "---------------"
|
169 |
|
|
@echo "clean - clean out the corresponding working directory"
|
170 |
|
|
@echo "echo_VAR - debugging only, prints out the value of the scram variable VAR"
|
171 |
williamc |
1.1 |
@echo "-----------------"
|
172 |
williamc |
1.18 |
endif
|
173 |
williamc |
1.1 |
|
174 |
|
|
exit:
|
175 |
williamc |
1.18 |
@echo "Please Use Scram. Do not use gmake directly."
|
176 |
williamc |
1.1 |
@exit 1
|
177 |
|
|
|
178 |
|
|
echo_%:
|
179 |
|
|
@echo "$(subst echo_,,$@) = $($(subst echo_,,$@))"
|
180 |
|
|
|
181 |
williamc |
1.18 |
|
182 |
|
|
#
|
183 |
|
|
# Other non-critical targets
|
184 |
|
|
#
|
185 |
|
|
|
186 |
|
|
TAGS:
|
187 |
|
|
etags -o TAGS $(files) $(binfiles)
|
188 |
|
|
|
189 |
|
|
tags:
|
190 |
|
|
ctags -o tags $(files) $(binfiles)
|
191 |
|
|
|
192 |
|
|
#
|
193 |
williamc |
1.1 |
#
|
194 |
|
|
# clean targets
|
195 |
|
|
#
|
196 |
|
|
|
197 |
|
|
# make sure the variables will be set before rm -r by ensuring that
|
198 |
|
|
# it has come through the wrapper script
|
199 |
|
|
|
200 |
|
|
ifdef DefaultMakefile
|
201 |
williamc |
1.10 |
clean::
|
202 |
williamc |
1.1 |
@echo Cleaning working folder $(workdir)
|
203 |
williamc |
1.18 |
ifdef LOCALTOP
|
204 |
|
|
ifdef workdir
|
205 |
|
|
@rm -rf $(LOCALTOP)/$(workdir)/*
|
206 |
|
|
endif
|
207 |
|
|
endif
|
208 |
williamc |
1.1 |
|
209 |
|
|
very_clean:
|
210 |
|
|
@echo Cleaning all working folders in $(INTwork)
|
211 |
|
|
@cd $(LOCALTOP)/$(INTwork)
|
212 |
williamc |
1.18 |
ifdef LOCALTOP
|
213 |
|
|
ifdef workdir
|
214 |
|
|
@rm -rf $(LOCALTOP)/$(INTwork)/*
|
215 |
|
|
endif
|
216 |
williamc |
1.1 |
endif
|
217 |
williamc |
1.18 |
endif
|
218 |
williamc |
1.21 |
|
219 |
|
|
#
|
220 |
|
|
# datestamp files
|
221 |
|
|
#
|
222 |
sashby |
1.26 |
.PHONY: datestamp_config datestamp python
|
223 |
williamc |
1.21 |
|
224 |
|
|
scramds_%::
|
225 |
williamc |
1.22 |
@$(SCRAMPERL) $(SCRAM_HOME)/src/scramds $*.ds
|
226 |
williamc |
1.21 |
|
227 |
|
|
#
|
228 |
|
|
# rather than tracing all the dependency root - just check all local .ds files
|
229 |
|
|
#
|
230 |
|
|
dsfiles=$(wildcard *.ds)
|
231 |
|
|
releasedsfiles=$(wildcard $(RELEASETOP)/$(workdir)/*.ds)
|
232 |
|
|
|
233 |
|
|
datestamp_config:
|
234 |
|
|
@if [ "$(dsfiles)" = "" ]; then \
|
235 |
|
|
if [ "$(releasedsfiles)" != "" ]; then \
|
236 |
|
|
cp $(releasedsfiles) $(LOCALTOP)/$(workdir); \
|
237 |
|
|
fi; \
|
238 |
|
|
fi
|
239 |
|
|
|
240 |
|
|
datestamp: $(addprefix scramds_, $(basename $(dsfiles)))
|
241 |
sashby |
1.25 |
|
242 |
sashby |
1.26 |
#
|
243 |
|
|
python: $(PYDIRS)
|
244 |
|
|
ifdef PYDIRS
|
245 |
|
|
$(PYDIRS)::
|
246 |
|
|
@echo "---- Building Python ----"
|
247 |
|
|
@echo "-> Dir: " $@
|
248 |
|
|
@echo
|
249 |
|
|
@if [ -d $@ ]; then \
|
250 |
|
|
cd $@; \
|
251 |
sashby |
1.27 |
$(MAKE) -ef $(TOOL_HOME)/Py-main.mk all; \
|
252 |
sashby |
1.26 |
else echo SCRAM Warning : $@ does not exist; \
|
253 |
|
|
fi
|
254 |
|
|
endif
|
255 |
sashby |
1.25 |
|
256 |
|
|
|
257 |
sashby |
1.26 |
root:
|
258 |
|
|
@echo
|
259 |
|
|
@echo "---- Root not yet integrated into SCRAM ----"
|
260 |
|
|
@echo
|