ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/basics.mk
Revision: 1.28
Committed: Mon Feb 25 18:17:49 2002 UTC (23 years, 2 months ago) by sashby
Branch: MAIN
Changes since 1.27: +6 -0 lines
Log Message:
*** empty log message ***

File Contents

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