VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/nsprpub/config/rules.mk@ 67439

最後變更 在這個檔案從67439是 1,由 vboxsync 提交於 55 年 前

import

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 13.9 KB
 
1#! gmake
2#
3# ***** BEGIN LICENSE BLOCK *****
4# Version: MPL 1.1/GPL 2.0/LGPL 2.1
5#
6# The contents of this file are subject to the Mozilla Public License Version
7# 1.1 (the "License"); you may not use this file except in compliance with
8# the License. You may obtain a copy of the License at
9# http://www.mozilla.org/MPL/
10#
11# Software distributed under the License is distributed on an "AS IS" basis,
12# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13# for the specific language governing rights and limitations under the
14# License.
15#
16# The Original Code is the Netscape Portable Runtime (NSPR).
17#
18# The Initial Developer of the Original Code is
19# Netscape Communications Corporation.
20# Portions created by the Initial Developer are Copyright (C) 1998-2000
21# the Initial Developer. All Rights Reserved.
22#
23# Contributor(s):
24#
25# Alternatively, the contents of this file may be used under the terms of
26# either the GNU General Public License Version 2 or later (the "GPL"), or
27# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28# in which case the provisions of the GPL or the LGPL are applicable instead
29# of those above. If you wish to allow use of your version of this file only
30# under the terms of either the GPL or the LGPL, and not to allow others to
31# use your version of this file under the terms of the MPL, indicate your
32# decision by deleting the provisions above and replace them with the notice
33# and other provisions required by the GPL or the LGPL. If you do not delete
34# the provisions above, a recipient may use your version of this file under
35# the terms of any one of the MPL, the GPL or the LGPL.
36#
37# ***** END LICENSE BLOCK *****
38
39################################################################################
40# We have a 4 pass build process:
41#
42# Pass 1. export - Create generated headers and stubs. Publish public headers to
43# dist/<arch>/include.
44#
45# Pass 2. libs - Create libraries. Publish libraries to dist/<arch>/lib.
46#
47# Pass 3. all - Create programs.
48#
49# Pass 4. install - Publish programs to dist/<arch>/bin.
50#
51# Parameters to this makefile (set these before including):
52#
53# a)
54# TARGETS -- the target to create
55# (defaults to $LIBRARY $PROGRAM)
56# b)
57# DIRS -- subdirectories for make to recurse on
58# (the 'all' rule builds $TARGETS $DIRS)
59# c)
60# CSRCS -- .c files to compile
61# (used to define $OBJS)
62# d)
63# PROGRAM -- the target program name to create from $OBJS
64# ($OBJDIR automatically prepended to it)
65# e)
66# LIBRARY -- the target library name to create from $OBJS
67# ($OBJDIR automatically prepended to it)
68#
69################################################################################
70
71ifndef topsrcdir
72topsrcdir=$(MOD_DEPTH)
73endif
74
75ifndef srcdir
76srcdir=.
77endif
78
79ifndef NSPR_CONFIG_MK
80include $(topsrcdir)/config/config.mk
81endif
82
83ifdef USE_AUTOCONF
84ifdef CROSS_COMPILE
85ifdef INTERNAL_TOOLS
86CC=$(HOST_CC)
87CCC=$(HOST_CXX)
88CFLAGS=$(HOST_CFLAGS)
89CXXFLAGS=$(HOST_CXXFLAGS)
90endif
91endif
92endif
93
94#
95# This makefile contains rules for building the following kinds of
96# libraries:
97# - LIBRARY: a static (archival) library
98# - SHARED_LIBRARY: a shared (dynamic link) library
99# - IMPORT_LIBRARY: an import library, used only on Windows and OS/2
100#
101# The names of these libraries can be generated by simply specifying
102# LIBRARY_NAME and LIBRARY_VERSION.
103#
104
105ifdef LIBRARY_NAME
106ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
107
108#
109# Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
110# other platforms do not.
111#
112ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
113LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
114SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
115IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
116SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
117else
118LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
119SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
120IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
121SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
122endif
123
124else
125
126LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
127ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
128SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
129else
130ifdef MKSHLIB
131SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
132endif
133endif
134
135endif
136endif
137
138ifndef TARGETS
139ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
140TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
141ifndef BUILD_OPT
142ifdef MSC_VER
143ifneq ($(MSC_VER),1200)
144TARGETS += $(SHARED_LIB_PDB)
145endif
146endif
147endif
148else
149TARGETS = $(LIBRARY) $(SHARED_LIBRARY)
150endif
151endif
152
153#
154# OBJS is the list of object files. It can be constructed by
155# specifying CSRCS (list of C source files) and ASFILES (list
156# of assembly language source files).
157#
158
159ifndef OBJS
160OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
161 $(addprefix $(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
162endif
163
164ifeq ($(MOZ_OS2_TOOLS),VACPP)
165EXTRA_LIBS := $(patsubst -l%,$(DIST)/lib/%.$(LIB_SUFFIX),$(EXTRA_LIBS))
166endif
167
168ALL_TRASH = $(TARGETS) $(OBJS) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
169 $(NOSUCHFILE) \
170 so_locations
171
172ifeq ($(OS_ARCH),OpenVMS)
173ALL_TRASH += $(wildcard *.c*_defines)
174ifdef SHARED_LIBRARY
175VMS_SYMVEC_FILE = $(SHARED_LIBRARY:.$(DLL_SUFFIX)=_symvec.opt)
176VMS_SYMVEC_FILE_MODULE = $(srcdir)/$(LIBRARY_NAME)_symvec.opt
177ALL_TRASH += $(VMS_SYMVEC_FILE)
178endif
179endif
180
181ifndef RELEASE_LIBS_DEST
182RELEASE_LIBS_DEST = $(RELEASE_LIB_DIR)
183endif
184
185ifdef DIRS
186LOOP_OVER_DIRS = \
187 @for d in $(DIRS); do \
188 if test -d $$d; then \
189 set -e; \
190 echo "cd $$d; $(MAKE) $@"; \
191 $(MAKE) -C $$d $@; \
192 set +e; \
193 else \
194 echo "Skipping non-directory $$d..."; \
195 fi; \
196 done
197endif
198
199################################################################################
200
201all:: export
202
203export::
204 +$(LOOP_OVER_DIRS)
205
206libs:: export
207
208install:: export
209
210clean::
211 rm -rf $(OBJS) so_locations $(NOSUCHFILE) $(GARBAGE)
212 +$(LOOP_OVER_DIRS)
213
214clobber::
215 rm -rf $(OBJS) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
216 +$(LOOP_OVER_DIRS)
217
218realclean clobber_all::
219 rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
220 +$(LOOP_OVER_DIRS)
221
222distclean::
223 rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
224 +$(LOOP_OVER_DIRS)
225
226real_install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS)
227ifdef RELEASE_BINS
228 $(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir)
229endif
230ifdef RELEASE_HEADERS
231 $(NSINSTALL) -t -m 0644 $(RELEASE_HEADERS) $(DESTDIR)$(includedir)/$(include_subdir)
232endif
233ifdef RELEASE_LIBS
234 $(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir)
235endif
236 +$(LOOP_OVER_DIRS)
237
238release:: export
239ifdef RELEASE_BINS
240 @echo "Copying executable programs and scripts to release directory"
241 @if test -z "$(BUILD_NUMBER)"; then \
242 echo "BUILD_NUMBER must be defined"; \
243 false; \
244 else \
245 true; \
246 fi
247 @if test ! -d $(RELEASE_BIN_DIR); then \
248 rm -rf $(RELEASE_BIN_DIR); \
249 $(NSINSTALL) -D $(RELEASE_BIN_DIR);\
250 else \
251 true; \
252 fi
253 cp $(RELEASE_BINS) $(RELEASE_BIN_DIR)
254endif
255ifdef RELEASE_LIBS
256 @echo "Copying libraries to release directory"
257 @if test -z "$(BUILD_NUMBER)"; then \
258 echo "BUILD_NUMBER must be defined"; \
259 false; \
260 else \
261 true; \
262 fi
263 @if test ! -d $(RELEASE_LIBS_DEST); then \
264 rm -rf $(RELEASE_LIBS_DEST); \
265 $(NSINSTALL) -D $(RELEASE_LIBS_DEST);\
266 else \
267 true; \
268 fi
269 cp $(RELEASE_LIBS) $(RELEASE_LIBS_DEST)
270endif
271ifdef RELEASE_HEADERS
272 @echo "Copying header files to release directory"
273 @if test -z "$(BUILD_NUMBER)"; then \
274 echo "BUILD_NUMBER must be defined"; \
275 false; \
276 else \
277 true; \
278 fi
279 @if test ! -d $(RELEASE_HEADERS_DEST); then \
280 rm -rf $(RELEASE_HEADERS_DEST); \
281 $(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\
282 else \
283 true; \
284 fi
285 cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
286endif
287 +$(LOOP_OVER_DIRS)
288
289alltags:
290 rm -f TAGS tags
291 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
292 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
293
294$(NFSPWD):
295 cd $(@D); $(MAKE) $(@F)
296
297$(PROGRAM): $(OBJS)
298 @$(MAKE_OBJDIR)
299ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
300 $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
301else
302ifeq ($(MOZ_OS2_TOOLS),VACPP)
303 $(CC) $(OBJS) -Fe$@ $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
304else
305 $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
306endif
307endif
308ifdef ENABLE_STRIP
309 $(STRIP) $@
310endif
311
312$(LIBRARY): $(OBJS)
313 @$(MAKE_OBJDIR)
314 rm -f $@
315ifeq ($(MOZ_OS2_TOOLS),VACPP)
316 $(AR) $(subst /,\\,$(OBJS)) $(AR_FLAGS)
317else
318 $(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
319endif
320 $(RANLIB) $@
321
322ifeq ($(OS_TARGET), OS2)
323$(IMPORT_LIBRARY): $(MAPFILE)
324 rm -f $@
325 $(IMPLIB) $@ $(MAPFILE)
326endif
327
328$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
329 @$(MAKE_OBJDIR)
330 rm -f $@
331ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
332 echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
333 nm -B -C -g $(OBJS) \
334 | awk '/ [T,D] / {print $$3}' \
335 | sed -e 's/^\.//' \
336 | sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
337 $(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
338 -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
339else # AIX 4.1
340ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
341 $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
342else
343ifeq ($(MOZ_OS2_TOOLS),VACPP)
344 $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
345else # !os2 vacpp
346ifeq ($(OS_TARGET), OpenVMS)
347 @if test ! -f $(VMS_SYMVEC_FILE); then \
348 if test -f $(VMS_SYMVEC_FILE_MODULE); then \
349 echo Creating component options file $(VMS_SYMVEC_FILE); \
350 cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
351 fi; \
352 fi
353endif # OpenVMS
354 $(MKSHLIB) $(OBJS) $(RES) $(EXTRA_LIBS)
355endif # OS2 vacpp
356endif # WINNT
357endif # AIX 4.1
358ifdef ENABLE_STRIP
359 $(STRIP) $@
360endif
361
362ifeq ($(OS_ARCH),WINNT)
363$(RES): $(RESNAME)
364 @$(MAKE_OBJDIR)
365# The resource compiler does not understand the -U option.
366ifdef NS_USE_GCC
367 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
368else
369 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
370endif # GCC
371 @echo $(RES) finished
372endif
373
374$(MAPFILE): $(LIBRARY_NAME).def
375 @$(MAKE_OBJDIR)
376ifeq ($(OS_ARCH),SunOS)
377 grep -v ';-' $< | \
378 sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
379endif
380ifeq ($(OS_ARCH),OS2)
381 echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@
382 echo PROTMODE >> $@
383 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
384 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
385 echo EXPORTS >> $@
386ifeq ($(MOZ_OS2_TOOLS),VACPP)
387 grep -v ';+' $< | grep -v ';-' | \
388 sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' >> $@
389else
390 grep -v ';+' $< | grep -v ';-' | \
391 sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \
392 awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@
393 $(ADD_TO_DEF_FILE)
394endif
395endif
396
397#
398# Translate source filenames to absolute paths. This is required for
399# debuggers under Windows and OS/2 to find source files automatically.
400#
401
402ifeq ($(OS_ARCH),OS2)
403NEED_ABSOLUTE_PATH = 1
404endif
405
406ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
407NEED_ABSOLUTE_PATH = 1
408endif
409
410ifdef NEED_ABSOLUTE_PATH
411PWD := $(shell pwd)
412abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
413endif
414
415$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
416 @$(MAKE_OBJDIR)
417ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
418 $(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
419else
420ifeq ($(MOZ_OS2_TOOLS),VACPP)
421 $(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
422else
423ifdef NEED_ABSOLUTE_PATH
424 $(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
425else
426 $(CCC) -o $@ -c $(CCCFLAGS) $<
427endif
428endif
429endif
430
431WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
432WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
433WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
434$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
435 @$(MAKE_OBJDIR)
436ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
437 $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
438else
439ifeq ($(MOZ_OS2_TOOLS),VACPP)
440 $(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
441else
442ifdef NEED_ABSOLUTE_PATH
443 $(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
444else
445 $(CC) -o $@ -c $(CFLAGS) $<
446endif
447endif
448endif
449
450
451$(OBJDIR)/%.$(OBJ_SUFFIX): %.s
452 @$(MAKE_OBJDIR)
453 $(AS) -o $@ $(ASFLAGS) -c $<
454
455ifeq ($(MOZ_OS2_TOOLS),VACPP)
456$(OBJDIR)/%.$(OBJ_SUFFIX): %.asm
457 @$(MAKE_OBJDIR)
458 $(AS) -Fdo:./$(OBJDIR) $(ASFLAGS) $<
459endif
460
461%.i: %.c
462 $(CC) -C -E $(CFLAGS) $< > $*.i
463
464%: %.pl
465 rm -f $@; cp $< $@; chmod +x $@
466
467#
468# HACK ALERT
469#
470# The only purpose of this rule is to pass Mozilla's Tinderbox depend
471# builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's
472# Tinderbox builds NSPR continuously as part of the Mozilla client.
473# Because NSPR's make depend is not implemented, whenever we change
474# an NSPR header file, the depend build does not recompile the NSPR
475# files that depend on the header.
476#
477# This rule makes all the objects depend on a dummy header file.
478# Touch this dummy header file to force the depend build to recompile
479# everything.
480#
481# This rule should be removed when make depend is implemented.
482#
483
484DUMMY_DEPEND_H = $(topsrcdir)/config/prdepend.h
485
486$(filter $(OBJDIR)/%.$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%.$(OBJ_SUFFIX): $(DUMMY_DEPEND_H)
487
488# END OF HACK
489
490################################################################################
491# Special gmake rules.
492################################################################################
493
494#
495# Re-define the list of default suffixes, so gmake won't have to churn through
496# hundreds of built-in suffix rules for stuff we don't need.
497#
498.SUFFIXES:
499.SUFFIXES: .a .$(OBJ_SUFFIX) .c .cpp .s .h .i .pl
500
501#
502# Fake targets. Always run these rules, even if a file/directory with that
503# name already exists.
504#
505.PHONY: all alltags clean export install libs realclean release
506
507#
508# List the target pattern of an implicit rule as a dependency of the
509# special target .PRECIOUS to preserve intermediate files made by
510# implicit rules whose target patterns match that file's name.
511# (See GNU Make documentation, Edition 0.51, May 1996, Sec. 10.4,
512# p. 107.)
513#
514.PRECIOUS: $(OBJDIR)/%.$(OBJ_SUFFIX)
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette