ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/toolrules.mk
Revision: 1.6
Committed: Fri Mar 26 15:14:37 1999 UTC (26 years, 1 month ago) by williamc
Branch: MAIN
Changes since 1.5: +37 -0 lines
Log Message:
Fix binary targets - dependencies not yet working

File Contents

# User Rev Content
1 williamc 1.1 # Some Pre-Defined Rules For Building Stuff
2     #
3 williamc 1.5 #include compilers.mk
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.6 # -- storage of binaries
11     binarystore:=$(LOCALTOP)/$(INTbin)
12     VPATH+=:$(LOCALTOP)/$(INTbin):$(RELEASETOP)/$(INTbin)
13 williamc 1.1
14     # -- storage of libraries
15     librarystore:=$(LOCALTOP)/$(INTlib)
16     vpath %.$(SharedSuffix) $(librarystore):$(RELEASETOP)/$(INTlib)
17     vpath %.$(ArchiveSuffix) $(librarystore):$(RELEASETOP)/$(INTlib)
18    
19     # -- library names
20    
21     ifdef libname
22     ifndef arlibname
23     arlibname=$(libname)
24     endif
25     ifndef shlibname
26     shlibname=$(libname)
27     endif
28     endif
29    
30     # -- Libray type defaults
31    
32     ifdef DefaultShared
33     lib : $(shlibname).$(SharedSuffix)
34     MakeLib=yes
35     endif
36     ifdef DefaultDebugShared
37     lib : $(shlibname)_d.$(SharedSuffix)
38     MakeLib=yes
39     endif
40     ifdef DefaultArchive
41     lib : $(arlibname).$(ArchiveSuffix)
42     MakeLib=yes
43     endif
44     ifdef DefaultDebugArchive
45     lib : $(arlibname)_d.$(ArchiveSuffix)
46     MakeLib=yes
47     endif
48    
49     ifdef MakeLib
50     all: lib
51     endif
52    
53     #------------------------------------------------
54     # Set up some system variables
55     # - all begin with S
56     #------------------------------------------------
57    
58     Sarchivelibobjs:=$(addsuffix .o,$(archivefiles))
59     Sarchivelibdebugobjs:=$(addsuffix _d.o,$(archivefiles))
60     Ssharedlibobjs:=$(addsuffix _pic.o,$(sharedfiles))
61     Ssharedlibdebugobjs:=$(addsuffix _picd.o,$(sharedfiles))
62    
63     #------------------------------------------------
64     # Rules Start Here
65     #------------------------------------------------
66    
67     # Implicit Rules first
68     # -- Standard Shared Objects
69     %_pic.o : %.cpp
70     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
71     %_pic.o : %.C
72     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
73     %_pic.o : %.cc
74     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
75     %_pic.o : %.F
76     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
77     %_pic.o : %.f
78     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
79    
80     # -- Debug Shared Objects
81     %_picd.o : %.cc
82     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
83    
84     %_picd.o : %.C
85     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
86    
87     %_picd.o : %.cpp
88     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
89    
90     %_picd.o : %.F
91     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
92    
93     %_picd.o : %.f
94     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
95     # -- Standard Archive Libs
96     # Already built in
97    
98     # -- Debug Archive Libs
99     %_d.o : %.cpp
100     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
101    
102     %_d.o : %.cc
103     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
104    
105     %_d.o : %.C
106     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
107    
108     %_d.o : %.F
109     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
110    
111     %_d.o : %.f
112     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
113 williamc 1.6
114     # -- Executables
115     %.exe : %.cpp
116     $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
117    
118     %.exe : %.cc
119     $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
120    
121     %.exe : %.C
122     $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
123    
124     %.exe : %.F
125     $(FC) $(CPPFLAGS) $(FFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
126    
127     %.exe : %.f
128     $(FC) $(CPPFLAGS) $(FFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
129    
130     # -- Debug Exexcutables
131     #LDLIBS_D:=$(shell $(TOOL_HOME)/LibTypeExpand $(LDLIBS) "_d")
132     %_d.exe : %.cpp
133     $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ \ $(LDLIBS_D)
134    
135     %_d.exe : %.cc
136     $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ $(LDLIBS_D)
137    
138     %_d.exe : %.C
139     $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ $(LDLIBS_D)
140    
141     %_d.exe : %.F
142     $(FC) $(CPPFLAGS) $(FFLAGS_D) $(FCDebugFlag) $(LDFLAGS) $< -o $@ $(LDLIBS_D)
143    
144     %_d.exe : %.f
145     $(FC) $(CPPFLAGS) $(FFLAGS_D) $(FCDebugFlag) $(LDFLAGS) $< -o $@ $(LDLIBS_D)
146    
147 williamc 1.1
148     # Some nice generic target names for the user
149    
150     shared : $(shlibname).$(SharedSuffix)
151     shared_debug : $(shlibname)_d.$(SharedSuffix)
152     archive : $(arlibname).$(ArchiveSuffix)
153     archive_debug : $(arlibname)_d.$(ArchiveSuffix)
154    
155     # Now more specific rules
156    
157     # -- Standard Shared Objects Libs
158 williamc 1.3 $(shlibname)_pic.$(SharedSuffix) : $(Ssharedlibobjs)
159 williamc 1.1 $(SharedCCTool)
160 williamc 1.3
161     $(shlibname).$(SharedSuffix) : $(shlibname)_pic.$(SharedSuffix)
162     @mv $< $(librarystore)/$@
163 williamc 1.1
164     # -- Debug Shared Objects Libs
165 williamc 1.3 $(shlibname)_picd.$(SharedSuffix) : $(Ssharedlibdebugobjs)
166 williamc 1.1 $(SharedCCTool)
167 williamc 1.3
168 williamc 1.4 $(shlibname)_d.$(SharedSuffix) : $(Ssharedlibdebugobjs)
169 williamc 1.3 @mv $< $(librarystore)/$@
170 williamc 1.1
171     # -- Standard Archive Libs
172     $(arlibname).$(ArchiveSuffix) : $(Sarchivelibobjs)
173     $(ArchiveCCTool)
174     @mv $@ $(librarystore)
175    
176     # -- Debug Archive Libs
177     $(arlibname)_d.$(ArchiveSuffix) : $(Sarchivelibdebugobjs)
178     $(ArchiveCCTool)
179     @mv $@ $(librarystore)
180 williamc 1.2
181     # -- Dependencies
182     dependencies.mk: $(files)
183     @$(DependencyCCTool)
184     @$(TOOL_HOME)/DependencyMangler $@