ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/toolrules.mk
Revision: 1.19
Committed: Thu Apr 8 12:55:49 1999 UTC (26 years, 1 month ago) by williamc
Branch: MAIN
CVS Tags: ProtoEnd, V0_8
Branch point for: V0_9branch
Changes since 1.18: +2 -1 lines
Log Message:
Fix clean targets and make bin name default to the debug version

File Contents

# User Rev Content
1 williamc 1.1 # Some Pre-Defined Rules For Building Stuff
2     #
3 williamc 1.16 .PHONY:bin lib
4 williamc 1.2 lib : dependencies.mk
5     bin : dependencies.mk
6 williamc 1.1
7     #------------------------------------------------
8     # Default Behaviours - interpreted from makefile
9     #------------------------------------------------
10 williamc 1.18 # -- Set the library vapths
11     vpath %.$(SharedSuffix) $(librarystore):$(RELEASETOP)/$(INTlib)
12     vpath %.$(ArchiveSuffix) $(librarystore):$(RELEASETOP)/$(INTlib)
13 williamc 1.6 # -- storage of binaries
14     binarystore:=$(LOCALTOP)/$(INTbin)
15     VPATH+=:$(LOCALTOP)/$(INTbin):$(RELEASETOP)/$(INTbin)
16 williamc 1.1
17     # -- library names
18    
19     ifdef libname
20     ifndef arlibname
21     arlibname=$(libname)
22     endif
23     ifndef shlibname
24     shlibname=$(libname)
25     endif
26     endif
27    
28     # -- Libray type defaults
29    
30     ifdef DefaultShared
31     lib : $(shlibname).$(SharedSuffix)
32     MakeLib=yes
33     endif
34     ifdef DefaultDebugShared
35     lib : $(shlibname)_d.$(SharedSuffix)
36     MakeLib=yes
37     endif
38 williamc 1.12 ifdef DefaultInsureShared
39     lib : $(shlibname)_Insure.$(SharedSuffix)
40     MakeLib=yes
41     endif
42 williamc 1.1 ifdef DefaultArchive
43     lib : $(arlibname).$(ArchiveSuffix)
44     MakeLib=yes
45     endif
46     ifdef DefaultDebugArchive
47     lib : $(arlibname)_d.$(ArchiveSuffix)
48     MakeLib=yes
49     endif
50 williamc 1.12 ifdef DefaultInsureArchive
51     lib : $(arlibname)_Insure.$(ArchiveSuffix)
52     MakeLib=yes
53     endif
54 williamc 1.1
55     ifdef MakeLib
56     all: lib
57     endif
58    
59     #------------------------------------------------
60     # Set up some system variables
61     # - all begin with S
62     #------------------------------------------------
63    
64     Sarchivelibobjs:=$(addsuffix .o,$(archivefiles))
65     Sarchivelibdebugobjs:=$(addsuffix _d.o,$(archivefiles))
66     Ssharedlibobjs:=$(addsuffix _pic.o,$(sharedfiles))
67     Ssharedlibdebugobjs:=$(addsuffix _picd.o,$(sharedfiles))
68 williamc 1.12 SsharedlibInsureobjs:=$(addsuffix _picInsure.o,$(sharedfiles))
69     SarchivelibInsureobjs:=$(addsuffix _Insure.o,$(archivefiles))
70 williamc 1.7
71 williamc 1.1 #------------------------------------------------
72     # Rules Start Here
73     #------------------------------------------------
74    
75     # Implicit Rules first
76     # -- Standard Shared Objects
77     %_pic.o : %.cpp
78     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
79     %_pic.o : %.C
80     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
81     %_pic.o : %.cc
82     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
83     %_pic.o : %.F
84     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
85     %_pic.o : %.f
86     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
87    
88     # -- Debug Shared Objects
89     %_picd.o : %.cc
90     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
91    
92     %_picd.o : %.C
93     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
94    
95     %_picd.o : %.cpp
96     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
97    
98     %_picd.o : %.F
99     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
100    
101     %_picd.o : %.f
102     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
103 williamc 1.12
104     # -- Debug Shared Objects with Insure
105     %_picInsure.o : %.cc
106     $(Insure) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
107    
108     %_picInsure.o : %.C
109     $(Insure) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
110    
111     %_picInsure.o : %.cpp
112     $(Insure) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
113    
114 williamc 1.1
115     # -- Debug Archive Libs
116     %_d.o : %.cpp
117     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
118    
119     %_d.o : %.cc
120     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
121    
122     %_d.o : %.C
123     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
124    
125     %_d.o : %.F
126     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
127    
128     %_d.o : %.f
129     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
130 williamc 1.6
131 williamc 1.12 # -- Debug Archive Libs with Insure
132     %_Insure.o : %.cpp
133     $(Insure) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
134    
135     %_Insure.o : %.cc
136     $(Insure) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
137    
138     %_Insure.o : %.C
139     $(Insure) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
140    
141     # -- Standard Archive Libs
142 williamc 1.15 %.o : %.cpp
143     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
144    
145     %.o : %.cc
146     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
147    
148     %.o : %.C
149     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
150    
151     %.o : %.F
152     $(FC) -c $(CPPFLAGS) $(FFLAGS) $< -o $@
153    
154     %.o : %.f
155     $(FC) -c $(CPPFLAGS) $(FFLAGS) $< -o $@
156    
157 williamc 1.12 # Already built in
158    
159     # -------------------------------------------------------------------------
160     # Executables
161 williamc 1.7 # -------------------------------------------------------------------------
162 williamc 1.6
163 williamc 1.12 # -- Debug Executables
164 williamc 1.6
165 williamc 1.12 lib_d=$(shell $(TOOL_HOME)/LibTypeExpand "_d" $(lib))
166 williamc 1.10 LDLIBS_D=$(addprefix -l,$(lib_d))
167    
168 williamc 1.15 #%_d.exe :
169     # $(CXX) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ $(LDLIBS_D)
170 williamc 1.11
171 williamc 1.12 # -- Insure Executables
172     lib_Insure=$(shell $(TOOL_HOME)/LibTypeExpand "_Insure" $(lib))
173     LDLIBS_I=$(addprefix -l,$(lib_Insure))
174 williamc 1.15 #%_Insure.exe :
175     # $(Insure) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ $(LDLIBS_D)
176 williamc 1.12
177 williamc 1.11 # -- Executables
178 williamc 1.15 #%.exe :
179     # $(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
180 williamc 1.6
181 williamc 1.12 # -------------------------------------------------------------------------
182    
183 williamc 1.7 realbins:=$(filter $(bintargets),$(notdir $(wildcard $(LOCALTOP)/$(INTbin)/*)))
184 williamc 1.19 frealbins=$(addprefix $(LOCALTOP)/$(INTbin)/,$(realbins))
185 williamc 1.7 clean ::
186     @if [ "$(realbins)" != "" ] ; then \
187     echo Removing executables : $(realbins); \
188 williamc 1.19 rm $(frealbins); \
189 williamc 1.7 fi;
190 williamc 1.6
191 williamc 1.7 # -------------------------------------------------------------------------
192 williamc 1.1
193     # Some nice generic target names for the user
194    
195     shared : $(shlibname).$(SharedSuffix)
196     shared_debug : $(shlibname)_d.$(SharedSuffix)
197     archive : $(arlibname).$(ArchiveSuffix)
198     archive_debug : $(arlibname)_d.$(ArchiveSuffix)
199    
200     # Now more specific rules
201    
202     # -- Standard Shared Objects Libs
203 williamc 1.3 $(shlibname)_pic.$(SharedSuffix) : $(Ssharedlibobjs)
204 williamc 1.1 $(SharedCCTool)
205 williamc 1.3
206     $(shlibname).$(SharedSuffix) : $(shlibname)_pic.$(SharedSuffix)
207     @mv $< $(librarystore)/$@
208 williamc 1.1
209     # -- Debug Shared Objects Libs
210 williamc 1.3 $(shlibname)_picd.$(SharedSuffix) : $(Ssharedlibdebugobjs)
211 williamc 1.1 $(SharedCCTool)
212 williamc 1.3
213 williamc 1.4 $(shlibname)_d.$(SharedSuffix) : $(Ssharedlibdebugobjs)
214 williamc 1.3 @mv $< $(librarystore)/$@
215 williamc 1.1
216 williamc 1.12 # -- Insure Shared Objects Libs
217     $(shlibname)_picInsure.$(SharedSuffix) : $(SsharedlibInsureobjs)
218     $(SharedCCTool)
219    
220     $(shlibname)_Insure.$(SharedSuffix) : $(SsharedlibInsureobjs)
221     @mv $< $(librarystore)/$@
222    
223 williamc 1.1 # -- Standard Archive Libs
224     $(arlibname).$(ArchiveSuffix) : $(Sarchivelibobjs)
225     $(ArchiveCCTool)
226 williamc 1.8 @mv $@ $(librarystore)/$@
227 williamc 1.1
228     # -- Debug Archive Libs
229     $(arlibname)_d.$(ArchiveSuffix) : $(Sarchivelibdebugobjs)
230 williamc 1.12 $(ArchiveCCTool)
231     @mv $@ $(librarystore)/$@
232    
233     # -- Insure Archive libs
234     $(arlibname)_Insure.$(ArchiveSuffix) : $(SarchivelibInsureobjs)
235 williamc 1.1 $(ArchiveCCTool)
236 williamc 1.7 @mv $@ $(librarystore)/$@
237 williamc 1.2
238     # -- Dependencies
239     dependencies.mk: $(files)
240 williamc 1.14 @$(DependencyCCTool)
241     @$(TOOL_HOME)/DependencyMangler $@
242    
243     %.dep:
244 williamc 1.2 @$(DependencyCCTool)
245     @$(TOOL_HOME)/DependencyMangler $@
246 williamc 1.17