/[resiprocate]/main/build/Makefile.post
ViewVC logotype

Contents of /main/build/Makefile.post

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5295 - (show annotations) (download)
Mon Aug 22 00:30:05 2005 UTC (14 years, 3 months ago) by jason
File size: 9563 byte(s)
merged 5270:HEAD from b-directory-reorg
1 # $Id: Makefile.post,v 1.3 2004/02/07 20:52:29 jason Exp $
2
3 # The license applies to all software incorporated in the "Vovida
4 # Open Communication Application Library" except for those portions
5 # incorporating third party software specifically identified as being
6 # licensed under separate license.
7 #
8 #
9 #
10 # The Vovida Software License, Version 1.0
11 # Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
12 #
13 # Redistribution and use in source and binary forms, with or without
14 # modification, are permitted provided that the following conditions
15 # are met:
16 #
17 # 1. Redistributions of source code must retain the above copyright
18 # notice, this list of conditions and the following disclaimer.
19 #
20 # 2. Redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in
22 # the documentation and/or other materials provided with the
23 # distribution.
24 #
25 # 3. The names "VOCAL", "Vovida Open Communication Application Library",
26 # and "Vovida Open Communication Application Library (VOCAL)" must
27 # not be used to endorse or promote products derived from this
28 # software without prior written permission. For written
29 # permission, please contact vocal@vovida.org.
30 #
31 # 4. Products derived from this software may not be called "VOCAL", nor
32 # may "VOCAL" appear in their name, without prior written
33 # permission of Vovida Networks, Inc.
34 #
35 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
36 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
38 # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
39 # NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
40 # IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
41 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
42 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
43 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
46 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
47 # DAMAGE.
48 #
49 # ====================================================================
50 #
51 # This software consists of voluntary contributions made by Vovida
52 # Networks, Inc. and many individuals on behalf of Vovida Networks,
53 # Inc. For more information on Vovida Networks, Inc., please see
54 # <http://www.vovida.org/>.
55 #
56 #
57 # All third party licenses and copyright notices and other required
58 # legends also need to be complied with as well.
59 #
60
61 -include $(BUILD)/Makefile.pkg
62
63 PURIFY = purify
64 PURIFY5 = /usr/pure/purify-5.3-solaris2/purify
65 QUANTIFY = quantify
66
67 # this section adds the appropriate flags, headers, etc. for packages.
68 # See the Makefile.pkg for further information about how packages work.
69
70 INCDIRS += $(foreach package,$(PACKAGES), $($(package)_INCLUDEDIRS))
71 CXXFLAGS += $(foreach package,$(PACKAGES), $($(package)_CXXFLAGS))
72 LDFLAGS += $(foreach package,$(PACKAGES), $($(package)_LDFLAGS))
73 LIBDIRS += $(foreach package,$(PACKAGES), $($(package)_LIBDIRS))
74 LIBNAMES += $(foreach package,$(PACKAGES), $($(package)_LIBNAME) )
75 LDLIBS_LAST += $(foreach package,$(PACKAGES), $($(package)_LDLIBS_LAST))
76 LDLIBS += $(foreach libs,$(LIBDIRS), -L$(libs)) $(foreach libs,$(LIBNAMES), -l$(libs))
77 DEFINES += $(foreach package,$(PACKAGES), $($(package)_DEFINES) )
78
79 # because order is important
80 LDLIBS += $(LDLIBS_LAST)
81
82 DEPEND_FILES += $(foreach pkg,$(PACKAGES), $($(pkg)_DEPENDS))
83 DEPEND_TARGETS += $(foreach pkg,$(PACKAGES), $($(pkg)_TARGETS))
84
85 ifeq ($(BUILD_SHARED_LIBS),yes)
86 .dependlibs: $(patsubst %.a,%.so,$(DEPEND_FILES))
87 else
88 .dependlibs: $(DEPEND_FILES)
89 endif
90 touch .dependlibs
91
92 RELEASE = $(patsubst %/build,%/release, $(BUILD))
93 INCLUDE_LIST = $(foreach dir,$(INCDIRS),-I$(dir))
94 DEFINE_LIST = $(foreach dir,$(DEFINES),-D$(dir))
95 CXXFLAGS += $(INCLUDE_LIST) $(DEFINE_LIST)
96 CFLAGS += $(INCLUDE_LIST) $(DEFINE_LIST)
97
98 OBJ = obj.$(TARGET_NAME)
99 BIN = bin.$(TARGET_NAME)
100
101 .PHONY : all code clean default $(BIN) $(OBJ) prefs full verify fakepre
102
103 SRC += $(SRC_$(OSCLASS))
104
105 TESTPROGRAMS += $(VERIFY_TESTCASES)
106
107 ALLSRC += $(TESTPROGRAMS) $(SRC)
108
109 OBJS = $(patsubst %.cpp,$(OBJ)/%.o,$(patsubst %.c,$(OBJ)/%.o,$(patsubst %.cxx,$(OBJ)/%.o,$(SRC)))) $(EXTRA_OBJS)
110 TESTPROGRAM_OBJS = $(patsubst %.cpp,$(OBJ)/%.o,$(patsubst %.c,$(OBJ)/%.o,$(patsubst %.cxx,$(OBJ)/%.o,$(TESTPROGRAMS)))) $(EXTRA_OBJS)
111 HWOBJS = $(patsubst %.cpp,$(OBJ)/%.o,$(patsubst %.c,$(OBJ)/%.o,$(patsubst %.cxx,$(OBJ)/%.o,$(HWSRC))))
112 DEPENDENCIES = $(patsubst %.cpp,$(OBJ)/%.d,$(patsubst %.c,$(OBJ)/%.d,$(patsubst %.cxx,$(OBJ)/%.d,$(ALLSRC))))
113
114 SHARED_LIB = $(patsubst %,$(OBJ)/%.so,$(strip $(TARGET_LIBRARY)))
115 STATIC_LIB = $(patsubst %,$(OBJ)/%.a,$(strip $(TARGET_LIBRARY)))
116
117 ifeq ($(BUILD_SHARED_LIBS),yes)
118 LIBTARGETS += $(SHARED_LIB)
119 else
120 LIBTARGETS += $(STATIC_LIB)
121 endif
122
123 EXTRAS = $(HWOBJS)
124
125 HEADERS = $(wildcard *.h) $(wildcard *.hxx)
126
127 CODETARGETS = $(patsubst %.cpp,$(BIN)/%,$(patsubst %.c,$(BIN)/%,$(patsubst %.cxx,$(BIN)/%,$(TESTPROGRAMS))))
128
129 TESTCASE_PROGRAMS = $(patsubst %,$(BIN)/%,$(TESTCASES))
130 VERIFY_TESTCASE_PROGRAMS = $(patsubst %.c,$(BIN)/%,$(patsubst %.cxx,$(BIN)/%,$(VERIFY_TESTCASES)))
131
132 ifdef CROSS_COMPILE
133 CROSS_FLAG = -c
134 endif
135
136 # here is the start of the appropriate rules
137
138 HEADERS_SPECIAL =
139
140 DATESTAMP =
141
142 code: $(HEADERS_SPECIAL) $(OBJ) $(HWOBJS) $(BIN) $(AUTO_FILES) $(TARGETS) $(LIBTARGETS) $(CODETARGETS) $(CODETARGETS_LT) $(COPY) $(TESTPROGRAM_OBJS)
143
144 # this rule does anything that needs to be done before dependency generation
145
146 $(BUILD)/fakepre: $(HEADERS_SPECIAL)
147 @touch $(BUILD)/fakepre
148
149 # $(TOOLS)/makeprefs $@
150 $(ROOT)/.make_prefs:
151 echo 'USE_BUILDDIR=no' > $@
152 include $(ROOT)/.make_prefs
153
154 prefs:
155 $(TOOLS)/makeprefs $(ROOT)/.make_prefs
156
157 dependencies: $(DEPENDENCIES)
158
159 ifdef ROOT_TARGET
160 target:
161 cd $(ROOT) ; $(MAKE) $(ROOT_TARGET)
162 endif
163
164 all: code
165
166 clean:
167 -rm -f *.rpo core core.* *~ \#* .make* *.a *.d *.S
168 -rm -rf html
169 -rm -f obj.*/*.rpo
170 -rm -f obj.*/*.so
171 -rm -f obj.*/*.[oda]
172 -rm -f obj.*/*/*.[oda]
173 -rm -f bin.*/*
174 -rm -f bin.*/*/*
175 for file in *; do test -h $$file && rm -f $$file; done ; true
176
177 cleanall: clean
178 -rm -rf bin.* obj.*
179
180 $(BIN):
181 -@ $(TOOLS)/mkbuildlinks $(BIN) $(ROOT)/.make_prefs
182 ifdef CODE_SUBDIRS
183 -@ for subdir in $(CODE_SUBDIRS) ; do ( mkdir -p $(BIN)/$$subdir ) ; done
184 endif
185
186 $(OBJ):
187 -@ $(TOOLS)/mkbuildlinks $(OBJ) $(ROOT)/.make_prefs
188
189
190 ifeq ($(CXXFLAGS),$(shell test -f $(OBJ)/cxxflags && cat $(OBJ)/cxxflags))
191 else
192 .PHONY: $(OBJ)/cflags $(OBJ)/cxxflags
193
194 endif
195
196
197 $(OBJ)/cflags:
198 @echo '$(CFLAGS)' > $@
199
200 $(OBJ)/cxxflags:
201 @echo '$(CXXFLAGS)' > $@
202
203 ifeq ($(OSTYPE),cygwin)
204 OUTPUT_FLAG=-Fo
205 else
206 OUTPUT_FLAG=-o
207 endif
208 # compile c code
209 $(OBJ)/%.o: %.c $(OBJ)/%.d $(OBJ)/cflags
210 $(CC) $(CFLAGS) -c $(OUTPUT_FLAG)$@ $<
211
212 ifeq ($(ACCEPT_I_FILES),1)
213 else
214 # compile c++ code
215 $(OBJ)/%.o: %.cxx $(OBJ)/%.d $(OBJ)/cxxflags
216 $(CXX) $(CXXFLAGS) -c $(OUTPUT_FLAG)$@ $<
217 $(OBJ)/%.o: %.cpp $(OBJ)/%.d $(OBJ)/cxxflags
218 $(CXX) $(CXXFLAGS) -c $(OUTPUT_FLAG)$@ $<
219 endif
220
221 # build executables
222 $(BIN)/%: $(OBJ)/%.o $(OBJS) $(EXTRAS) .dependlibs
223 $(LINKER) $(LDFLAGS) -o $@ $(DATESTAMP) $(patsubst %.dependlibs,%, $^) $(LDLIBS)
224 -@ test -f $(patsubst $(BIN)/%,%,$@) && /bin/rm -f $(patsubst $(BIN)/%,%,$@)
225 -@ test -h $(patsubst $(BIN)/%,%,$@) || ln -s $@ $(patsubst $(BIN)/%,%,$@)
226
227 # these rules build dependency files in the cases that need them.
228
229 ifeq ($(OSTYPE),cygwin)
230 $(OBJ)/%.d: %.c $(OBJ)
231 echo > $@
232 $(OBJ)/%.d: %.cxx $(OBJ)
233 echo > $@
234 $(OBJ)/%.d: %.cpp $(OBJ)
235 echo > $@
236 else
237 $(OBJ)/%.d: %.c $(NOCOMPILE_SRC) $(ROOT)/.make_prefs
238 -@ $(TOOLS)/mkbuildlinks $(OBJ) $(ROOT)/.make_prefs
239 ifdef CODE_SUBDIRS
240 -@for subdir in $(CODE_SUBDIRS) ; do ( mkdir -p $(OBJ)/$$subdir ) ; done
241 endif
242 @echo "Making $@"
243 @$(SHELL) -ec '$(DEP) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DFLAGS) $< \
244 $(DMANGLE) | sed -e "s#^$(*F).o[ :]*#$(@D)\/$(*F).o $@ : #" \
245 > $@; [ -s $@ ] || rm -f $@'
246
247 $(OBJ)/%.d: %.cxx $(NOCOMPILE_SRC) $(ROOT)/.make_prefs
248 -@ $(TOOLS)/mkbuildlinks $(OBJ) $(ROOT)/.make_prefs
249 ifdef CODE_SUBDIRS
250 -@for subdir in $(CODE_SUBDIRS) ; do ( mkdir -p $(OBJ)/$$subdir ) ; done
251 endif
252 @echo "Making $@"
253 @$(SHELL) -ec '$(DEP) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DFLAGS) $< \
254 $(DMANGLE) | sed -e "s#^$(*F).o[ :]*#$(@D)\/$(*F).o $@ : #" \
255 > $@; [ -s $@ ] || rm -f $@'
256
257 $(OBJ)/%.d: %.cpp $(NOCOMPILE_SRC) $(ROOT)/.make_prefs
258 -@ $(TOOLS)/mkbuildlinks $(OBJ) $(ROOT)/.make_prefs
259 ifdef CODE_SUBDIRS
260 -@for subdir in $(CODE_SUBDIRS) ; do ( mkdir -p $(OBJ)/$$subdir ) ; done
261 endif
262 @echo "Making $@"
263 @$(SHELL) -ec '$(DEP) $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DFLAGS) $< \
264 $(DMANGLE) | sed -e "s#^$(*F).o[ :]*#$(@D)\/$(*F).o $@ : #" \
265 > $@; [ -s $@ ] || rm -f $@'
266
267 endif
268
269 .SECONDARY: $(DEPENDENCIES) $(OBJS)
270
271 # this rule builds a target library if that is what is called for in
272 # the make file. If not, the object files are not linked together.
273
274 ifdef TARGET_LIBRARY
275 $(OBJ)/$(strip $(TARGET_LIBRARY)).a: $(OBJS) $(OTHERLIBS)
276 -@ test -f $@ && /bin/rm $@
277 $(AR) $(ARFLAGS) $@ $^
278 $(RANLIB) $@
279
280 $(OBJ)/$(strip $(TARGET_LIBRARY)).so: $(OBJS) $(OTHERLIBS)
281 -@ test -f $@ && /bin/rm $@
282 $(MKSHLIB) -o $@ $^
283 -@ mkdir -p $(ROOT)/lib.$(TARGET_NAME)
284 @ test -h $(ROOT)/lib.$(TARGET_NAME)/$(strip $(TARGET_LIBRARY)).so || ln -s $(shell pwd)/$@ $(ROOT)/lib.$(TARGET_NAME)
285 endif
286
287 -include $(DEPENDENCIES)
288
289 # this MUST be the last item in the makefile -- it will be done first always.
290 -include $(BUILD)/fakepre

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27