ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/basics.mk
Revision: 1.24
Committed: Fri Nov 9 16:49:45 2001 UTC (23 years, 6 months ago) by sashby
Branch: MAIN
Changes since 1.23: +5 -4 lines
Log Message:
Some changes to basics.mk

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     SCRAM=`which scram`
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
28     # Quiet setting for <Build> tags
29     QUIET = no
30     ifeq ($(QUIET),yes)
31     _quietbuild_ = @echo "Creating $<...";
32     _quietstamp_ = @
33     else
34     _quietbuild_ =
35     _quietstamp_ = @
36     endif
37    
38     #
39     # Generic scram build target
40     #
41     scrambuild_% :
42     @dir=$(subst scrambuild_,,$@); \
43     if [ -d $(LOCALTOP)/$(INTsrc)/$$dir ]; then \
44     echo "------- Building ---- $$dir -----------"; \
45 sashby 1.24 cd $(LOCALTOP)/$(INTsrc)/$$dir; $(SCRAM) build; \
46 williamc 1.18 fi
47    
48 williamc 1.21 #
49     # Get local mods
50     #
51     ifdef LatestBuildFile
52     include ${LatestBuildFile}
53     endif
54    
55     #
56     # get build requirements Class
57     #
58     ifdef DefaultBuildFile
59     include ${DefaultBuildFile}
60     endif
61 williamc 1.18
62 williamc 1.14 # -- storage of libraries
63 williamc 1.21 librarystore:=$(SCRAMSTORE_lib)
64 williamc 1.20 INTlib:=$(SCRAMSTORENAME_lib)
65 williamc 1.15
66 williamc 1.14 libsavaillocal=$(notdir $(wildcard $(librarystore)/*))
67     libsavailbase=$(notdir $(wildcard $(RELEASETOP)/$(INTlib)/*))
68     libsavail=$(sort $(libsavailbase) $(libsavaillocal))
69     libslocal=$(foreach var,$(lib),$(filter lib$(var).a, $(libsavail)))
70     libslocal_I=$(foreach var,$(lib_I),$(filter lib$(var).a, $(libsavail)))
71     libslocal_d=$(foreach var,$(lib_d),$(filter lib$(var).a, $(libsavail)))
72 williamc 1.1
73     #
74     # Pointing to file storage locations for the various types
75     #
76     # -- src code and unspecified types
77     VPATH:=$(LOCALTOP)/$(ClassDir):$(RELEASETOP)/$(ClassDir)
78     # -- .o files will be kept in the working directory
79     vpath %.o $(LOCALTOP)/$(workdir):$(RELEASETOP)/$(workdir)
80    
81     #
82     ifdef ReqDependencies
83     always:$(LOCALTOP)/$(workdir)/PackageReqs
84 williamc 1.11 $(LOCALTOP)/$(workdir)/PackageReqs:$(ReqDependencies)
85 williamc 1.18 $(SCRAMPERL) $(TOOL_HOME)/BuildPackageReqs $@ $?
86 williamc 1.1 endif
87    
88 williamc 1.18
89 williamc 1.1
90 williamc 1.9 #
91 williamc 1.18 # Group Settings
92     #
93     ifdef SCRAM_GROUPSDIR
94     -include $(SCRAM_GROUPSDIR)
95     endif
96    
97 williamc 1.21 # -- compilers.mk - to be removed when contents of compiler.mk expunged
98     include ${TOOL_HOME}/compilers.mk
99    
100 sashby 1.23 # -- Try adding SWIG stuff for tests
101 sashby 1.24 #include ${TOOL_HOME}/SWIG.mk
102 sashby 1.23
103 williamc 1.9 # Site settings
104     #
105     clientmakefile=$(LOCALTOP)/$(INTwork)/clientmakefile
106 williamc 1.17 -include $(clientmakefile)
107 williamc 1.1
108     #
109     # get build targets
110     #
111     include ${TOOL_HOME}/toolrules.mk
112    
113 williamc 1.9
114 williamc 1.1 #
115     # -- Some tool setups which dont yet have a home
116     #
117 williamc 1.18 CPPFLAGS += $(addprefix -I,$(PRIORITY_INCLUDE)) $(INCLUDEPATH)
118 williamc 1.1
119    
120     #
121     # now add our includepath
122     #
123     INCLUDEPATH+=-I$(LOCALTOP)/${INTsrc} -I$(RELEASETOP)/${INTsrc}
124    
125 williamc 1.5 #
126     # Dependency information
127     #
128 williamc 1.9 -include dependencies.mk
129 williamc 1.5
130 williamc 1.18 #dependencies.mk :: $(clientmakefile)
131 williamc 1.1 #
132     # Process Subdirs
133     #
134     ifdef SUBDIRS
135 williamc 1.12 $(SUBDIRS)::
136 williamc 1.1 @echo ------- Building ---- $@ -----------
137 williamc 1.18 @if [ -d $(LOCALTOP)/$(ClassDir)/$@ ]; then \
138 sashby 1.24 cd $(LOCALTOP)/$(ClassDir)/$@; $(SCRAM) build; \
139 williamc 1.18 else echo SCRAM Warning : $@ does not exist; \
140     fi
141 williamc 1.1 endif
142    
143    
144 williamc 1.18 #HELPINCLUDEMAKEFILES := ${DefaultBuildFile} ${TOOL_HOME}/toolrules.mk
145 williamc 1.1
146     #
147     #
148     # -- Some error trapping and debug targets
149     #
150    
151     dummy:
152    
153    
154 williamc 1.18 .PHONY: help clean
155     help::
156     @echo "--------------------------------------------------------"
157     ifndef BINMODE
158     help::
159     @echo "General Targets"
160     @echo "---------------"
161     @echo "clean - clean out the corresponding working directory"
162     @echo "echo_VAR - debugging only, prints out the value of the scram variable VAR"
163 williamc 1.1 @echo "-----------------"
164 williamc 1.18 endif
165 williamc 1.1
166     exit:
167 williamc 1.18 @echo "Please Use Scram. Do not use gmake directly."
168 williamc 1.1 @exit 1
169    
170     echo_%:
171     @echo "$(subst echo_,,$@) = $($(subst echo_,,$@))"
172    
173 williamc 1.18
174     #
175     # Other non-critical targets
176     #
177    
178     TAGS:
179     etags -o TAGS $(files) $(binfiles)
180    
181     tags:
182     ctags -o tags $(files) $(binfiles)
183    
184     #
185 williamc 1.1 #
186     # clean targets
187     #
188    
189     # make sure the variables will be set before rm -r by ensuring that
190     # it has come through the wrapper script
191    
192     ifdef DefaultMakefile
193 williamc 1.10 clean::
194 williamc 1.1 @echo Cleaning working folder $(workdir)
195 williamc 1.18 ifdef LOCALTOP
196     ifdef workdir
197     @rm -rf $(LOCALTOP)/$(workdir)/*
198     endif
199     endif
200 williamc 1.1
201     very_clean:
202     @echo Cleaning all working folders in $(INTwork)
203     @cd $(LOCALTOP)/$(INTwork)
204 williamc 1.18 ifdef LOCALTOP
205     ifdef workdir
206     @rm -rf $(LOCALTOP)/$(INTwork)/*
207     endif
208 williamc 1.1 endif
209 williamc 1.18 endif
210 williamc 1.21
211     #
212     # datestamp files
213     #
214     .PHONY: datestamp_config datestamp
215    
216     scramds_%::
217 williamc 1.22 @$(SCRAMPERL) $(SCRAM_HOME)/src/scramds $*.ds
218 williamc 1.21
219     #
220     # rather than tracing all the dependency root - just check all local .ds files
221     #
222     dsfiles=$(wildcard *.ds)
223     releasedsfiles=$(wildcard $(RELEASETOP)/$(workdir)/*.ds)
224    
225     datestamp_config:
226     @if [ "$(dsfiles)" = "" ]; then \
227     if [ "$(releasedsfiles)" != "" ]; then \
228     cp $(releasedsfiles) $(LOCALTOP)/$(workdir); \
229     fi; \
230     fi
231    
232     datestamp: $(addprefix scramds_, $(basename $(dsfiles)))