ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/basics.mk
Revision: 1.40
Committed: Tue Sep 17 12:46:30 2002 UTC (22 years, 8 months ago) by sashby
Branch: MAIN
Changes since 1.39: +1 -1 lines
Log Message:
Changes to VPATH and vpath directives in toolrules.mk/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 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 sashby 1.40 vpath %.o $(LOCALTOP)/$(workdir) $(RELEASETOP)/$(workdir)
82 williamc 1.1
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 sashby 1.39 # This is also where the compiler makefiles are included (eg gcc-XX.X.mk):
111 williamc 1.17 -include $(clientmakefile)
112 williamc 1.1
113     #
114     # get build targets
115     #
116     include ${TOOL_HOME}/toolrules.mk
117    
118     #
119     # -- Some tool setups which dont yet have a home
120     #
121 williamc 1.18 CPPFLAGS += $(addprefix -I,$(PRIORITY_INCLUDE)) $(INCLUDEPATH)
122 williamc 1.1
123    
124 williamc 1.5 #
125     # Dependency information
126     #
127 williamc 1.9 -include dependencies.mk
128 williamc 1.5
129 williamc 1.1 #
130     # Process Subdirs
131     #
132     ifdef SUBDIRS
133 williamc 1.12 $(SUBDIRS)::
134 williamc 1.1 @echo ------- Building ---- $@ -----------
135 williamc 1.18 @if [ -d $(LOCALTOP)/$(ClassDir)/$@ ]; then \
136 sashby 1.24 cd $(LOCALTOP)/$(ClassDir)/$@; $(SCRAM) build; \
137 williamc 1.18 else echo SCRAM Warning : $@ does not exist; \
138     fi
139 williamc 1.1 endif
140    
141     #
142     # -- Some error trapping and debug targets
143     #
144    
145     dummy:
146    
147    
148 williamc 1.18 .PHONY: help clean
149     help::
150     @echo "--------------------------------------------------------"
151     ifndef BINMODE
152     help::
153     @echo "General Targets"
154     @echo "---------------"
155     @echo "clean - clean out the corresponding working directory"
156     @echo "echo_VAR - debugging only, prints out the value of the scram variable VAR"
157 williamc 1.1 @echo "-----------------"
158 williamc 1.18 endif
159 williamc 1.1
160     exit:
161 williamc 1.18 @echo "Please Use Scram. Do not use gmake directly."
162 williamc 1.1 @exit 1
163    
164     echo_%:
165     @echo "$(subst echo_,,$@) = $($(subst echo_,,$@))"
166    
167 williamc 1.18
168     #
169     # Other non-critical targets
170     #
171    
172     TAGS:
173     etags -o TAGS $(files) $(binfiles)
174    
175     tags:
176     ctags -o tags $(files) $(binfiles)
177    
178     #
179 williamc 1.1 #
180     # clean targets
181     #
182    
183     # make sure the variables will be set before rm -r by ensuring that
184     # it has come through the wrapper script
185    
186     ifdef DefaultMakefile
187 williamc 1.10 clean::
188 williamc 1.1 @echo Cleaning working folder $(workdir)
189 williamc 1.18 ifdef LOCALTOP
190     ifdef workdir
191     @rm -rf $(LOCALTOP)/$(workdir)/*
192     endif
193     endif
194 williamc 1.1
195     very_clean:
196     @echo Cleaning all working folders in $(INTwork)
197     @cd $(LOCALTOP)/$(INTwork)
198 williamc 1.18 ifdef LOCALTOP
199     ifdef workdir
200     @rm -rf $(LOCALTOP)/$(INTwork)/*
201     endif
202 williamc 1.1 endif
203 williamc 1.18 endif
204 williamc 1.21
205     #
206     # datestamp files
207     #
208 sashby 1.37 .PHONY: datestamp_config datestamp
209 williamc 1.21
210     scramds_%::
211 williamc 1.22 @$(SCRAMPERL) $(SCRAM_HOME)/src/scramds $*.ds
212 williamc 1.21
213     #
214     # rather than tracing all the dependency root - just check all local .ds files
215     #
216     dsfiles=$(wildcard *.ds)
217     releasedsfiles=$(wildcard $(RELEASETOP)/$(workdir)/*.ds)
218    
219     datestamp_config:
220     @if [ "$(dsfiles)" = "" ]; then \
221     if [ "$(releasedsfiles)" != "" ]; then \
222     cp $(releasedsfiles) $(LOCALTOP)/$(workdir); \
223     fi; \
224     fi
225    
226     datestamp: $(addprefix scramds_, $(basename $(dsfiles)))
227 sashby 1.25
228 sashby 1.26 #
229 sashby 1.38 # End of basics.mk
230 sashby 1.37 #