ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/basics.mk
Revision: 1.37
Committed: Thu Aug 8 10:57:56 2002 UTC (22 years, 9 months ago) by sashby
Branch: MAIN
Changes since 1.36: +12 -38 lines
Log Message:
Added INCLUDE path filtering.

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