|
1 #! gmake |
|
2 # |
|
3 # This Source Code Form is subject to the terms of the Mozilla Public |
|
4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
6 |
|
7 ################################################################################ |
|
8 # We used to have a 4 pass build process. Now we do everything in one pass. |
|
9 # |
|
10 # export - Create generated headers and stubs. Publish public headers to |
|
11 # dist/<arch>/include. |
|
12 # Create libraries. Publish libraries to dist/<arch>/lib. |
|
13 # Create programs. |
|
14 # |
|
15 # libs - obsolete. Now a synonym of "export". |
|
16 # |
|
17 # all - the default makefile target. Now a synonym of "export". |
|
18 # |
|
19 # install - Install headers, libraries, and programs on the system. |
|
20 # |
|
21 # Parameters to this makefile (set these before including): |
|
22 # |
|
23 # a) |
|
24 # TARGETS -- the target to create |
|
25 # (defaults to $LIBRARY $PROGRAM) |
|
26 # b) |
|
27 # DIRS -- subdirectories for make to recurse on |
|
28 # (the 'all' rule builds $TARGETS $DIRS) |
|
29 # c) |
|
30 # CSRCS -- .c files to compile |
|
31 # (used to define $OBJS) |
|
32 # d) |
|
33 # PROGRAM -- the target program name to create from $OBJS |
|
34 # ($OBJDIR automatically prepended to it) |
|
35 # e) |
|
36 # LIBRARY -- the target library name to create from $OBJS |
|
37 # ($OBJDIR automatically prepended to it) |
|
38 # |
|
39 ################################################################################ |
|
40 |
|
41 ifndef topsrcdir |
|
42 topsrcdir=$(MOD_DEPTH) |
|
43 endif |
|
44 |
|
45 ifndef srcdir |
|
46 srcdir=. |
|
47 endif |
|
48 |
|
49 ifndef NSPR_CONFIG_MK |
|
50 include $(topsrcdir)/config/config.mk |
|
51 endif |
|
52 |
|
53 ifdef USE_AUTOCONF |
|
54 ifdef CROSS_COMPILE |
|
55 ifdef INTERNAL_TOOLS |
|
56 CC=$(HOST_CC) |
|
57 CCC=$(HOST_CXX) |
|
58 CFLAGS=$(HOST_CFLAGS) |
|
59 CXXFLAGS=$(HOST_CXXFLAGS) |
|
60 LDFLAGS=$(HOST_LDFLAGS) |
|
61 endif |
|
62 endif |
|
63 endif |
|
64 |
|
65 # |
|
66 # This makefile contains rules for building the following kinds of |
|
67 # libraries: |
|
68 # - LIBRARY: a static (archival) library |
|
69 # - SHARED_LIBRARY: a shared (dynamic link) library |
|
70 # - IMPORT_LIBRARY: an import library, used only on Windows and OS/2 |
|
71 # |
|
72 # The names of these libraries can be generated by simply specifying |
|
73 # LIBRARY_NAME and LIBRARY_VERSION. |
|
74 # |
|
75 |
|
76 ifdef LIBRARY_NAME |
|
77 ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH))) |
|
78 |
|
79 # |
|
80 # Win95 and OS/2 require library names conforming to the 8.3 rule. |
|
81 # other platforms do not. |
|
82 # |
|
83 ifeq (,$(filter-out WIN95 WINCE WINMO OS2,$(OS_TARGET))) |
|
84 LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX) |
|
85 SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) |
|
86 IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX) |
|
87 SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb |
|
88 else |
|
89 LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX) |
|
90 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) |
|
91 IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX) |
|
92 SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb |
|
93 endif |
|
94 |
|
95 else |
|
96 |
|
97 LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX) |
|
98 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) |
|
99 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a |
|
100 else |
|
101 ifdef MKSHLIB |
|
102 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) |
|
103 endif |
|
104 endif |
|
105 |
|
106 endif |
|
107 endif |
|
108 |
|
109 ifndef TARGETS |
|
110 ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH))) |
|
111 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) |
|
112 ifdef MOZ_DEBUG_SYMBOLS |
|
113 ifdef MSC_VER |
|
114 ifneq (,$(filter-out 1100 1200,$(MSC_VER))) |
|
115 TARGETS += $(SHARED_LIB_PDB) |
|
116 endif |
|
117 endif |
|
118 endif |
|
119 else |
|
120 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) |
|
121 endif |
|
122 endif |
|
123 |
|
124 # |
|
125 # OBJS is the list of object files. It can be constructed by |
|
126 # specifying CSRCS (list of C source files) and ASFILES (list |
|
127 # of assembly language source files). |
|
128 # |
|
129 |
|
130 ifndef OBJS |
|
131 OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \ |
|
132 $(addprefix $(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))) |
|
133 endif |
|
134 |
|
135 ALL_TRASH = $(TARGETS) $(OBJS) $(RES) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \ |
|
136 $(NOSUCHFILE) \ |
|
137 $(OBJS:.$(OBJ_SUFFIX)=.i_o) \ |
|
138 so_locations |
|
139 |
|
140 ifndef RELEASE_LIBS_DEST |
|
141 RELEASE_LIBS_DEST = $(RELEASE_LIB_DIR) |
|
142 endif |
|
143 |
|
144 define MAKE_IN_DIR |
|
145 $(MAKE) -C $(dir) $@ |
|
146 |
|
147 endef # do not remove the blank line! |
|
148 |
|
149 ifdef DIRS |
|
150 LOOP_OVER_DIRS = $(foreach dir,$(DIRS),$(MAKE_IN_DIR)) |
|
151 endif |
|
152 |
|
153 ################################################################################ |
|
154 |
|
155 all:: export |
|
156 |
|
157 export:: |
|
158 +$(LOOP_OVER_DIRS) |
|
159 |
|
160 libs:: export |
|
161 |
|
162 clean:: |
|
163 rm -rf $(OBJS) $(RES) so_locations $(NOSUCHFILE) $(GARBAGE) |
|
164 +$(LOOP_OVER_DIRS) |
|
165 |
|
166 clobber:: |
|
167 rm -rf $(OBJS) $(RES) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE) |
|
168 +$(LOOP_OVER_DIRS) |
|
169 |
|
170 realclean clobber_all:: |
|
171 rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) |
|
172 +$(LOOP_OVER_DIRS) |
|
173 |
|
174 distclean:: |
|
175 rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE) |
|
176 +$(LOOP_OVER_DIRS) |
|
177 |
|
178 install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS) |
|
179 ifdef RELEASE_BINS |
|
180 $(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir) |
|
181 endif |
|
182 ifdef RELEASE_HEADERS |
|
183 $(NSINSTALL) -t -m 0644 $(RELEASE_HEADERS) $(DESTDIR)$(includedir)/$(include_subdir) |
|
184 endif |
|
185 ifdef RELEASE_LIBS |
|
186 $(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir) |
|
187 endif |
|
188 +$(LOOP_OVER_DIRS) |
|
189 |
|
190 release:: export |
|
191 ifdef RELEASE_BINS |
|
192 @echo "Copying executable programs and scripts to release directory" |
|
193 @if test -z "$(BUILD_NUMBER)"; then \ |
|
194 echo "BUILD_NUMBER must be defined"; \ |
|
195 false; \ |
|
196 else \ |
|
197 true; \ |
|
198 fi |
|
199 @if test ! -d $(RELEASE_BIN_DIR); then \ |
|
200 rm -rf $(RELEASE_BIN_DIR); \ |
|
201 $(NSINSTALL) -D $(RELEASE_BIN_DIR);\ |
|
202 else \ |
|
203 true; \ |
|
204 fi |
|
205 cp $(RELEASE_BINS) $(RELEASE_BIN_DIR) |
|
206 endif |
|
207 ifdef RELEASE_LIBS |
|
208 @echo "Copying libraries to release directory" |
|
209 @if test -z "$(BUILD_NUMBER)"; then \ |
|
210 echo "BUILD_NUMBER must be defined"; \ |
|
211 false; \ |
|
212 else \ |
|
213 true; \ |
|
214 fi |
|
215 @if test ! -d $(RELEASE_LIBS_DEST); then \ |
|
216 rm -rf $(RELEASE_LIBS_DEST); \ |
|
217 $(NSINSTALL) -D $(RELEASE_LIBS_DEST);\ |
|
218 else \ |
|
219 true; \ |
|
220 fi |
|
221 cp $(RELEASE_LIBS) $(RELEASE_LIBS_DEST) |
|
222 endif |
|
223 ifdef RELEASE_HEADERS |
|
224 @echo "Copying header files to release directory" |
|
225 @if test -z "$(BUILD_NUMBER)"; then \ |
|
226 echo "BUILD_NUMBER must be defined"; \ |
|
227 false; \ |
|
228 else \ |
|
229 true; \ |
|
230 fi |
|
231 @if test ! -d $(RELEASE_HEADERS_DEST); then \ |
|
232 rm -rf $(RELEASE_HEADERS_DEST); \ |
|
233 $(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\ |
|
234 else \ |
|
235 true; \ |
|
236 fi |
|
237 cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST) |
|
238 endif |
|
239 +$(LOOP_OVER_DIRS) |
|
240 |
|
241 alltags: |
|
242 rm -f TAGS tags |
|
243 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a |
|
244 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a |
|
245 |
|
246 $(NFSPWD): |
|
247 cd $(@D); $(MAKE) $(@F) |
|
248 |
|
249 $(PROGRAM): $(OBJS) |
|
250 @$(MAKE_OBJDIR) |
|
251 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) |
|
252 ifdef MOZ_PROFILE_USE |
|
253 # In the second pass, we need to merge the pgc files into the pgd file. |
|
254 # The compiler would do this for us automatically if they were in the right |
|
255 # place, but they're in dist/bin. |
|
256 python $(topsrcdir)/build/win32/pgomerge.py \ |
|
257 $(notdir $(PROGRAM:.exe=)) $(DIST)/bin |
|
258 endif # MOZ_PROFILE_USE |
|
259 $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) |
|
260 ifdef MT |
|
261 @if test -f $@.manifest; then \ |
|
262 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ |
|
263 rm -f $@.manifest; \ |
|
264 fi |
|
265 endif # MSVC with manifest tool |
|
266 ifdef MOZ_PROFILE_GENERATE |
|
267 # touch it a few seconds into the future to work around FAT's |
|
268 # 2-second granularity |
|
269 touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink |
|
270 endif # MOZ_PROFILE_GENERATE |
|
271 else # WINNT && !GCC |
|
272 $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(WRAP_LDFLAGS) |
|
273 endif # WINNT && !GCC |
|
274 ifdef ENABLE_STRIP |
|
275 $(STRIP) $@ |
|
276 endif |
|
277 |
|
278 $(LIBRARY): $(OBJS) |
|
279 @$(MAKE_OBJDIR) |
|
280 rm -f $@ |
|
281 $(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS) |
|
282 $(RANLIB) $@ |
|
283 |
|
284 ifeq ($(OS_TARGET), OS2) |
|
285 $(IMPORT_LIBRARY): $(MAPFILE) |
|
286 rm -f $@ |
|
287 $(IMPLIB) $@ $(MAPFILE) |
|
288 else |
|
289 ifeq (,$(filter-out WIN95 WINCE WINMO,$(OS_TARGET))) |
|
290 # PDBs and import libraries need to depend on the shared library to |
|
291 # order dependencies properly. |
|
292 $(IMPORT_LIBRARY): $(SHARED_LIBRARY) |
|
293 $(SHARED_LIB_PDB): $(SHARED_LIBRARY) |
|
294 endif |
|
295 endif |
|
296 |
|
297 $(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) |
|
298 @$(MAKE_OBJDIR) |
|
299 rm -f $@ |
|
300 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) |
|
301 echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms |
|
302 nm -B -C -g $(OBJS) \ |
|
303 | awk '/ [T,D] / {print $$3}' \ |
|
304 | sed -e 's/^\.//' \ |
|
305 | sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms |
|
306 $(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \ |
|
307 -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) |
|
308 else # AIX 4.1 |
|
309 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) |
|
310 ifdef MOZ_PROFILE_USE |
|
311 python $(topsrcdir)/build/win32/pgomerge.py \ |
|
312 $(notdir $(SHARED_LIBRARY:.$(DLL_SUFFIX)=)) $(DIST)/bin |
|
313 endif # MOZ_PROFILE_USE |
|
314 $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES) |
|
315 ifdef MT |
|
316 @if test -f $@.manifest; then \ |
|
317 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \ |
|
318 rm -f $@.manifest; \ |
|
319 fi |
|
320 endif # MSVC with manifest tool |
|
321 ifdef MOZ_PROFILE_GENERATE |
|
322 touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink |
|
323 endif # MOZ_PROFILE_GENERATE |
|
324 else # WINNT && !GCC |
|
325 $(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(WRAP_LDFLAGS) $(EXTRA_LIBS) |
|
326 endif # WINNT && !GCC |
|
327 endif # AIX 4.1 |
|
328 ifdef ENABLE_STRIP |
|
329 $(STRIP) $@ |
|
330 endif |
|
331 |
|
332 ################################################################################ |
|
333 |
|
334 ifdef MOZ_PROFILE_USE |
|
335 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) |
|
336 # When building with PGO, we have to make sure to re-link |
|
337 # in the MOZ_PROFILE_USE phase if we linked in the |
|
338 # MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink |
|
339 # file in the link rule in the GENERATE phase to indicate |
|
340 # that we need a relink. |
|
341 $(SHARED_LIBRARY): pgo.relink |
|
342 |
|
343 $(PROGRAM): pgo.relink |
|
344 |
|
345 endif # WINNT && !GCC |
|
346 endif # MOZ_PROFILE_USE |
|
347 |
|
348 ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE)) |
|
349 ifdef NS_USE_GCC |
|
350 # Force rebuilding libraries and programs in both passes because each |
|
351 # pass uses different object files. |
|
352 $(PROGRAM) $(SHARED_LIBRARY) $(LIBRARY): FORCE |
|
353 .PHONY: FORCE |
|
354 endif |
|
355 endif |
|
356 |
|
357 ################################################################################ |
|
358 |
|
359 ifdef MOZ_PROFILE_GENERATE |
|
360 # Clean up profiling data during PROFILE_GENERATE phase |
|
361 export:: |
|
362 ifeq ($(OS_ARCH)_$(NS_USE_GCC), WINNT_) |
|
363 $(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);) |
|
364 else |
|
365 ifdef NS_USE_GCC |
|
366 -$(RM) *.gcda |
|
367 endif |
|
368 endif |
|
369 endif |
|
370 |
|
371 ################################################################################ |
|
372 |
|
373 ifeq ($(OS_ARCH),WINNT) |
|
374 $(RES): $(RESNAME) |
|
375 @$(MAKE_OBJDIR) |
|
376 # The resource compiler does not understand the -U option. |
|
377 ifdef NS_USE_GCC |
|
378 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $< |
|
379 else |
|
380 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $< |
|
381 endif # GCC |
|
382 @echo $(RES) finished |
|
383 endif |
|
384 |
|
385 $(MAPFILE): $(LIBRARY_NAME).def |
|
386 @$(MAKE_OBJDIR) |
|
387 ifeq ($(OS_ARCH),SunOS) |
|
388 grep -v ';-' $< | \ |
|
389 sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@ |
|
390 endif |
|
391 ifeq ($(OS_ARCH),OS2) |
|
392 echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@ |
|
393 echo PROTMODE >> $@ |
|
394 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@ |
|
395 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@ |
|
396 echo EXPORTS >> $@ |
|
397 grep -v ';+' $< | grep -v ';-' | \ |
|
398 sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \ |
|
399 awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@ |
|
400 $(ADD_TO_DEF_FILE) |
|
401 endif |
|
402 |
|
403 # |
|
404 # Translate source filenames to absolute paths. This is required for |
|
405 # debuggers under Windows and OS/2 to find source files automatically. |
|
406 # |
|
407 |
|
408 ifeq (,$(filter-out AIX OS2,$(OS_ARCH))) |
|
409 NEED_ABSOLUTE_PATH = 1 |
|
410 endif |
|
411 |
|
412 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) |
|
413 NEED_ABSOLUTE_PATH = 1 |
|
414 endif |
|
415 |
|
416 ifdef NEED_ABSOLUTE_PATH |
|
417 # The quotes allow absolute paths to contain spaces. |
|
418 pr_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))" |
|
419 endif |
|
420 |
|
421 $(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp |
|
422 @$(MAKE_OBJDIR) |
|
423 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) |
|
424 $(CCC) -Fo$@ -c $(CCCFLAGS) $(call pr_abspath,$<) |
|
425 else |
|
426 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE) |
|
427 $(CCC) -Fo$@ -c $(CCCFLAGS) $< |
|
428 else |
|
429 ifdef NEED_ABSOLUTE_PATH |
|
430 $(CCC) -o $@ -c $(CCCFLAGS) $(call pr_abspath,$<) |
|
431 else |
|
432 $(CCC) -o $@ -c $(CCCFLAGS) $< |
|
433 endif |
|
434 endif |
|
435 endif |
|
436 |
|
437 WCCFLAGS1 = $(subst /,\\,$(CFLAGS)) |
|
438 WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1)) |
|
439 WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2)) |
|
440 $(OBJDIR)/%.$(OBJ_SUFFIX): %.c |
|
441 @$(MAKE_OBJDIR) |
|
442 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) |
|
443 $(CC) -Fo$@ -c $(CFLAGS) $(call pr_abspath,$<) |
|
444 else |
|
445 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE) |
|
446 $(CC) -Fo$@ -c $(CFLAGS) $< |
|
447 else |
|
448 ifdef NEED_ABSOLUTE_PATH |
|
449 $(CC) -o $@ -c $(CFLAGS) $(call pr_abspath,$<) |
|
450 else |
|
451 $(CC) -o $@ -c $(CFLAGS) $< |
|
452 endif |
|
453 endif |
|
454 endif |
|
455 |
|
456 |
|
457 $(OBJDIR)/%.$(OBJ_SUFFIX): %.s |
|
458 @$(MAKE_OBJDIR) |
|
459 $(AS) -o $@ $(ASFLAGS) -c $< |
|
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 |
|
484 DUMMY_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 # Disallow parallel builds with MSVC < 8 since it can't open the PDB file in |
|
496 # parallel. |
|
497 # |
|
498 ifeq (,$(filter-out 1200 1300 1310,$(MSC_VER))) |
|
499 .NOTPARALLEL: |
|
500 endif |
|
501 |
|
502 # |
|
503 # Re-define the list of default suffixes, so gmake won't have to churn through |
|
504 # hundreds of built-in suffix rules for stuff we don't need. |
|
505 # |
|
506 .SUFFIXES: |
|
507 .SUFFIXES: .a .$(OBJ_SUFFIX) .c .cpp .s .h .i .pl |
|
508 |
|
509 # |
|
510 # Fake targets. Always run these rules, even if a file/directory with that |
|
511 # name already exists. |
|
512 # |
|
513 .PHONY: all alltags clean export install libs realclean release |
|
514 |
|
515 # |
|
516 # List the target pattern of an implicit rule as a dependency of the |
|
517 # special target .PRECIOUS to preserve intermediate files made by |
|
518 # implicit rules whose target patterns match that file's name. |
|
519 # (See GNU Make documentation, Edition 0.51, May 1996, Sec. 10.4, |
|
520 # p. 107.) |
|
521 # |
|
522 .PRECIOUS: $(OBJDIR)/%.$(OBJ_SUFFIX) |