Bug 591874 - windows screen readers are broken due to post-130078 changes in the...
[mozilla-central.git] / security / coreconf / rules.mk
blob01b4fc24cbfff0db6f940663773540c0644389df
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Original Code is the Netscape security libraries.
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1994-2000
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
38 #######################################################################
39 ### ###
40 ### R U L E S O F E N G A G E M E N T ###
41 ### ###
42 #######################################################################
44 #######################################################################
45 # Double-Colon rules for utilizing the binary release model. #
46 #######################################################################
48 all:: export libs
50 ifeq ($(AUTOCLEAN),1)
51 autobuild:: clean export private_export libs program install
52 else
53 autobuild:: export private_export libs program install
54 endif
56 platform::
57 @echo $(OBJDIR_NAME)
59 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
60 USE_NT_C_SYNTAX=1
61 endif
64 # IMPORTS will always be associated with a component. Therefore,
65 # the "import" rule will always change directory to the top-level
66 # of a component, and traverse the IMPORTS keyword from the
67 # "manifest.mn" file located at this level only.
69 # note: if there is a trailing slash, the component will be appended
70 # (see import.pl - only used for xpheader.jar)
72 import::
73 @echo "== import.pl =="
74 @$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/import.pl \
75 "RELEASE_TREE=$(RELEASE_TREE)" \
76 "IMPORTS=$(IMPORTS)" \
77 "VERSION=$(VERSION)" \
78 "OS_ARCH=$(OS_ARCH)" \
79 "PLATFORM=$(PLATFORM)" \
80 "OVERRIDE_IMPORT_CHECK=$(OVERRIDE_IMPORT_CHECK)" \
81 "ALLOW_VERSION_OVERRIDE=$(ALLOW_VERSION_OVERRIDE)" \
82 "SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
83 "SOURCE_MD_DIR=$(SOURCE_MD_DIR)" \
84 "SOURCE_XP_DIR=$(SOURCE_XP_DIR)" \
85 "FILES=$(IMPORT_XPCLASS_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
86 "$(IMPORT_XPCLASS_JAR)=$(IMPORT_XP_DIR)|$(IMPORT_XPCLASS_DIR)|" \
87 "$(XPHEADER_JAR)=$(IMPORT_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \
88 "$(MDHEADER_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)/include|" \
89 "$(MDBINARY_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)|"
90 # On Mac OS X ranlib needs to be rerun after static libs are moved.
91 ifeq ($(OS_TARGET),Darwin)
92 find $(SOURCE_MD_DIR)/lib -name "*.a" -exec $(RANLIB) {} \;
93 endif
95 export::
96 +$(LOOP_OVER_DIRS)
98 private_export::
99 +$(LOOP_OVER_DIRS)
101 release_export::
102 +$(LOOP_OVER_DIRS)
104 release_classes::
105 +$(LOOP_OVER_DIRS)
107 libs program install:: $(TARGETS)
108 ifdef LIBRARY
109 $(INSTALL) -m 664 $(LIBRARY) $(SOURCE_LIB_DIR)
110 endif
111 ifdef SHARED_LIBRARY
112 $(INSTALL) -m 775 $(SHARED_LIBRARY) $(SOURCE_LIB_DIR)
113 ifdef MOZ_DEBUG_SYMBOLS
114 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
115 $(INSTALL) -m 644 $(SHARED_LIBRARY:$(DLL_SUFFIX)=pdb) $(SOURCE_LIB_DIR)
116 endif
117 endif
118 endif
119 ifdef IMPORT_LIBRARY
120 $(INSTALL) -m 775 $(IMPORT_LIBRARY) $(SOURCE_LIB_DIR)
121 endif
122 ifdef PROGRAM
123 $(INSTALL) -m 775 $(PROGRAM) $(SOURCE_BIN_DIR)
124 ifdef MOZ_DEBUG_SYMBOLS
125 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
126 $(INSTALL) -m 644 $(PROGRAM:$(PROG_SUFFIX)=.pdb) $(SOURCE_BIN_DIR)
127 endif
128 endif
129 endif
130 ifdef PROGRAMS
131 $(INSTALL) -m 775 $(PROGRAMS) $(SOURCE_BIN_DIR)
132 endif
133 +$(LOOP_OVER_DIRS)
135 tests::
136 +$(LOOP_OVER_DIRS)
138 clean clobber::
139 rm -rf $(ALL_TRASH)
140 +$(LOOP_OVER_DIRS)
142 realclean clobber_all::
143 rm -rf $(wildcard *.OBJ) dist $(ALL_TRASH)
144 +$(LOOP_OVER_DIRS)
146 #######################################################################
147 # Double-Colon rules for populating the binary release model. #
148 #######################################################################
151 release_clean::
152 rm -rf $(SOURCE_XP_DIR)/release/$(RELEASE_MD_DIR)
154 release:: release_clean release_export release_classes release_policy release_md release_jars release_cpdistdir
156 release_cpdistdir::
157 @echo "== cpdist.pl =="
158 @$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/cpdist.pl \
159 "RELEASE_TREE=$(RELEASE_TREE)" \
160 "CORE_DEPTH=$(CORE_DEPTH)" \
161 "MODULE=${MODULE}" \
162 "OS_ARCH=$(OS_ARCH)" \
163 "RELEASE=$(RELEASE)" \
164 "PLATFORM=$(PLATFORM)" \
165 "RELEASE_VERSION=$(RELEASE_VERSION)" \
166 "SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
167 "RELEASE_XP_DIR=$(RELEASE_XP_DIR)" \
168 "RELEASE_MD_DIR=$(RELEASE_MD_DIR)" \
169 "FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR) XP_FILES MD_FILES" \
170 "$(XPCLASS_JAR)=$(SOURCE_RELEASE_CLASSES_DIR)|x"\
171 "$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_CLASSES_DBG_DIR)|x"\
172 "$(XPHEADER_JAR)=$(SOURCE_RELEASE_XPHEADERS_DIR)|x" \
173 "$(MDHEADER_JAR)=$(SOURCE_RELEASE_MDHEADERS_DIR)|m" \
174 "$(MDBINARY_JAR)=$(SOURCE_RELEASE_MD_DIR)|m" \
175 "XP_FILES=$(XP_FILES)|xf" \
176 "MD_FILES=$(MD_FILES)|mf"
179 # $(SOURCE_RELEASE_xxx_JAR) is a name like yyy.jar
180 # $(SOURCE_RELEASE_xx_DIR) is a name like
182 release_jars::
183 @echo "== release.pl =="
184 @$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/release.pl \
185 "RELEASE_TREE=$(RELEASE_TREE)" \
186 "PLATFORM=$(PLATFORM)" \
187 "OS_ARCH=$(OS_ARCH)" \
188 "RELEASE_VERSION=$(RELEASE_VERSION)" \
189 "SOURCE_RELEASE_DIR=$(SOURCE_RELEASE_DIR)" \
190 "FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
191 "$(XPCLASS_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)|b"\
192 "$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)|b"\
193 "$(XPHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_XPHEADERS_DIR)|a" \
194 "$(MDHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MDHEADERS_DIR)|a" \
195 "$(MDBINARY_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MD_DIR)|bi"
197 # Rules for releasing classes.
198 # We have to do some REALLY gross stuff to deal with multiple classes in one
199 # file, as well as nested classes, which have a filename of the form
200 # ContainingClass$NestedClass.class.
201 # RELEASE_CLASSES simply performs a required patsubst on CLASSES
202 # RELEASE_CLASS_PATH is RELEASE_CLASSES with the path (in ns/dist) prepended
203 # RELEASE_NESTED is all the nested classes in RELEASE_CLASS_PATH. We use a
204 # foreach and wildcard to get all the files that start out like one of the
205 # class files, then have a $. So, for each class file, we look for file$*
206 # RELEASE_FILES is the combination of RELEASE_NESTED and the class files
207 # specified by RELEASE_CLASSES which have .class appended to them. Note that
208 # the RELEASE_NESTED don't need to have .class appended because they were
209 # read in from the wildcard as complete filenames.
211 # The _DBG versions are the debuggable ones.
212 ifneq ($(CLASSES),)
214 RELEASE_CLASSES := $(patsubst %,%,$(CLASSES))
216 ifdef BUILD_OPT
217 RELEASE_CLASS_PATH := $(patsubst %,$(SOURCE_CLASSES_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES))
218 RELEASE_NESTED := $(foreach file,$(RELEASE_CLASS_PATH),$(wildcard $(file)$$*))
219 RELEASE_FILES := $(patsubst %,%.class,$(RELEASE_CLASS_PATH)) $(RELEASE_NESTED)
220 else
221 RELEASE_DBG_CLASS_PATH:= $(patsubst %,$(SOURCE_CLASSES_DBG_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES))
222 RELEASE_DBG_NESTED := $(foreach file,$(RELEASE_DBG_CLASS_PATH),$(wildcard $(file)$$*))
223 RELEASE_DBG_FILES := $(patsubst %,%.class,$(RELEASE_DBG_CLASS_PATH)) $(RELEASE_DBG_NESTED)
224 endif
226 # Substitute \$ for $ so the shell doesn't choke
227 ifdef BUILD_OPT
228 release_classes::
229 $(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)/$(PACKAGE)
230 else
231 release_classes::
232 $(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_DBG_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)/$(PACKAGE)
233 endif
235 endif
237 release_policy::
238 +$(LOOP_OVER_DIRS)
240 ifndef NO_MD_RELEASE
241 ifdef LIBRARY
242 MD_LIB_RELEASE_FILES += $(LIBRARY)
243 endif
244 ifdef SHARED_LIBRARY
245 MD_LIB_RELEASE_FILES += $(SHARED_LIBRARY)
246 endif
247 ifdef IMPORT_LIBRARY
248 MD_LIB_RELEASE_FILES += $(IMPORT_LIBRARY)
249 endif
250 ifdef PROGRAM
251 MD_BIN_RELEASE_FILES += $(PROGRAM)
252 endif
253 ifdef PROGRAMS
254 MD_BIN_RELEASE_FILES += $(PROGRAMS)
255 endif
256 endif
258 release_md::
259 ifneq ($(MD_LIB_RELEASE_FILES),)
260 $(INSTALL) -m 444 $(MD_LIB_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)
261 endif
262 ifneq ($(MD_BIN_RELEASE_FILES),)
263 $(INSTALL) -m 555 $(MD_BIN_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_BIN_DIR)
264 endif
265 +$(LOOP_OVER_DIRS)
268 alltags:
269 rm -f TAGS
270 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
271 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
273 $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
274 @$(MAKE_OBJDIR)
275 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
276 $(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)) $(EXTRA_EXE_LD_FLAGS)
277 ifdef MT
278 if test -f $@.manifest; then \
279 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
280 rm -f $@.manifest; \
282 endif # MSVC with manifest tool
283 else
284 $(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
285 endif
287 get_objs:
288 @echo $(OBJS)
290 $(LIBRARY): $(OBJS)
291 @$(MAKE_OBJDIR)
292 rm -f $@
293 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
294 $(AR) $(subst /,\\,$(OBJS))
295 else
296 $(AR) $(OBJS)
297 endif
298 $(RANLIB) $@
301 ifeq ($(OS_TARGET),OS2)
302 $(IMPORT_LIBRARY): $(MAPFILE)
303 rm -f $@
304 $(IMPLIB) $@ $<
305 $(RANLIB) $@
306 endif
308 ifdef SHARED_LIBRARY_LIBS
309 ifdef BUILD_TREE
310 SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(shell $(MAKE) -C $(dir) --no-print-directory get_objs))
311 else
312 SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(addprefix $(dir)/,$(shell $(MAKE) -C $(dir) --no-print-directory get_objs)))
313 endif
314 endif
316 $(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) $(SUB_SHLOBJS)
317 @$(MAKE_OBJDIR)
318 rm -f $@
319 ifeq ($(OS_TARGET)$(OS_RELEASE), AIX4.1)
320 echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
321 nm -B -C -g $(OBJS) \
322 | awk '/ [T,D] / {print $$3}' \
323 | sed -e 's/^\.//' \
324 | sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
325 $(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
326 -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS)
327 else
328 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
329 ifdef NS_USE_GCC
330 $(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
331 else
332 $(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
333 ifdef MT
334 if test -f $@.manifest; then \
335 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
336 rm -f $@.manifest; \
338 endif # MSVC with manifest tool
339 endif
340 else
341 $(MKSHLIB) -o $@ $(OBJS) $(SUB_SHLOBJS) $(LD_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
342 chmod +x $@
343 ifeq ($(OS_TARGET),Darwin)
344 ifdef MAPFILE
345 nmedit -s $(MAPFILE) $@
346 endif
347 endif
348 endif
349 endif
351 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
352 $(RES): $(RESNAME)
353 @$(MAKE_OBJDIR)
354 # The resource compiler does not understand the -U option.
355 ifdef NS_USE_GCC
356 $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
357 else
358 $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
359 endif
360 @echo $(RES) finished
361 endif
363 $(MAPFILE): $(MAPFILE_SOURCE)
364 @$(MAKE_OBJDIR)
365 $(PROCESS_MAP_FILE)
368 $(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX)
369 @$(MAKE_OBJDIR)
370 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
371 $(MKPROG) $< -Fe$@ -link \
372 $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(EXTRA_EXE_LD_FLAGS)
373 ifdef MT
374 if test -f $@.manifest; then \
375 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
376 rm -f $@.manifest; \
378 endif # MSVC with manifest tool
379 else
380 $(MKPROG) -o $@ $(CFLAGS) $< \
381 $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
382 endif
384 WCCFLAGS1 := $(subst /,\\,$(CFLAGS))
385 WCCFLAGS2 := $(subst -I,-i=,$(WCCFLAGS1))
386 WCCFLAGS3 := $(subst -D,-d,$(WCCFLAGS2))
388 # Translate source filenames to absolute paths. This is required for
389 # debuggers under Windows & OS/2 to find source files automatically
391 ifeq (,$(filter-out OS2 AIX,$(OS_TARGET)))
392 # OS/2 and AIX
393 NEED_ABSOLUTE_PATH := 1
394 PWD := $(shell pwd)
396 else
397 # Windows
398 ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
399 NEED_ABSOLUTE_PATH := 1
400 PWD := $(shell pwd)
401 ifeq (,$(findstring ;,$(PATH)))
402 ifndef USE_MSYS
403 PWD := $(subst \,/,$(shell cygpath -w $(PWD)))
404 endif
405 endif
407 else
408 # everything else
409 PWD := $(shell pwd)
410 endif
411 endif
413 # The quotes allow absolute paths to contain spaces.
414 core_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))"
416 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
417 @$(MAKE_OBJDIR)
418 ifdef USE_NT_C_SYNTAX
419 $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
420 else
421 ifdef NEED_ABSOLUTE_PATH
422 $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
423 else
424 $(CC) -o $@ -c $(CFLAGS) $<
425 endif
426 endif
428 $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
429 ifdef USE_NT_C_SYNTAX
430 $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
431 else
432 ifdef NEED_ABSOLUTE_PATH
433 $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
434 else
435 $(CC) -o $@ -c $(CFLAGS) $<
436 endif
437 endif
439 ifneq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
440 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s
441 @$(MAKE_OBJDIR)
442 $(AS) -o $@ $(ASFLAGS) -c $<
443 endif
445 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.asm
446 @$(MAKE_OBJDIR)
447 $(AS) -Fo$@ $(ASFLAGS) -c $<
449 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S
450 @$(MAKE_OBJDIR)
451 $(AS) -o $@ $(ASFLAGS) -c $<
453 $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
454 @$(MAKE_OBJDIR)
455 ifdef USE_NT_C_SYNTAX
456 $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
457 else
458 ifdef NEED_ABSOLUTE_PATH
459 $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
460 else
461 $(CCC) -o $@ -c $(CFLAGS) $<
462 endif
463 endif
466 # Please keep the next two rules in sync.
468 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc
469 @$(MAKE_OBJDIR)
470 $(CCC) -o $@ -c $(CFLAGS) $<
472 $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp
473 @$(MAKE_OBJDIR)
474 ifdef STRICT_CPLUSPLUS_SUFFIX
475 echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
476 $(CCC) -o $@ -c $(CFLAGS) $(OBJDIR)/t_$*.cc
477 rm -f $(OBJDIR)/t_$*.cc
478 else
479 ifdef USE_NT_C_SYNTAX
480 $(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
481 else
482 ifdef NEED_ABSOLUTE_PATH
483 $(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
484 else
485 $(CCC) -o $@ -c $(CFLAGS) $<
486 endif
487 endif
488 endif #STRICT_CPLUSPLUS_SUFFIX
490 %.i: %.cpp
491 $(CCC) -C -E $(CFLAGS) $< > $@
493 %.i: %.c
494 ifeq (,$(filter-out WIN%,$(OS_TARGET)))
495 $(CC) -C /P $(CFLAGS) $<
496 else
497 $(CC) -C -E $(CFLAGS) $< > $@
498 endif
500 ifneq (,$(filter-out WIN%,$(OS_TARGET)))
501 %.i: %.s
502 $(CC) -C -E $(CFLAGS) $< > $@
503 endif
505 %: %.pl
506 rm -f $@; cp $< $@; chmod +x $@
508 %: %.sh
509 rm -f $@; cp $< $@; chmod +x $@
511 ifdef DIRS
512 $(DIRS)::
513 @if test -d $@; then \
514 set $(EXIT_ON_ERROR); \
515 echo "cd $@; $(MAKE)"; \
516 cd $@; $(MAKE); \
517 set +e; \
518 else \
519 echo "Skipping non-directory $@..."; \
520 fi; \
521 $(CLICK_STOPWATCH)
522 endif
524 ################################################################################
525 # Bunch of things that extend the 'export' rule (in order):
526 ################################################################################
528 $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR)::
529 @if test ! -d $@; then \
530 echo Creating $@; \
531 rm -rf $@; \
532 $(NSINSTALL) -D $@; \
535 ################################################################################
536 ## IDL_GEN
538 ifneq ($(IDL_GEN),)
540 #export::
541 # $(IDL2JAVA) $(IDL_GEN)
543 #all:: export
545 #clobber::
546 # rm -f $(IDL_GEN:.idl=.class) # XXX wrong!
548 endif
550 ################################################################################
551 ### JSRCS -- for compiling java files
553 ### NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
554 ### replace $(CORE_DEPTH) with $(NETLIBDEPTH).
557 ifneq ($(JSRCS),)
558 ifneq ($(JAVAC),)
559 ifdef NETLIBDEPTH
560 CORE_DEPTH := $(NETLIBDEPTH)
561 endif
563 JAVA_EXPORT_SRCS=$(shell $(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) -d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS) $(PRIVATE_JSRCS))
565 export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
566 ifneq ($(JAVA_EXPORT_SRCS),)
567 $(JAVAC) $(JAVA_EXPORT_SRCS)
568 endif
570 all:: export
572 clobber::
573 rm -f $(SOURCE_XP_DIR)/classes/$(PACKAGE)/*.class
575 endif
576 endif
579 # JDIRS -- like JSRCS, except you can give a list of directories and it will
580 # compile all the out-of-date java files in those directories.
582 # NOTE: recursing through these can speed things up, but they also cause
583 # some builds to run out of memory
585 # NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
586 # replace $(CORE_DEPTH) with $(NETLIBDEPTH).
588 ifdef JDIRS
589 ifneq ($(JAVAC),)
590 ifdef NETLIBDEPTH
591 CORE_DEPTH := $(NETLIBDEPTH)
592 endif
594 # !!!!! THIS WILL CRASH SHMSDOS.EXE !!!!!
595 # shmsdos does not support shell variables. It will crash when it tries
596 # to parse the '=' character. A solution is to rewrite outofdate.pl so it
597 # takes the Javac command as an argument and executes the command itself,
598 # instead of returning a list of files.
599 export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
600 @echo "!!! THIS COMMAND IS BROKEN ON WINDOWS--SEE rules.mk FOR DETAILS !!!"
601 return -1
602 @for d in $(JDIRS); do \
603 if test -d $$d; then \
604 set $(EXIT_ON_ERROR); \
605 files=`echo $$d/*.java`; \
606 list=`$(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) \
607 -d $(JAVA_DESTPATH)/$(PACKAGE) $$files`; \
608 if test "$${list}x" != "x"; then \
609 echo Building all java files in $$d; \
610 echo $(JAVAC) $$list; \
611 $(JAVAC) $$list; \
612 fi; \
613 set +e; \
614 else \
615 echo "Skipping non-directory $$d..."; \
616 fi; \
617 $(CLICK_STOPWATCH); \
618 done
619 endif
620 endif
623 # JDK_GEN -- for generating "old style" native methods
625 # Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
627 # NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
628 # replace $(CORE_DEPTH) with $(NETLIBDEPTH).
630 ifneq ($(JDK_GEN),)
631 ifneq ($(JAVAH),)
632 ifdef NSBUILDROOT
633 INCLUDES += -I$(JDK_GEN_DIR) -I$(SOURCE_XP_DIR)
634 else
635 INCLUDES += -I$(JDK_GEN_DIR)
636 endif
638 ifdef NETLIBDEPTH
639 CORE_DEPTH := $(NETLIBDEPTH)
640 endif
642 JDK_PACKAGE_CLASSES := $(JDK_GEN)
643 JDK_PATH_CLASSES := $(subst .,/,$(JDK_PACKAGE_CLASSES))
644 JDK_HEADER_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
645 JDK_STUB_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
646 JDK_HEADER_CFILES := $(patsubst %,$(JDK_GEN_DIR)/%.h,$(JDK_GEN))
647 JDK_STUB_CFILES := $(patsubst %,$(JDK_STUB_DIR)/%.c,$(JDK_GEN))
649 $(JDK_HEADER_CFILES): $(JDK_HEADER_CLASSFILES)
650 $(JDK_STUB_CFILES): $(JDK_STUB_CLASSFILES)
652 export::
653 @echo Generating/Updating JDK headers
654 $(JAVAH) -d $(JDK_GEN_DIR) $(JDK_PACKAGE_CLASSES)
655 @echo Generating/Updating JDK stubs
656 $(JAVAH) -stubs -d $(JDK_STUB_DIR) $(JDK_PACKAGE_CLASSES)
657 ifndef NO_MAC_JAVA_SHIT
658 @if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then \
659 echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
660 echo "!!! This allows us to automatically update generated files for the mac."; \
661 echo "!!! If you see any modified files there, please check them in."; \
663 @echo Generating/Updating JDK headers for the Mac
664 $(JAVAH) -mac -d $(CORE_DEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES)
665 @echo Generating/Updating JDK stubs for the Mac
666 $(JAVAH) -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES)
667 endif
668 endif
669 endif
672 # JRI_GEN -- for generating "old style" JRI native methods
674 # Generate JRI Headers and Stubs into the 'jri' directory
676 # NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
677 # replace $(CORE_DEPTH) with $(NETLIBDEPTH).
679 ifneq ($(JRI_GEN),)
680 ifneq ($(JAVAH),)
681 ifdef NSBUILDROOT
682 INCLUDES += -I$(JRI_GEN_DIR) -I$(SOURCE_XP_DIR)
683 else
684 INCLUDES += -I$(JRI_GEN_DIR)
685 endif
687 ifdef NETLIBDEPTH
688 CORE_DEPTH := $(NETLIBDEPTH)
689 endif
691 JRI_PACKAGE_CLASSES := $(JRI_GEN)
692 JRI_PATH_CLASSES := $(subst .,/,$(JRI_PACKAGE_CLASSES))
693 JRI_HEADER_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES))
694 JRI_STUB_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES))
695 JRI_HEADER_CFILES := $(patsubst %,$(JRI_GEN_DIR)/%.h,$(JRI_GEN))
696 JRI_STUB_CFILES := $(patsubst %,$(JRI_GEN_DIR)/%.c,$(JRI_GEN))
698 $(JRI_HEADER_CFILES): $(JRI_HEADER_CLASSFILES)
699 $(JRI_STUB_CFILES): $(JRI_STUB_CLASSFILES)
701 export::
702 @echo Generating/Updating JRI headers
703 $(JAVAH) -jri -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
704 @echo Generating/Updating JRI stubs
705 $(JAVAH) -jri -stubs -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
706 ifndef NO_MAC_JAVA_SHIT
707 @if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then \
708 echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
709 echo "!!! This allows us to automatically update generated files for the mac."; \
710 echo "!!! If you see any modified files there, please check them in."; \
712 @echo Generating/Updating JRI headers for the Mac
713 $(JAVAH) -jri -mac -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
714 @echo Generating/Updating JRI stubs for the Mac
715 $(JAVAH) -jri -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
716 endif
717 endif
718 endif
721 # JNI_GEN -- for generating JNI native methods
723 # Generate JNI Headers into the 'jni' directory
725 ifneq ($(JNI_GEN),)
726 ifneq ($(JAVAH),)
727 JNI_HEADERS := $(patsubst %,$(JNI_GEN_DIR)/%.h,$(JNI_GEN))
729 export::
730 @if test ! -d $(JNI_GEN_DIR); then \
731 echo $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \
732 $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \
733 else \
734 echo "Checking for out of date header files" ; \
735 $(PERL) $(CORE_DEPTH)/coreconf/jniregen.pl $(PERLARG) \
736 -d $(JAVA_DESTPATH) -j "$(JAVAH) -jni -d $(JNI_GEN_DIR)" $(JNI_GEN);\
738 endif
739 endif
742 # JMC_EXPORT -- for declaring which java classes are to be exported for jmc
744 ifneq ($(JMC_EXPORT),)
745 JMC_EXPORT_PATHS := $(subst .,/,$(JMC_EXPORT))
746 JMC_EXPORT_FILES := $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS))
749 # We're doing NSINSTALL -t here (copy mode) because calling INSTALL will pick up
750 # your NSDISTMODE and make links relative to the current directory. This is a
751 # problem because the source isn't in the current directory:
753 export:: $(JMC_EXPORT_FILES) $(JMCSRCDIR)
754 $(NSINSTALL) -t -m 444 $(JMC_EXPORT_FILES) $(JMCSRCDIR)
755 endif
758 # JMC_GEN -- for generating java modules
760 # Provide default export & install rules when using JMC_GEN
762 ifneq ($(JMC_GEN),)
763 ifneq ($(JMC),)
764 INCLUDES += -I$(JMC_GEN_DIR) -I.
765 JMC_HEADERS := $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN))
766 JMC_STUBS := $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN))
767 JMC_OBJS := $(patsubst %,$(OBJDIR)/%$(OBJ_SUFFIX),$(JMC_GEN))
769 $(JMC_GEN_DIR)/M%.h: $(JMCSRCDIR)/%.class
770 $(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)
772 $(JMC_GEN_DIR)/M%.c: $(JMCSRCDIR)/%.class
773 $(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)
775 $(OBJDIR)/M%$(OBJ_SUFFIX): $(JMC_GEN_DIR)/M%.c $(JMC_GEN_DIR)/M%.h
776 @$(MAKE_OBJDIR)
777 $(CC) -o $@ -c $(CFLAGS) $<
779 export:: $(JMC_HEADERS) $(JMC_STUBS)
780 endif
781 endif
784 # Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/
786 PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE)
788 ifneq ($(EXPORTS),)
789 $(PUBLIC_EXPORT_DIR)::
790 @if test ! -d $@; then \
791 echo Creating $@; \
792 $(NSINSTALL) -D $@; \
795 export:: $(PUBLIC_EXPORT_DIR)
797 export:: $(EXPORTS)
798 $(INSTALL) -m 444 $^ $(PUBLIC_EXPORT_DIR)
800 export:: $(BUILT_SRCS)
801 endif
803 # Duplicate export rule for private exports, with different directories
805 PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/private/$(MODULE)
807 ifneq ($(PRIVATE_EXPORTS),)
808 $(PRIVATE_EXPORT_DIR)::
809 @if test ! -d $@; then \
810 echo Creating $@; \
811 $(NSINSTALL) -D $@; \
814 private_export:: $(PRIVATE_EXPORT_DIR)
816 private_export:: $(PRIVATE_EXPORTS)
817 $(INSTALL) -m 444 $^ $(PRIVATE_EXPORT_DIR)
818 else
819 private_export::
820 @echo There are no private exports.;
821 endif
823 ##########################################################################
824 ### RULES FOR RUNNING REGRESSION SUITE TESTS
825 ### REQUIRES 'REGRESSION_SPEC' TO BE SET TO THE NAME OF A REGRESSION SPECFILE
826 ### AND RESULTS_SUBDIR TO BE SET TO SOMETHING LIKE SECURITY/PKCS5
827 ##########################################################################
829 TESTS_DIR = $(RESULTS_DIR)/$(RESULTS_SUBDIR)/$(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)
831 ifneq ($(REGRESSION_SPEC),)
833 ifneq ($(BUILD_OPT),)
834 REGDATE = $(subst \ ,, $(shell $(PERL) $(CORE_DEPTH)/$(MODULE)/scripts/now))
835 endif
837 tests:: $(REGRESSION_SPEC)
838 cd $(PLATFORM); \
839 ../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS); \
840 if test ! -d $(TESTS_DIR); then \
841 echo Creating $(TESTS_DIR); \
842 $(NSINSTALL) -D $(TESTS_DIR); \
844 ifneq ($(BUILD_OPT),)
845 $(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).sum $(TESTS_DIR); \
846 $(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).htm $(TESTS_DIR); \
847 echo "Please now make sure your results files are copied to $(TESTS_DIR), "; \
848 echo "then run 'reporter specfile=$(RESULTS_DIR)/rptspec'"
849 endif
850 else
851 tests::
852 @echo Error: you didn't specify REGRESSION_SPEC in your manifest.mn file!;
853 endif
856 # Duplicate export rule for releases, with different directories
858 ifneq ($(EXPORTS),)
859 $(SOURCE_RELEASE_XP_DIR)/include::
860 @if test ! -d $@; then \
861 echo Creating $@; \
862 $(NSINSTALL) -D $@; \
865 release_export:: $(SOURCE_RELEASE_XP_DIR)/include
867 release_export:: $(EXPORTS)
868 $(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include
869 endif
874 ################################################################################
876 -include $(DEPENDENCIES)
878 ifneq (,$(filter-out OS2 WIN%,$(OS_TARGET)))
879 # Can't use sed because of its 4000-char line length limit, so resort to perl
880 PERL_DEPENDENCIES_PROGRAM = \
881 open(MD, "< $(DEPENDENCIES)"); \
882 while (<MD>) { \
883 if (m@ \.*/*$< @) { \
884 $$found = 1; \
885 last; \
888 if ($$found) { \
889 print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \
890 seek(MD, 0, 0); \
891 $$tmpname = "$(OBJDIR)/fix.md" . $$$$; \
892 open(TMD, "> " . $$tmpname); \
893 while (<MD>) { \
894 s@ \.*/*$< @ @; \
895 if (!print TMD "$$_") { \
896 unlink(($$tmpname)); \
897 exit(1); \
900 close(TMD); \
901 if (!rename($$tmpname, "$(DEPENDENCIES)")) { \
902 unlink(($$tmpname)); \
904 } elsif ("$<" ne "$(DEPENDENCIES)") { \
905 print "$(MAKE): *** No rule to make target $<. Stop.\n"; \
906 exit(1); \
909 .DEFAULT:
910 @$(PERL) -e '$(PERL_DEPENDENCIES_PROGRAM)'
911 endif
913 #############################################################################
914 # X dependency system
915 #############################################################################
917 ifdef MKDEPENDENCIES
919 # For Windows, $(MKDEPENDENCIES) must be -included before including rules.mk
921 $(MKDEPENDENCIES)::
922 @$(MAKE_OBJDIR)
923 touch $(MKDEPENDENCIES)
924 chmod u+w $(MKDEPENDENCIES)
925 #on NT, the preceding touch command creates a read-only file !?!?!
926 #which is why we have to explicitly chmod it.
927 $(MKDEPEND) -p$(OBJDIR_NAME)/ -o'$(OBJ_SUFFIX)' -f$(MKDEPENDENCIES) \
928 $(NOMD_CFLAGS) $(YOPT) $(CSRCS) $(CPPSRCS) $(ASFILES)
930 $(MKDEPEND):: $(MKDEPEND_DIR)/*.c $(MKDEPEND_DIR)/*.h
931 cd $(MKDEPEND_DIR); $(MAKE)
933 ifdef OBJS
934 depend:: $(MKDEPEND) $(MKDEPENDENCIES)
935 else
936 depend::
937 endif
938 +$(LOOP_OVER_DIRS)
940 dependclean::
941 rm -f $(MKDEPENDENCIES)
942 +$(LOOP_OVER_DIRS)
944 #-include $(NSINSTALL_DIR)/$(OBJDIR)/depend.mk
946 else
947 depend::
948 endif
951 # HACK ALERT
953 # The only purpose of this rule is to pass Mozilla's Tinderbox depend
954 # builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's
955 # Tinderbox builds NSS continuously as part of the Mozilla client.
956 # Because NSS's make depend is not implemented, whenever we change
957 # an NSS header file, the depend build does not recompile the NSS
958 # files that depend on the header.
960 # This rule makes all the objects depend on a dummy header file.
961 # Check in a change to this dummy header file to force the depend
962 # build to recompile everything.
964 # This rule should be removed when make depend is implemented.
967 DUMMY_DEPEND = $(CORE_DEPTH)/coreconf/coreconf.dep
969 $(filter $(OBJDIR)/%$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%$(OBJ_SUFFIX): $(DUMMY_DEPEND)
971 # END OF HACK
973 ################################################################################
974 # Special gmake rules.
975 ################################################################################
978 # Re-define the list of default suffixes, so gmake won't have to churn through
979 # hundreds of built-in suffix rules for stuff we don't need.
981 .SUFFIXES:
982 .SUFFIXES: .out .a .ln .o .obj .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .class .java .html .asm .dep
985 # Don't delete these files if we get killed.
987 .PRECIOUS: .java $(JDK_HEADERS) $(JDK_STUBS) $(JRI_HEADERS) $(JRI_STUBS) $(JMC_HEADERS) $(JMC_STUBS) $(JNI_HEADERS)
990 # Fake targets. Always run these rules, even if a file/directory with that
991 # name already exists.
993 .PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs program realclean release $(OBJDIR) $(DIRS)