1 |
williamc |
1.1 |
# Some Pre-Defined Rules For Building Stuff
|
2 |
|
|
#
|
3 |
|
|
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 |
|
|
|
11 |
|
|
# -- storage of libraries
|
12 |
|
|
librarystore:=$(LOCALTOP)/$(INTlib)
|
13 |
|
|
vpath %.$(SharedSuffix) $(librarystore):$(RELEASETOP)/$(INTlib)
|
14 |
|
|
vpath %.$(ArchiveSuffix) $(librarystore):$(RELEASETOP)/$(INTlib)
|
15 |
|
|
|
16 |
|
|
# -- library names
|
17 |
|
|
|
18 |
|
|
ifdef libname
|
19 |
|
|
ifndef arlibname
|
20 |
|
|
arlibname=$(libname)
|
21 |
|
|
endif
|
22 |
|
|
ifndef shlibname
|
23 |
|
|
shlibname=$(libname)
|
24 |
|
|
endif
|
25 |
|
|
endif
|
26 |
|
|
|
27 |
|
|
# -- Libray type defaults
|
28 |
|
|
|
29 |
|
|
ifdef DefaultShared
|
30 |
|
|
lib : $(shlibname).$(SharedSuffix)
|
31 |
|
|
MakeLib=yes
|
32 |
|
|
endif
|
33 |
|
|
ifdef DefaultDebugShared
|
34 |
|
|
lib : $(shlibname)_d.$(SharedSuffix)
|
35 |
|
|
MakeLib=yes
|
36 |
|
|
endif
|
37 |
|
|
ifdef DefaultArchive
|
38 |
|
|
lib : $(arlibname).$(ArchiveSuffix)
|
39 |
|
|
MakeLib=yes
|
40 |
|
|
endif
|
41 |
|
|
ifdef DefaultDebugArchive
|
42 |
|
|
lib : $(arlibname)_d.$(ArchiveSuffix)
|
43 |
|
|
MakeLib=yes
|
44 |
|
|
endif
|
45 |
|
|
|
46 |
|
|
ifdef MakeLib
|
47 |
|
|
all: lib
|
48 |
|
|
endif
|
49 |
|
|
|
50 |
|
|
#------------------------------------------------
|
51 |
|
|
# Set up some system variables
|
52 |
|
|
# - all begin with S
|
53 |
|
|
#------------------------------------------------
|
54 |
|
|
|
55 |
|
|
Sarchivelibobjs:=$(addsuffix .o,$(archivefiles))
|
56 |
|
|
Sarchivelibdebugobjs:=$(addsuffix _d.o,$(archivefiles))
|
57 |
|
|
Ssharedlibobjs:=$(addsuffix _pic.o,$(sharedfiles))
|
58 |
|
|
Ssharedlibdebugobjs:=$(addsuffix _picd.o,$(sharedfiles))
|
59 |
|
|
|
60 |
|
|
#------------------------------------------------
|
61 |
|
|
# Rules Start Here
|
62 |
|
|
#------------------------------------------------
|
63 |
|
|
|
64 |
|
|
# Implicit Rules first
|
65 |
|
|
# -- Standard Shared Objects
|
66 |
|
|
%_pic.o : %.cpp
|
67 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
|
68 |
|
|
%_pic.o : %.C
|
69 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
|
70 |
|
|
%_pic.o : %.cc
|
71 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(SharedCCObjectFlags) $< -o $@
|
72 |
|
|
%_pic.o : %.F
|
73 |
|
|
$(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
|
74 |
|
|
%_pic.o : %.f
|
75 |
|
|
$(FC) -c $(CPPFLAGS) $(FFLAGS) $(SharedFCObjectFlags) $< -o $@
|
76 |
|
|
|
77 |
|
|
# -- Debug Shared Objects
|
78 |
|
|
%_picd.o : %.cc
|
79 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
|
80 |
|
|
|
81 |
|
|
%_picd.o : %.C
|
82 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
|
83 |
|
|
|
84 |
|
|
%_picd.o : %.cpp
|
85 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $(SharedCCObjectFlags) $< -o $@
|
86 |
|
|
|
87 |
|
|
%_picd.o : %.F
|
88 |
|
|
$(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
|
89 |
|
|
|
90 |
|
|
%_picd.o : %.f
|
91 |
|
|
$(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $(SharedFCObjectFlags) $< -o $@
|
92 |
|
|
# -- Standard Archive Libs
|
93 |
|
|
# Already built in
|
94 |
|
|
|
95 |
|
|
# -- Debug Archive Libs
|
96 |
|
|
%_d.o : %.cpp
|
97 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
|
98 |
|
|
|
99 |
|
|
%_d.o : %.cc
|
100 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
|
101 |
|
|
|
102 |
|
|
%_d.o : %.C
|
103 |
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXDebugFlag) $< -o $@
|
104 |
|
|
|
105 |
|
|
%_d.o : %.F
|
106 |
|
|
$(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
|
107 |
|
|
|
108 |
|
|
%_d.o : %.f
|
109 |
|
|
$(FC) -c $(CPPFLAGS) $(FFLAGS) $(FCDebugFlag) $< -o $@
|
110 |
|
|
|
111 |
|
|
# Some nice generic target names for the user
|
112 |
|
|
|
113 |
|
|
shared : $(shlibname).$(SharedSuffix)
|
114 |
|
|
shared_debug : $(shlibname)_d.$(SharedSuffix)
|
115 |
|
|
archive : $(arlibname).$(ArchiveSuffix)
|
116 |
|
|
archive_debug : $(arlibname)_d.$(ArchiveSuffix)
|
117 |
|
|
|
118 |
|
|
# Now more specific rules
|
119 |
|
|
|
120 |
|
|
# -- Standard Shared Objects Libs
|
121 |
|
|
$(shlibname).$(SharedSuffix) : $(Ssharedlibobjs)
|
122 |
|
|
$(SharedCCTool)
|
123 |
|
|
@mv $@ $(librarystore)
|
124 |
|
|
|
125 |
|
|
# -- Debug Shared Objects Libs
|
126 |
|
|
$(shlibname)_d.$(SharedSuffix) : $(Ssharedlibdebugobjs)
|
127 |
|
|
$(SharedCCTool)
|
128 |
|
|
@mv $@ $(librarystore)
|
129 |
|
|
|
130 |
|
|
# -- Standard Archive Libs
|
131 |
|
|
$(arlibname).$(ArchiveSuffix) : $(Sarchivelibobjs)
|
132 |
|
|
$(ArchiveCCTool)
|
133 |
|
|
@mv $@ $(librarystore)
|
134 |
|
|
|
135 |
|
|
# -- Debug Archive Libs
|
136 |
|
|
$(arlibname)_d.$(ArchiveSuffix) : $(Sarchivelibdebugobjs)
|
137 |
|
|
$(ArchiveCCTool)
|
138 |
|
|
@mv $@ $(librarystore)
|
139 |
williamc |
1.2 |
|
140 |
|
|
# -- Dependencies
|
141 |
|
|
dependencies.mk: $(files)
|
142 |
|
|
@$(DependencyCCTool)
|
143 |
|
|
@$(TOOL_HOME)/DependencyMangler $@
|