ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/basics.mk
Revision: 1.21
Committed: Wed Nov 15 10:33:12 2000 UTC (24 years, 6 months ago) by williamc
Branch: MAIN
Changes since 1.20: +50 -15 lines
Log Message:
Import from V0_18_0

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