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
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.
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 #######################################################################
40 ### R U L E S O F E N G A G E M E N T ###
42 #######################################################################
44 #######################################################################
45 # Double-Colon rules for utilizing the binary release model. #
46 #######################################################################
51 autobuild
:: clean export private_export libs program
install
53 autobuild
:: export private_export libs program
install
59 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
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)
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
) {} \
;
107 libs program
install:: $(TARGETS
)
109 $(INSTALL
) -m
664 $(LIBRARY
) $(SOURCE_LIB_DIR
)
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
)
120 $(INSTALL
) -m
775 $(IMPORT_LIBRARY
) $(SOURCE_LIB_DIR
)
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
)
131 $(INSTALL
) -m
775 $(PROGRAMS
) $(SOURCE_BIN_DIR
)
142 realclean clobber_all
::
143 rm -rf
$(wildcard *.OBJ
) dist $(ALL_TRASH
)
146 #######################################################################
147 # Double-Colon rules for populating the binary release model. #
148 #######################################################################
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
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)" \
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
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.
214 RELEASE_CLASSES
:= $(patsubst %,%,$(CLASSES
))
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
)
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
)
226 # Substitute \$ for $ so the shell doesn't choke
229 $(INSTALL
) -m
444 $(subst $$,\
$$,$(RELEASE_FILES
)) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_CLASSES_DIR
)/$(PACKAGE
)
232 $(INSTALL
) -m
444 $(subst $$,\
$$,$(RELEASE_DBG_FILES
)) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_CLASSES_DBG_DIR
)/$(PACKAGE
)
242 MD_LIB_RELEASE_FILES
+= $(LIBRARY
)
245 MD_LIB_RELEASE_FILES
+= $(SHARED_LIBRARY
)
248 MD_LIB_RELEASE_FILES
+= $(IMPORT_LIBRARY
)
251 MD_BIN_RELEASE_FILES
+= $(PROGRAM
)
254 MD_BIN_RELEASE_FILES
+= $(PROGRAMS
)
259 ifneq ($(MD_LIB_RELEASE_FILES
),)
260 $(INSTALL
) -m
444 $(MD_LIB_RELEASE_FILES
) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_LIB_DIR
)
262 ifneq ($(MD_BIN_RELEASE_FILES
),)
263 $(INSTALL
) -m
555 $(MD_BIN_RELEASE_FILES
) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_BIN_DIR
)
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
)
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
)
278 if
test -f
$@.manifest
; then \
279 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
282 endif # MSVC with manifest tool
284 $(MKPROG
) -o
$@
$(CFLAGS
) $(OBJS
) $(LDFLAGS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
293 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
294 $(AR
) $(subst /,\\,$(OBJS
))
301 ifeq ($(OS_TARGET
),OS2
)
302 $(IMPORT_LIBRARY
): $(MAPFILE
)
308 ifdef SHARED_LIBRARY_LIBS
310 SUB_SHLOBJS
= $(foreach dir,$(SHARED_LIBRARY_DIRS
),$(shell $(MAKE
) -C
$(dir) --no-print-directory get_objs
))
312 SUB_SHLOBJS
= $(foreach dir,$(SHARED_LIBRARY_DIRS
),$(addprefix $(dir)/,$(shell $(MAKE
) -C
$(dir) --no-print-directory get_objs
)))
316 $(SHARED_LIBRARY
): $(OBJS
) $(RES
) $(MAPFILE
) $(SUB_SHLOBJS
)
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}' \
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
)
328 ifeq (,$(filter-out WIN
%,$(OS_TARGET
)))
330 $(LINK_DLL
) $(OBJS
) $(SUB_SHLOBJS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
) $(LD_LIBS
) $(RES
)
332 $(LINK_DLL
) -MAP
$(DLLBASE
) $(subst /,\\,$(OBJS
) $(SUB_SHLOBJS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
) $(LD_LIBS
) $(RES
))
334 if
test -f
$@.manifest
; then \
335 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;2; \
338 endif # MSVC with manifest tool
341 $(MKSHLIB
) -o
$@
$(OBJS
) $(SUB_SHLOBJS
) $(LD_LIBS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
343 ifeq ($(OS_TARGET
),Darwin
)
345 nmedit
-s
$(MAPFILE
) $@
351 ifeq (,$(filter-out WIN
%,$(OS_TARGET
)))
354 # The resource compiler does not understand the -U option.
356 $(RC
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
:-I
%=--include-dir
%) -o
$@
$<
358 $(RC
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
) -Fo
$@
$<
360 @echo
$(RES
) finished
363 $(MAPFILE
): $(MAPFILE_SOURCE
)
368 $(OBJDIR
)/$(PROG_PREFIX
)%$(PROG_SUFFIX
): $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
)
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
)
374 if
test -f
$@.manifest
; then \
375 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
378 endif # MSVC with manifest tool
380 $(MKPROG
) -o
$@
$(CFLAGS
) $< \
381 $(LDFLAGS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
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
)))
393 NEED_ABSOLUTE_PATH
:= 1
398 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
399 NEED_ABSOLUTE_PATH
:= 1
401 ifeq (,$(findstring ;,$(PATH
)))
403 PWD
:= $(subst \
,/,$(shell cygpath
-w
$(PWD
)))
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
418 ifdef USE_NT_C_SYNTAX
419 $(CC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
421 ifdef NEED_ABSOLUTE_PATH
422 $(CC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
424 $(CC
) -o
$@
-c
$(CFLAGS
) $<
428 $(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.c
429 ifdef USE_NT_C_SYNTAX
430 $(CC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
432 ifdef NEED_ABSOLUTE_PATH
433 $(CC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
435 $(CC
) -o
$@
-c
$(CFLAGS
) $<
439 ifneq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
440 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.s
442 $(AS
) -o
$@
$(ASFLAGS
) -c
$<
445 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.asm
447 $(AS
) -Fo
$@
$(ASFLAGS
) -c
$<
449 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.S
451 $(AS
) -o
$@
$(ASFLAGS
) -c
$<
453 $(OBJDIR
)/$(PROG_PREFIX
)%: %.
cpp
455 ifdef USE_NT_C_SYNTAX
456 $(CCC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
458 ifdef NEED_ABSOLUTE_PATH
459 $(CCC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
461 $(CCC
) -o
$@
-c
$(CFLAGS
) $<
466 # Please keep the next two rules in sync.
468 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.
cc
470 $(CCC
) -o
$@
-c
$(CFLAGS
) $<
472 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.
cpp
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
479 ifdef USE_NT_C_SYNTAX
480 $(CCC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
482 ifdef NEED_ABSOLUTE_PATH
483 $(CCC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
485 $(CCC
) -o
$@
-c
$(CFLAGS
) $<
488 endif #STRICT_CPLUSPLUS_SUFFIX
491 $(CCC
) -C
-E
$(CFLAGS
) $< > $@
494 ifeq (,$(filter-out WIN
%,$(OS_TARGET
)))
495 $(CC
) -C
/P
$(CFLAGS
) $<
497 $(CC
) -C
-E
$(CFLAGS
) $< > $@
500 ifneq (,$(filter-out WIN
%,$(OS_TARGET
)))
502 $(CC
) -C
-E
$(CFLAGS
) $< > $@
506 rm -f
$@
; cp
$< $@
; chmod
+x
$@
509 rm -f
$@
; cp
$< $@
; chmod
+x
$@
513 @if
test -d
$@
; then \
514 set
$(EXIT_ON_ERROR
); \
515 echo
"cd $@; $(MAKE)"; \
519 echo
"Skipping non-directory $@..."; \
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 \
532 $(NSINSTALL
) -D
$@
; \
535 ################################################################################
541 # $(IDL2JAVA) $(IDL_GEN)
546 # rm -f $(IDL_GEN:.idl=.class) # XXX wrong!
550 ################################################################################
551 ### JSRCS -- for compiling java files
553 ### NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
554 ### replace $(CORE_DEPTH) with $(NETLIBDEPTH).
560 CORE_DEPTH
:= $(NETLIBDEPTH
)
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
)
573 rm -f
$(SOURCE_XP_DIR
)/classes
/$(PACKAGE
)/*.class
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).
591 CORE_DEPTH
:= $(NETLIBDEPTH
)
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 !!!"
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; \
615 echo
"Skipping non-directory $$d..."; \
617 $(CLICK_STOPWATCH
); \
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).
633 INCLUDES
+= -I
$(JDK_GEN_DIR
) -I
$(SOURCE_XP_DIR
)
635 INCLUDES
+= -I
$(JDK_GEN_DIR
)
639 CORE_DEPTH
:= $(NETLIBDEPTH
)
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
)
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
)
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).
682 INCLUDES
+= -I
$(JRI_GEN_DIR
) -I
$(SOURCE_XP_DIR
)
684 INCLUDES
+= -I
$(JRI_GEN_DIR
)
688 CORE_DEPTH
:= $(NETLIBDEPTH
)
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
)
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
)
721 # JNI_GEN -- for generating JNI native methods
723 # Generate JNI Headers into the 'jni' directory
727 JNI_HEADERS
:= $(patsubst %,$(JNI_GEN_DIR
)/%.h
,$(JNI_GEN
))
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
); \
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
);\
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
)
758 # JMC_GEN -- for generating java modules
760 # Provide default export & install rules when using JMC_GEN
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
777 $(CC
) -o
$@
-c
$(CFLAGS
) $<
779 export:: $(JMC_HEADERS
) $(JMC_STUBS
)
784 # Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/
786 PUBLIC_EXPORT_DIR
= $(SOURCE_XP_DIR
)/public
/$(MODULE
)
789 $(PUBLIC_EXPORT_DIR
)::
790 @if
test ! -d
$@
; then \
792 $(NSINSTALL
) -D
$@
; \
795 export:: $(PUBLIC_EXPORT_DIR
)
798 $(INSTALL
) -m
444 $^
$(PUBLIC_EXPORT_DIR
)
800 export:: $(BUILT_SRCS
)
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 \
811 $(NSINSTALL
) -D
$@
; \
814 private_export
:: $(PRIVATE_EXPORT_DIR
)
816 private_export
:: $(PRIVATE_EXPORTS
)
817 $(INSTALL
) -m
444 $^
$(PRIVATE_EXPORT_DIR
)
820 @echo There are no private exports.
;
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
))
837 tests
:: $(REGRESSION_SPEC
)
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'"
852 @echo Error
: you didn
't specify REGRESSION_SPEC in your manifest.mn file!;
856 # Duplicate export rule for releases, with different directories
859 $(SOURCE_RELEASE_XP_DIR)/include::
860 @if test ! -d $@; then \
862 $(NSINSTALL) -D $@; \
865 release_export:: $(SOURCE_RELEASE_XP_DIR)/include
867 release_export:: $(EXPORTS)
868 $(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include
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)"); \
883 if
(m@ \.
*/*$< @
) { \
889 print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \
891 $$tmpname = "$(OBJDIR)/fix.md" .
$$$$; \
892 open
(TMD
, "> " .
$$tmpname); \
895 if
(!print TMD
"$$_") { \
896 unlink
(($$tmpname)); \
901 if
(!rename
($$tmpname, "$(DEPENDENCIES)")) { \
902 unlink
(($$tmpname)); \
904 } elsif
("$<" ne
"$(DEPENDENCIES)") { \
905 print "$(MAKE): *** No rule to make target $<. Stop.\n"; \
910 @
$(PERL
) -e
'$(PERL_DEPENDENCIES_PROGRAM)'
913 #############################################################################
914 # X dependency system
915 #############################################################################
919 # For Windows, $(MKDEPENDENCIES) must be -included before including rules.mk
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
)
934 depend
:: $(MKDEPEND
) $(MKDEPENDENCIES
)
941 rm -f
$(MKDEPENDENCIES
)
944 #-include $(NSINSTALL_DIR)/$(OBJDIR)/depend.mk
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
)
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.
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
)