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