1 |
# Some Pre-Defined Rules For Building Stuff
|
2 |
#
|
3 |
#include compilers.mk
|
4 |
lib : dependencies.mk
|
5 |
bin : dependencies.mk
|
6 |
|
7 |
#------------------------------------------------
|
8 |
# Default Behaviours - interpreted from makefile
|
9 |
#------------------------------------------------
|
10 |
# -- storage of binaries
|
11 |
binarystore:=$(LOCALTOP)/$(INTbin)
|
12 |
VPATH+=:$(LOCALTOP)/$(INTbin):$(RELEASETOP)/$(INTbin)
|
13 |
|
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 |
# binary target files
|
64 |
Sbinaryobjects:=$(addsuffix .o,$(binfiles))
|
65 |
|
66 |
#------------------------------------------------
|
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 |
|
117 |
# -------------------------------------------------------------------------
|
118 |
# -- Executables
|
119 |
%.exe : $(Sbinaryobjects)
|
120 |
$(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS)
|
121 |
|
122 |
# -- Debug Exexcutables
|
123 |
|
124 |
#LDLIBS_D:=$(shell $(TOOL_HOME)/LibTypeExpand $(LDLIBS) "_d")
|
125 |
%_d.exe : $(Sbinaryobjects)
|
126 |
$(CXX) $(CXXFLAGS) $(CXXDebugFlag) $(LDFLAGS) $< -o $@ \ $(LDLIBS_D)
|
127 |
|
128 |
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 |
|
135 |
# -------------------------------------------------------------------------
|
136 |
|
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 |
$(shlibname)_pic.$(SharedSuffix) : $(Ssharedlibobjs)
|
148 |
$(SharedCCTool)
|
149 |
|
150 |
$(shlibname).$(SharedSuffix) : $(shlibname)_pic.$(SharedSuffix)
|
151 |
@mv $< $(librarystore)/$@
|
152 |
|
153 |
# -- Debug Shared Objects Libs
|
154 |
$(shlibname)_picd.$(SharedSuffix) : $(Ssharedlibdebugobjs)
|
155 |
$(SharedCCTool)
|
156 |
|
157 |
$(shlibname)_d.$(SharedSuffix) : $(Ssharedlibdebugobjs)
|
158 |
@mv $< $(librarystore)/$@
|
159 |
|
160 |
# -- Standard Archive Libs
|
161 |
$(arlibname).$(ArchiveSuffix) : $(Sarchivelibobjs)
|
162 |
$(ArchiveCCTool)
|
163 |
@mv $@ $(librarystore)/$@
|
164 |
|
165 |
# -- Debug Archive Libs
|
166 |
$(arlibname)_d.$(ArchiveSuffix) : $(Sarchivelibdebugobjs)
|
167 |
$(ArchiveCCTool)
|
168 |
@mv $@ $(librarystore)/$@
|
169 |
|
170 |
# -- Dependencies
|
171 |
dependencies.mk: $(files)
|
172 |
@$(DependencyCCTool)
|
173 |
@$(TOOL_HOME)/DependencyMangler $@
|