ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/toolrules.mk
Revision: 1.18
Committed: Tue Apr 6 07:50:31 1999 UTC (26 years, 1 month ago) by williamc
Branch: MAIN
CVS Tags: V0_7
Changes since 1.17: +3 -0 lines
Log Message:
Get library dependencies working

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     clean ::
185     @if [ "$(realbins)" != "" ] ; then \
186     echo Removing executables : $(realbins); \
187     rm $(LOCALTOP)/$(INTbin)/$(realbins); \
188     fi;
189 williamc 1.6
190 williamc 1.7 # -------------------------------------------------------------------------
191 williamc 1.1
192     # Some nice generic target names for the user
193    
194     shared : $(shlibname).$(SharedSuffix)
195     shared_debug : $(shlibname)_d.$(SharedSuffix)
196     archive : $(arlibname).$(ArchiveSuffix)
197     archive_debug : $(arlibname)_d.$(ArchiveSuffix)
198    
199     # Now more specific rules
200    
201     # -- Standard Shared Objects Libs
202 williamc 1.3 $(shlibname)_pic.$(SharedSuffix) : $(Ssharedlibobjs)
203 williamc 1.1 $(SharedCCTool)
204 williamc 1.3
205     $(shlibname).$(SharedSuffix) : $(shlibname)_pic.$(SharedSuffix)
206     @mv $< $(librarystore)/$@
207 williamc 1.1
208     # -- Debug Shared Objects Libs
209 williamc 1.3 $(shlibname)_picd.$(SharedSuffix) : $(Ssharedlibdebugobjs)
210 williamc 1.1 $(SharedCCTool)
211 williamc 1.3
212 williamc 1.4 $(shlibname)_d.$(SharedSuffix) : $(Ssharedlibdebugobjs)
213 williamc 1.3 @mv $< $(librarystore)/$@
214 williamc 1.1
215 williamc 1.12 # -- Insure Shared Objects Libs
216     $(shlibname)_picInsure.$(SharedSuffix) : $(SsharedlibInsureobjs)
217     $(SharedCCTool)
218    
219     $(shlibname)_Insure.$(SharedSuffix) : $(SsharedlibInsureobjs)
220     @mv $< $(librarystore)/$@
221    
222 williamc 1.1 # -- Standard Archive Libs
223     $(arlibname).$(ArchiveSuffix) : $(Sarchivelibobjs)
224     $(ArchiveCCTool)
225 williamc 1.8 @mv $@ $(librarystore)/$@
226 williamc 1.1
227     # -- Debug Archive Libs
228     $(arlibname)_d.$(ArchiveSuffix) : $(Sarchivelibdebugobjs)
229 williamc 1.12 $(ArchiveCCTool)
230     @mv $@ $(librarystore)/$@
231    
232     # -- Insure Archive libs
233     $(arlibname)_Insure.$(ArchiveSuffix) : $(SarchivelibInsureobjs)
234 williamc 1.1 $(ArchiveCCTool)
235 williamc 1.7 @mv $@ $(librarystore)/$@
236 williamc 1.2
237     # -- Dependencies
238     dependencies.mk: $(files)
239 williamc 1.14 @$(DependencyCCTool)
240     @$(TOOL_HOME)/DependencyMangler $@
241    
242     %.dep:
243 williamc 1.2 @$(DependencyCCTool)
244     @$(TOOL_HOME)/DependencyMangler $@
245 williamc 1.17