ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/toolrules.mk
Revision: 1.8
Committed: Fri Mar 26 18:17:51 1999 UTC (26 years, 1 month ago) by williamc
Branch: MAIN
CVS Tags: V0_4, V0_3
Changes since 1.7: +1 -1 lines
Log Message:
Hide the mv command

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 williamc 1.7 # binary target files
64     Sbinaryobjects:=$(addsuffix .o,$(binfiles))
65    
66 williamc 1.1 #------------------------------------------------
67     # Rules Start Here
68     #------------------------------------------------
69    
70     # Implicit Rules first
71     # -- Standard Shared Objects
72     %_pic.o : %.cpp
73     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
74     %_pic.o : %.C
75     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
76     %_pic.o : %.cc
77     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
78     %_pic.o : %.F
79     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
80     %_pic.o : %.f
81     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
82    
83     # -- Debug Shared Objects
84     %_picd.o : %.cc
85     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
86    
87     %_picd.o : %.C
88     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
89    
90     %_picd.o : %.cpp
91     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
92    
93     %_picd.o : %.F
94     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
95    
96     %_picd.o : %.f
97     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
98     # -- Standard Archive Libs
99     # Already built in
100    
101     # -- Debug Archive Libs
102     %_d.o : %.cpp
103     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
104    
105     %_d.o : %.cc
106     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
107    
108     %_d.o : %.C
109     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
110    
111     %_d.o : %.F
112     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
113    
114     %_d.o : %.f
115     $(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
116 williamc 1.6
117 williamc 1.7 # -------------------------------------------------------------------------
118 williamc 1.6 # -- Executables
119 williamc 1.7 %.exe : $(Sbinaryobjects)
120     $(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
121 williamc 1.6
122 williamc 1.7 # -- Debug Exexcutables
123 williamc 1.6
124     #LDLIBS_D:=$(shell $(TOOL_HOME)/LibTypeExpand $(LDLIBS) "_d")
125 williamc 1.7 %_d.exe : $(Sbinaryobjects)
126     $(CXX) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ \ $(LDLIBS_D)
127 williamc 1.6
128 williamc 1.7 realbins:=$(filter $(bintargets),$(notdir $(wildcard $(LOCALTOP)/$(INTbin)/*)))
129     clean ::
130     @if [ "$(realbins)" != "" ] ; then \
131     echo Removing executables : $(realbins); \
132     rm $(LOCALTOP)/$(INTbin)/$(realbins); \
133     fi;
134 williamc 1.6
135 williamc 1.7 # -------------------------------------------------------------------------
136 williamc 1.1
137     # Some nice generic target names for the user
138    
139     shared : $(shlibname).$(SharedSuffix)
140     shared_debug : $(shlibname)_d.$(SharedSuffix)
141     archive : $(arlibname).$(ArchiveSuffix)
142     archive_debug : $(arlibname)_d.$(ArchiveSuffix)
143    
144     # Now more specific rules
145    
146     # -- Standard Shared Objects Libs
147 williamc 1.3 $(shlibname)_pic.$(SharedSuffix) : $(Ssharedlibobjs)
148 williamc 1.1 $(SharedCCTool)
149 williamc 1.3
150     $(shlibname).$(SharedSuffix) : $(shlibname)_pic.$(SharedSuffix)
151     @mv $< $(librarystore)/$@
152 williamc 1.1
153     # -- Debug Shared Objects Libs
154 williamc 1.3 $(shlibname)_picd.$(SharedSuffix) : $(Ssharedlibdebugobjs)
155 williamc 1.1 $(SharedCCTool)
156 williamc 1.3
157 williamc 1.4 $(shlibname)_d.$(SharedSuffix) : $(Ssharedlibdebugobjs)
158 williamc 1.3 @mv $< $(librarystore)/$@
159 williamc 1.1
160     # -- Standard Archive Libs
161     $(arlibname).$(ArchiveSuffix) : $(Sarchivelibobjs)
162     $(ArchiveCCTool)
163 williamc 1.8 @mv $@ $(librarystore)/$@
164 williamc 1.1
165     # -- Debug Archive Libs
166     $(arlibname)_d.$(ArchiveSuffix) : $(Sarchivelibdebugobjs)
167     $(ArchiveCCTool)
168 williamc 1.7 @mv $@ $(librarystore)/$@
169 williamc 1.2
170     # -- Dependencies
171     dependencies.mk: $(files)
172     @$(DependencyCCTool)
173     @$(TOOL_HOME)/DependencyMangler $@