ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/basics.mk
Revision: 1.42
Committed: Fri Nov 8 16:29:51 2002 UTC (22 years, 6 months ago) by sashby
Branch: MAIN
Changes since 1.41: +21 -19 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 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 #
26     # Generic scram build target
27     #
28     scrambuild_% :
29     @dir=$(subst scrambuild_,,$@); \
30     if [ -d $(LOCALTOP)/$(INTsrc)/$$dir ]; then \
31     echo "------- Building ---- $$dir -----------"; \
32 sashby 1.24 cd $(LOCALTOP)/$(INTsrc)/$$dir; $(SCRAM) build; \
33 williamc 1.18 fi
34 sashby 1.42 #============================================================================================
35     #
36     # Info on the files that are "include"d in basics.mk.
37     # This is the order:
38     #
39     # include ${LatestBuildFile} ---- The makefile stub produced from BuildFile at
40     # \ current position in src tree, starting with
41     # \ config/BuildFile.
42     # \
43     # + - include compilers.mk (and other "*.mk" from project config)
44     #
45     #
46     # include ${DefaultBuildFile} ---- Ensures that makefile was invoked via scram.
47     # include $(SCRAM_GROUPSDIR) ---- Some group stuff.
48     # include ${TOOL_HOME}/compilers.mk ---- Stuff for Insure.
49     # include $(clientmakefile) ---- All tool-related flags and switches.
50     # include ${TOOL_HOME}/toolrules.mk ---- The basic rules.
51     # include dependencies.mk ---- The dependencies.
52 williamc 1.21 #
53 sashby 1.42 #============================================================================================
54 williamc 1.21 #
55     ifdef LatestBuildFile
56     include ${LatestBuildFile}
57     endif
58     #
59     # get build requirements Class
60     #
61     ifdef DefaultBuildFile
62     include ${DefaultBuildFile}
63     endif
64 sashby 1.42 #
65 williamc 1.14 # -- storage of libraries
66 sashby 1.42 #
67 williamc 1.21 librarystore:=$(SCRAMSTORE_lib)
68 sashby 1.32 debuglibrarystore:=$(librarystore)/debug
69 sashby 1.35 insurelibrarystore:=$(librarystore)/insure
70     archivelibrarystore:=$(librarystore)/archive
71 sashby 1.36 archiveinsurelibrarystore:=$(archivelibrarystore)/insure
72     archivedebuglibrarystore:=$(archivelibrarystore)/debug
73    
74 williamc 1.20 INTlib:=$(SCRAMSTORENAME_lib)
75 williamc 1.14 libsavaillocal=$(notdir $(wildcard $(librarystore)/*))
76     libsavailbase=$(notdir $(wildcard $(RELEASETOP)/$(INTlib)/*))
77     libsavail=$(sort $(libsavailbase) $(libsavaillocal))
78     libslocal=$(foreach var,$(lib),$(filter lib$(var).a, $(libsavail)))
79     libslocal_I=$(foreach var,$(lib_I),$(filter lib$(var).a, $(libsavail)))
80     libslocal_d=$(foreach var,$(lib_d),$(filter lib$(var).a, $(libsavail)))
81 williamc 1.1 #
82     # Pointing to file storage locations for the various types
83     #
84     # -- src code and unspecified types
85     VPATH:=$(LOCALTOP)/$(ClassDir):$(RELEASETOP)/$(ClassDir)
86     # -- .o files will be kept in the working directory
87 sashby 1.40 vpath %.o $(LOCALTOP)/$(workdir) $(RELEASETOP)/$(workdir)
88 williamc 1.1 #
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 williamc 1.9 #
95 williamc 1.18 # Group Settings
96     #
97     ifdef SCRAM_GROUPSDIR
98     -include $(SCRAM_GROUPSDIR)
99     endif
100    
101 williamc 1.21 # -- compilers.mk - to be removed when contents of compiler.mk expunged
102     include ${TOOL_HOME}/compilers.mk
103    
104 sashby 1.26 #
105 williamc 1.9 # Site settings
106     #
107 sashby 1.37 #
108     # Add our includepath (before filtering, just in case we didn't declare it earlier):
109     #
110     INCLUDEPATH+=-I$(LOCALTOP)/${INTsrc} -I$(RELEASETOP)/${INTsrc}
111     # Include the clientmakefile (this is where both LIB and INCLUDE are filtered):
112 williamc 1.9 clientmakefile=$(LOCALTOP)/$(INTwork)/clientmakefile
113 sashby 1.39 # This is also where the compiler makefiles are included (eg gcc-XX.X.mk):
114 williamc 1.17 -include $(clientmakefile)
115 williamc 1.1
116     #
117     # get build targets
118     #
119     include ${TOOL_HOME}/toolrules.mk
120    
121     #
122     # -- Some tool setups which dont yet have a home
123     #
124 williamc 1.18 CPPFLAGS += $(addprefix -I,$(PRIORITY_INCLUDE)) $(INCLUDEPATH)
125 williamc 1.1
126    
127 williamc 1.5 #
128     # Dependency information
129     #
130 williamc 1.9 -include dependencies.mk
131 williamc 1.5
132 williamc 1.1 #
133     # Process Subdirs
134     #
135     ifdef SUBDIRS
136 williamc 1.12 $(SUBDIRS)::
137 williamc 1.1 @echo ------- Building ---- $@ -----------
138 williamc 1.18 @if [ -d $(LOCALTOP)/$(ClassDir)/$@ ]; then \
139 sashby 1.24 cd $(LOCALTOP)/$(ClassDir)/$@; $(SCRAM) build; \
140 williamc 1.18 else echo SCRAM Warning : $@ does not exist; \
141     fi
142 williamc 1.1 endif
143    
144     #
145     # -- Some error trapping and debug targets
146     #
147    
148     dummy:
149    
150    
151 williamc 1.18 .PHONY: help clean
152     help::
153     @echo "--------------------------------------------------------"
154     ifndef BINMODE
155     help::
156     @echo "General Targets"
157     @echo "---------------"
158     @echo "clean - clean out the corresponding working directory"
159     @echo "echo_VAR - debugging only, prints out the value of the scram variable VAR"
160 williamc 1.1 @echo "-----------------"
161 williamc 1.18 endif
162 williamc 1.1
163     exit:
164 williamc 1.18 @echo "Please Use Scram. Do not use gmake directly."
165 williamc 1.1 @exit 1
166    
167     echo_%:
168     @echo "$(subst echo_,,$@) = $($(subst echo_,,$@))"
169    
170 williamc 1.18
171     #
172     # Other non-critical targets
173     #
174    
175     TAGS:
176     etags -o TAGS $(files) $(binfiles)
177    
178     tags:
179     ctags -o tags $(files) $(binfiles)
180    
181     #
182 williamc 1.1 #
183     # clean targets
184     #
185    
186     # make sure the variables will be set before rm -r by ensuring that
187     # it has come through the wrapper script
188    
189     ifdef DefaultMakefile
190 williamc 1.10 clean::
191 williamc 1.1 @echo Cleaning working folder $(workdir)
192 williamc 1.18 ifdef LOCALTOP
193     ifdef workdir
194     @rm -rf $(LOCALTOP)/$(workdir)/*
195     endif
196     endif
197 williamc 1.1
198     very_clean:
199     @echo Cleaning all working folders in $(INTwork)
200     @cd $(LOCALTOP)/$(INTwork)
201 williamc 1.18 ifdef LOCALTOP
202     ifdef workdir
203     @rm -rf $(LOCALTOP)/$(INTwork)/*
204     endif
205 williamc 1.1 endif
206 williamc 1.18 endif
207 williamc 1.21
208     #
209     # datestamp files
210     #
211 sashby 1.37 .PHONY: datestamp_config datestamp
212 williamc 1.21
213     scramds_%::
214 williamc 1.22 @$(SCRAMPERL) $(SCRAM_HOME)/src/scramds $*.ds
215 williamc 1.21
216     #
217     # rather than tracing all the dependency root - just check all local .ds files
218     #
219     dsfiles=$(wildcard *.ds)
220     releasedsfiles=$(wildcard $(RELEASETOP)/$(workdir)/*.ds)
221    
222     datestamp_config:
223     @if [ "$(dsfiles)" = "" ]; then \
224     if [ "$(releasedsfiles)" != "" ]; then \
225     cp $(releasedsfiles) $(LOCALTOP)/$(workdir); \
226     fi; \
227     fi
228    
229     datestamp: $(addprefix scramds_, $(basename $(dsfiles)))
230 sashby 1.26 #
231 sashby 1.38 # End of basics.mk
232 sashby 1.37 #