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
)))
68 # IMPORTS will always be associated with a component. Therefore,
69 # the "import" rule will always change directory to the top-level
70 # of a component, and traverse the IMPORTS keyword from the
71 # "manifest.mn" file located at this level only.
73 # note: if there is a trailing slash, the component will be appended
74 # (see import.pl - only used for xpheader.jar)
77 @echo
"== import.pl =="
78 @
$(PERL
) -I
$(CORE_DEPTH
)/coreconf
$(CORE_DEPTH
)/coreconf
/import.pl \
79 "RELEASE_TREE=$(RELEASE_TREE)" \
80 "IMPORTS=$(IMPORTS)" \
81 "VERSION=$(VERSION)" \
82 "OS_ARCH=$(OS_ARCH)" \
83 "PLATFORM=$(PLATFORM)" \
84 "OVERRIDE_IMPORT_CHECK=$(OVERRIDE_IMPORT_CHECK)" \
85 "ALLOW_VERSION_OVERRIDE=$(ALLOW_VERSION_OVERRIDE)" \
86 "SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
87 "SOURCE_MD_DIR=$(SOURCE_MD_DIR)" \
88 "SOURCE_XP_DIR=$(SOURCE_XP_DIR)" \
89 "FILES=$(IMPORT_XPCLASS_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
90 "$(IMPORT_XPCLASS_JAR)=$(IMPORT_XP_DIR)|$(IMPORT_XPCLASS_DIR)|" \
91 "$(XPHEADER_JAR)=$(IMPORT_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \
92 "$(MDHEADER_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)/include|" \
93 "$(MDBINARY_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)|"
94 # On Mac OS X ranlib needs to be rerun after static libs are moved.
95 ifeq ($(OS_TARGET
),Darwin
)
96 find
$(SOURCE_MD_DIR
)/lib
-name
"*.a" -exec
$(RANLIB
) {} \
;
111 libs program
install:: $(TARGETS
)
113 $(INSTALL
) -m
664 $(LIBRARY
) $(SOURCE_LIB_DIR
)
116 $(INSTALL
) -m
775 $(SHARED_LIBRARY
) $(SOURCE_LIB_DIR
)
117 ifdef MOZ_DEBUG_SYMBOLS
118 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
119 $(INSTALL
) -m
644 $(SHARED_LIBRARY
:$(DLL_SUFFIX
)=pdb
) $(SOURCE_LIB_DIR
)
124 $(INSTALL
) -m
775 $(IMPORT_LIBRARY
) $(SOURCE_LIB_DIR
)
127 $(INSTALL
) -m
775 $(PROGRAM
) $(SOURCE_BIN_DIR
)
128 ifdef MOZ_DEBUG_SYMBOLS
129 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
130 $(INSTALL
) -m
644 $(PROGRAM
:$(PROG_SUFFIX
)=.pdb
) $(SOURCE_BIN_DIR
)
135 $(INSTALL
) -m
775 $(PROGRAMS
) $(SOURCE_BIN_DIR
)
146 realclean clobber_all
::
147 rm -rf
$(wildcard *.OBJ
) dist $(ALL_TRASH
)
150 #######################################################################
151 # Double-Colon rules for populating the binary release model. #
152 #######################################################################
156 rm -rf
$(SOURCE_XP_DIR
)/release
/$(RELEASE_MD_DIR
)
158 release
:: release_clean release_export release_classes release_policy release_md release_jars release_cpdistdir
161 @echo
"== cpdist.pl =="
162 @
$(PERL
) -I
$(CORE_DEPTH
)/coreconf
$(CORE_DEPTH
)/coreconf
/cpdist.pl \
163 "RELEASE_TREE=$(RELEASE_TREE)" \
164 "CORE_DEPTH=$(CORE_DEPTH)" \
166 "OS_ARCH=$(OS_ARCH)" \
167 "RELEASE=$(RELEASE)" \
168 "PLATFORM=$(PLATFORM)" \
169 "RELEASE_VERSION=$(RELEASE_VERSION)" \
170 "SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
171 "RELEASE_XP_DIR=$(RELEASE_XP_DIR)" \
172 "RELEASE_MD_DIR=$(RELEASE_MD_DIR)" \
173 "FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR) XP_FILES MD_FILES" \
174 "$(XPCLASS_JAR)=$(SOURCE_RELEASE_CLASSES_DIR)|x"\
175 "$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_CLASSES_DBG_DIR)|x"\
176 "$(XPHEADER_JAR)=$(SOURCE_RELEASE_XPHEADERS_DIR)|x" \
177 "$(MDHEADER_JAR)=$(SOURCE_RELEASE_MDHEADERS_DIR)|m" \
178 "$(MDBINARY_JAR)=$(SOURCE_RELEASE_MD_DIR)|m" \
179 "XP_FILES=$(XP_FILES)|xf" \
180 "MD_FILES=$(MD_FILES)|mf"
183 # $(SOURCE_RELEASE_xxx_JAR) is a name like yyy.jar
184 # $(SOURCE_RELEASE_xx_DIR) is a name like
187 @echo
"== release.pl =="
188 @
$(PERL
) -I
$(CORE_DEPTH
)/coreconf
$(CORE_DEPTH
)/coreconf
/release.pl \
189 "RELEASE_TREE=$(RELEASE_TREE)" \
190 "PLATFORM=$(PLATFORM)" \
191 "OS_ARCH=$(OS_ARCH)" \
192 "RELEASE_VERSION=$(RELEASE_VERSION)" \
193 "SOURCE_RELEASE_DIR=$(SOURCE_RELEASE_DIR)" \
194 "FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
195 "$(XPCLASS_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)|b"\
196 "$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)|b"\
197 "$(XPHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_XPHEADERS_DIR)|a" \
198 "$(MDHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MDHEADERS_DIR)|a" \
199 "$(MDBINARY_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MD_DIR)|bi"
201 # Rules for releasing classes.
202 # We have to do some REALLY gross stuff to deal with multiple classes in one
203 # file, as well as nested classes, which have a filename of the form
204 # ContainingClass$NestedClass.class.
205 # RELEASE_CLASSES simply performs a required patsubst on CLASSES
206 # RELEASE_CLASS_PATH is RELEASE_CLASSES with the path (in ns/dist) prepended
207 # RELEASE_NESTED is all the nested classes in RELEASE_CLASS_PATH. We use a
208 # foreach and wildcard to get all the files that start out like one of the
209 # class files, then have a $. So, for each class file, we look for file$*
210 # RELEASE_FILES is the combination of RELEASE_NESTED and the class files
211 # specified by RELEASE_CLASSES which have .class appended to them. Note that
212 # the RELEASE_NESTED don't need to have .class appended because they were
213 # read in from the wildcard as complete filenames.
215 # The _DBG versions are the debuggable ones.
218 RELEASE_CLASSES
:= $(patsubst %,%,$(CLASSES
))
221 RELEASE_CLASS_PATH
:= $(patsubst %,$(SOURCE_CLASSES_DIR
)/$(PACKAGE
)/%, $(RELEASE_CLASSES
))
222 RELEASE_NESTED
:= $(foreach file
,$(RELEASE_CLASS_PATH
),$(wildcard $(file
)$$*))
223 RELEASE_FILES
:= $(patsubst %,%.class
,$(RELEASE_CLASS_PATH
)) $(RELEASE_NESTED
)
225 RELEASE_DBG_CLASS_PATH
:= $(patsubst %,$(SOURCE_CLASSES_DBG_DIR
)/$(PACKAGE
)/%, $(RELEASE_CLASSES
))
226 RELEASE_DBG_NESTED
:= $(foreach file
,$(RELEASE_DBG_CLASS_PATH
),$(wildcard $(file
)$$*))
227 RELEASE_DBG_FILES
:= $(patsubst %,%.class
,$(RELEASE_DBG_CLASS_PATH
)) $(RELEASE_DBG_NESTED
)
230 # Substitute \$ for $ so the shell doesn't choke
233 $(INSTALL
) -m
444 $(subst $$,\
$$,$(RELEASE_FILES
)) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_CLASSES_DIR
)/$(PACKAGE
)
236 $(INSTALL
) -m
444 $(subst $$,\
$$,$(RELEASE_DBG_FILES
)) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_CLASSES_DBG_DIR
)/$(PACKAGE
)
246 MD_LIB_RELEASE_FILES
+= $(LIBRARY
)
249 MD_LIB_RELEASE_FILES
+= $(SHARED_LIBRARY
)
252 MD_LIB_RELEASE_FILES
+= $(IMPORT_LIBRARY
)
255 MD_BIN_RELEASE_FILES
+= $(PROGRAM
)
258 MD_BIN_RELEASE_FILES
+= $(PROGRAMS
)
263 ifneq ($(MD_LIB_RELEASE_FILES
),)
264 $(INSTALL
) -m
444 $(MD_LIB_RELEASE_FILES
) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_LIB_DIR
)
266 ifneq ($(MD_BIN_RELEASE_FILES
),)
267 $(INSTALL
) -m
555 $(MD_BIN_RELEASE_FILES
) $(SOURCE_RELEASE_PREFIX
)/$(SOURCE_RELEASE_BIN_DIR
)
274 find .
-name
dist -prune
-o \
( -name
'*.[hc]' -o
-name
'*.cp' -o
-name
'*.cpp' \
) -print | xargs etags
-a
275 find .
-name
dist -prune
-o \
( -name
'*.[hc]' -o
-name
'*.cp' -o
-name
'*.cpp' \
) -print | xargs ctags
-a
278 # list of libs (such as -lnspr4) do not work for our compiler
279 # change it to be $(DIST)/lib/nspr4.lib
280 EXTRA_SHARED_LIBS
:= $(filter-out -L
%,$(EXTRA_SHARED_LIBS
))
281 EXTRA_SHARED_LIBS
:= $(patsubst -l
%,$(DIST
)/lib
/%.
$(LIB_SUFFIX
),$(EXTRA_SHARED_LIBS
))
284 $(PROGRAM
): $(OBJS
) $(EXTRA_LIBS
)
286 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
287 $(MKPROG
) $(subst /,\\,$(OBJS
)) -Fe
$@
-link
$(LDFLAGS
) $(subst /,\\,$(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
))
289 if
test -f
$@.manifest
; then \
290 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
293 endif # MSVC with manifest tool
296 $(MKPROG
) -Fe
$@
$(CFLAGS
) $(OBJS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
298 $(MKPROG
) -o
$@
$(CFLAGS
) $(OBJS
) $(LDFLAGS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
308 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
309 $(AR
) $(subst /,\\,$(OBJS
))
316 ifeq ($(OS_TARGET
),OS2
)
317 $(IMPORT_LIBRARY
): $(MAPFILE
)
323 ifdef SHARED_LIBRARY_LIBS
325 SUB_SHLOBJS
= $(foreach dir,$(SHARED_LIBRARY_DIRS
),$(shell $(MAKE
) -C
$(dir) --no-print-directory get_objs
))
327 SUB_SHLOBJS
= $(foreach dir,$(SHARED_LIBRARY_DIRS
),$(addprefix $(dir)/,$(shell $(MAKE
) -C
$(dir) --no-print-directory get_objs
)))
331 $(SHARED_LIBRARY
): $(OBJS
) $(RES
) $(MAPFILE
) $(SUB_SHLOBJS
)
334 ifeq ($(OS_TARGET
)$(OS_RELEASE
), AIX4.1
)
335 echo
"#!" > $(OBJDIR
)/lib
$(LIBRARY_NAME
)_syms
336 nm
-B
-C
-g
$(OBJS
) \
337 | awk
'/ [T,D] / {print $$3}' \
339 |
sort -u
>> $(OBJDIR
)/lib
$(LIBRARY_NAME
)_syms
340 $(LD
) $(XCFLAGS
) -o
$@
$(OBJS
) -bE
:$(OBJDIR
)/lib
$(LIBRARY_NAME
)_syms \
341 -bM
:SRE
-bnoentry
$(OS_LIBS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
)
343 ifeq (,$(filter-out WIN
%,$(OS_TARGET
)))
345 $(LINK_DLL
) $(OBJS
) $(SUB_SHLOBJS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
) $(LD_LIBS
) $(RES
)
347 $(LINK_DLL
) -MAP
$(DLLBASE
) $(subst /,\\,$(OBJS
) $(SUB_SHLOBJS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
) $(LD_LIBS
) $(RES
))
349 if
test -f
$@.manifest
; then \
350 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;2; \
353 endif # MSVC with manifest tool
357 $(MKSHLIB
) $(DLLFLAGS
) $(LDFLAGS
) $(OBJS
) $(SUB_SHLOBJS
) $(LD_LIBS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
359 $(MKSHLIB
) -o
$@
$(OBJS
) $(SUB_SHLOBJS
) $(LD_LIBS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
362 ifeq ($(OS_TARGET
),Darwin
)
364 nmedit
-s
$(MAPFILE
) $@
370 ifeq (,$(filter-out WIN
%,$(OS_TARGET
)))
373 # The resource compiler does not understand the -U option.
375 $(RC
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
:-I
%=--include-dir
%) -o
$@
$<
377 $(RC
) $(filter-out -U
%,$(DEFINES
)) $(INCLUDES
) -Fo
$@
$<
379 @echo
$(RES
) finished
382 $(MAPFILE
): $(MAPFILE_SOURCE
)
387 $(OBJDIR
)/$(PROG_PREFIX
)%$(PROG_SUFFIX
): $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
)
389 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
390 $(MKPROG
) $< -Fe
$@
-link \
391 $(LDFLAGS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
393 if
test -f
$@.manifest
; then \
394 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
397 endif # MSVC with manifest tool
399 $(MKPROG
) -o
$@
$(CFLAGS
) $< \
400 $(LDFLAGS
) $(EXTRA_LIBS
) $(EXTRA_SHARED_LIBS
) $(OS_LIBS
)
403 WCCFLAGS1
:= $(subst /,\\,$(CFLAGS
))
404 WCCFLAGS2
:= $(subst -I
,-i
=,$(WCCFLAGS1
))
405 WCCFLAGS3
:= $(subst -D
,-d
,$(WCCFLAGS2
))
407 # Translate source filenames to absolute paths. This is required for
408 # debuggers under Windows & OS/2 to find source files automatically
410 ifeq (,$(filter-out OS2 AIX
,$(OS_TARGET
)))
412 NEED_ABSOLUTE_PATH
:= 1
417 ifeq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
418 NEED_ABSOLUTE_PATH
:= 1
420 ifeq (,$(findstring ;,$(PATH
)))
422 PWD
:= $(subst \
,/,$(shell cygpath
-w
$(PWD
)))
432 core_abspath
= $(if
$(findstring :,$(1)),$(1),$(if
$(filter /%,$(1)),$(1),$(PWD
)/$(1)))
434 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.c
436 ifdef USE_NT_C_SYNTAX
437 $(CC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
439 ifdef NEED_ABSOLUTE_PATH
440 $(CC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
442 $(CC
) -o
$@
-c
$(CFLAGS
) $<
446 $(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.c
447 ifdef USE_NT_C_SYNTAX
448 $(CC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
450 ifdef NEED_ABSOLUTE_PATH
451 $(CC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
453 $(CC
) -o
$@
-c
$(CFLAGS
) $<
458 ifneq (,$(filter-out _WIN
%,$(NS_USE_GCC
)_
$(OS_TARGET
)))
459 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.s
461 $(AS
) -o
$@
$(ASFLAGS
) -c
$<
465 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.asm
468 $(AS
) -Fdo
:$(OBJDIR
) $(ASFLAGS
) $(subst /,\\,$<)
470 $(AS
) -Fo
$@
$(ASFLAGS
) -c
$<
473 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.S
475 $(AS
) -o
$@
$(ASFLAGS
) -c
$<
477 $(OBJDIR
)/$(PROG_PREFIX
)%: %.
cpp
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
) $<
490 # Please keep the next two rules in sync.
492 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.
cc
494 $(CCC
) -o
$@
-c
$(CFLAGS
) $<
496 $(OBJDIR
)/$(PROG_PREFIX
)%$(OBJ_SUFFIX
): %.
cpp
498 ifdef STRICT_CPLUSPLUS_SUFFIX
499 echo
"#line 1 \"$<\"" | cat
- $< > $(OBJDIR
)/t_
$*.
cc
500 $(CCC
) -o
$@
-c
$(CFLAGS
) $(OBJDIR
)/t_
$*.
cc
501 rm -f
$(OBJDIR
)/t_
$*.
cc
503 ifdef USE_NT_C_SYNTAX
504 $(CCC
) -Fo
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
506 ifdef NEED_ABSOLUTE_PATH
507 $(CCC
) -o
$@
-c
$(CFLAGS
) $(call core_abspath
,$<)
509 $(CCC
) -o
$@
-c
$(CFLAGS
) $<
512 endif #STRICT_CPLUSPLUS_SUFFIX
515 $(CCC
) -C
-E
$(CFLAGS
) $< > $@
518 ifeq (,$(filter-out WIN
%,$(OS_TARGET
)))
519 $(CC
) -C
/P
$(CFLAGS
) $<
521 $(CC
) -C
-E
$(CFLAGS
) $< > $@
524 ifneq (,$(filter-out WIN
%,$(OS_TARGET
)))
526 $(CC
) -C
-E
$(CFLAGS
) $< > $@
530 rm -f
$@
; cp
$< $@
; chmod
+x
$@
533 rm -f
$@
; cp
$< $@
; chmod
+x
$@
537 @if
test -d
$@
; then \
538 set
$(EXIT_ON_ERROR
); \
539 echo
"cd $@; $(MAKE)"; \
543 echo
"Skipping non-directory $@..."; \
548 ################################################################################
549 # Bunch of things that extend the 'export' rule (in order):
550 ################################################################################
552 $(JAVA_DESTPATH
) $(JAVA_DESTPATH
)/$(PACKAGE
) $(JMCSRCDIR
)::
553 @if
test ! -d
$@
; then \
556 $(NSINSTALL
) -D
$@
; \
559 ################################################################################
565 # $(IDL2JAVA) $(IDL_GEN)
570 # rm -f $(IDL_GEN:.idl=.class) # XXX wrong!
574 ################################################################################
575 ### JSRCS -- for compiling java files
577 ### NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
578 ### replace $(CORE_DEPTH) with $(NETLIBDEPTH).
584 CORE_DEPTH
:= $(NETLIBDEPTH
)
587 JAVA_EXPORT_SRCS
=$(shell $(PERL
) $(CORE_DEPTH
)/coreconf
/outofdate.pl
$(PERLARG
) -d
$(JAVA_DESTPATH
)/$(PACKAGE
) $(JSRCS
) $(PRIVATE_JSRCS
))
589 export:: $(JAVA_DESTPATH
) $(JAVA_DESTPATH
)/$(PACKAGE
)
590 ifneq ($(JAVA_EXPORT_SRCS
),)
591 $(JAVAC
) $(JAVA_EXPORT_SRCS
)
597 rm -f
$(SOURCE_XP_DIR
)/classes
/$(PACKAGE
)/*.class
603 # JDIRS -- like JSRCS, except you can give a list of directories and it will
604 # compile all the out-of-date java files in those directories.
606 # NOTE: recursing through these can speed things up, but they also cause
607 # some builds to run out of memory
609 # NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
610 # replace $(CORE_DEPTH) with $(NETLIBDEPTH).
615 CORE_DEPTH
:= $(NETLIBDEPTH
)
618 # !!!!! THIS WILL CRASH SHMSDOS.EXE !!!!!
619 # shmsdos does not support shell variables. It will crash when it tries
620 # to parse the '=' character. A solution is to rewrite outofdate.pl so it
621 # takes the Javac command as an argument and executes the command itself,
622 # instead of returning a list of files.
623 export:: $(JAVA_DESTPATH
) $(JAVA_DESTPATH
)/$(PACKAGE
)
624 @echo
"!!! THIS COMMAND IS BROKEN ON WINDOWS--SEE rules.mk FOR DETAILS !!!"
626 @for d in
$(JDIRS
); do \
627 if
test -d
$$d; then \
628 set
$(EXIT_ON_ERROR
); \
629 files
=`echo $$d/*.java`; \
630 list
=`$(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) \
631 -d $(JAVA_DESTPATH)/$(PACKAGE) $$files`; \
632 if
test "$${list}x" != "x"; then \
633 echo Building
all java files in
$$d; \
634 echo
$(JAVAC
) $$list; \
639 echo
"Skipping non-directory $$d..."; \
641 $(CLICK_STOPWATCH
); \
647 # JDK_GEN -- for generating "old style" native methods
649 # Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
651 # NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
652 # replace $(CORE_DEPTH) with $(NETLIBDEPTH).
657 INCLUDES
+= -I
$(JDK_GEN_DIR
) -I
$(SOURCE_XP_DIR
)
659 INCLUDES
+= -I
$(JDK_GEN_DIR
)
663 CORE_DEPTH
:= $(NETLIBDEPTH
)
666 JDK_PACKAGE_CLASSES
:= $(JDK_GEN
)
667 JDK_PATH_CLASSES
:= $(subst .
,/,$(JDK_PACKAGE_CLASSES
))
668 JDK_HEADER_CLASSFILES
:= $(patsubst %,$(JAVA_DESTPATH
)/%.class
,$(JDK_PATH_CLASSES
))
669 JDK_STUB_CLASSFILES
:= $(patsubst %,$(JAVA_DESTPATH
)/%.class
,$(JDK_PATH_CLASSES
))
670 JDK_HEADER_CFILES
:= $(patsubst %,$(JDK_GEN_DIR
)/%.h
,$(JDK_GEN
))
671 JDK_STUB_CFILES
:= $(patsubst %,$(JDK_STUB_DIR
)/%.c
,$(JDK_GEN
))
673 $(JDK_HEADER_CFILES
): $(JDK_HEADER_CLASSFILES
)
674 $(JDK_STUB_CFILES
): $(JDK_STUB_CLASSFILES
)
677 @echo Generating
/Updating JDK headers
678 $(JAVAH
) -d
$(JDK_GEN_DIR
) $(JDK_PACKAGE_CLASSES
)
679 @echo Generating
/Updating JDK stubs
680 $(JAVAH
) -stubs
-d
$(JDK_STUB_DIR
) $(JDK_PACKAGE_CLASSES
)
681 ifndef NO_MAC_JAVA_SHIT
682 @if
test ! -d
$(CORE_DEPTH
)/lib
/mac
/Java
/; then \
683 echo
"!!! You need to have a ns/lib/mac/Java directory checked out."; \
684 echo
"!!! This allows us to automatically update generated files for the mac."; \
685 echo
"!!! If you see any modified files there, please check them in."; \
687 @echo Generating
/Updating JDK headers for the Mac
688 $(JAVAH
) -mac
-d
$(CORE_DEPTH
)/lib
/mac
/Java
/_gen
$(JDK_PACKAGE_CLASSES
)
689 @echo Generating
/Updating JDK stubs for the Mac
690 $(JAVAH
) -mac
-stubs
-d
$(CORE_DEPTH
)/lib
/mac
/Java
/_stubs
$(JDK_PACKAGE_CLASSES
)
696 # JRI_GEN -- for generating "old style" JRI native methods
698 # Generate JRI Headers and Stubs into the 'jri' directory
700 # NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
701 # replace $(CORE_DEPTH) with $(NETLIBDEPTH).
706 INCLUDES
+= -I
$(JRI_GEN_DIR
) -I
$(SOURCE_XP_DIR
)
708 INCLUDES
+= -I
$(JRI_GEN_DIR
)
712 CORE_DEPTH
:= $(NETLIBDEPTH
)
715 JRI_PACKAGE_CLASSES
:= $(JRI_GEN
)
716 JRI_PATH_CLASSES
:= $(subst .
,/,$(JRI_PACKAGE_CLASSES
))
717 JRI_HEADER_CLASSFILES
:= $(patsubst %,$(JAVA_DESTPATH
)/%.class
,$(JRI_PATH_CLASSES
))
718 JRI_STUB_CLASSFILES
:= $(patsubst %,$(JAVA_DESTPATH
)/%.class
,$(JRI_PATH_CLASSES
))
719 JRI_HEADER_CFILES
:= $(patsubst %,$(JRI_GEN_DIR
)/%.h
,$(JRI_GEN
))
720 JRI_STUB_CFILES
:= $(patsubst %,$(JRI_GEN_DIR
)/%.c
,$(JRI_GEN
))
722 $(JRI_HEADER_CFILES
): $(JRI_HEADER_CLASSFILES
)
723 $(JRI_STUB_CFILES
): $(JRI_STUB_CLASSFILES
)
726 @echo Generating
/Updating JRI headers
727 $(JAVAH
) -jri
-d
$(JRI_GEN_DIR
) $(JRI_PACKAGE_CLASSES
)
728 @echo Generating
/Updating JRI stubs
729 $(JAVAH
) -jri
-stubs
-d
$(JRI_GEN_DIR
) $(JRI_PACKAGE_CLASSES
)
730 ifndef NO_MAC_JAVA_SHIT
731 @if
test ! -d
$(CORE_DEPTH
)/lib
/mac
/Java
/; then \
732 echo
"!!! You need to have a ns/lib/mac/Java directory checked out."; \
733 echo
"!!! This allows us to automatically update generated files for the mac."; \
734 echo
"!!! If you see any modified files there, please check them in."; \
736 @echo Generating
/Updating JRI headers for the Mac
737 $(JAVAH
) -jri
-mac
-d
$(CORE_DEPTH
)/lib
/mac
/Java
/_jri
$(JRI_PACKAGE_CLASSES
)
738 @echo Generating
/Updating JRI stubs for the Mac
739 $(JAVAH
) -jri
-mac
-stubs
-d
$(CORE_DEPTH
)/lib
/mac
/Java
/_jri
$(JRI_PACKAGE_CLASSES
)
745 # JNI_GEN -- for generating JNI native methods
747 # Generate JNI Headers into the 'jni' directory
751 JNI_HEADERS
:= $(patsubst %,$(JNI_GEN_DIR
)/%.h
,$(JNI_GEN
))
754 @if
test ! -d
$(JNI_GEN_DIR
); then \
755 echo
$(JAVAH
) -jni
-d
$(JNI_GEN_DIR
) $(JNI_GEN
); \
756 $(JAVAH
) -jni
-d
$(JNI_GEN_DIR
) $(JNI_GEN
); \
758 echo
"Checking for out of date header files" ; \
759 $(PERL
) $(CORE_DEPTH
)/coreconf
/jniregen.pl
$(PERLARG
) \
760 -d
$(JAVA_DESTPATH
) -j
"$(JAVAH) -jni -d $(JNI_GEN_DIR)" $(JNI_GEN
);\
766 # JMC_EXPORT -- for declaring which java classes are to be exported for jmc
768 ifneq ($(JMC_EXPORT
),)
769 JMC_EXPORT_PATHS
:= $(subst .
,/,$(JMC_EXPORT
))
770 JMC_EXPORT_FILES
:= $(patsubst %,$(JAVA_DESTPATH
)/$(PACKAGE
)/%.class
,$(JMC_EXPORT_PATHS
))
773 # We're doing NSINSTALL -t here (copy mode) because calling INSTALL will pick up
774 # your NSDISTMODE and make links relative to the current directory. This is a
775 # problem because the source isn't in the current directory:
777 export:: $(JMC_EXPORT_FILES
) $(JMCSRCDIR
)
778 $(NSINSTALL
) -t
-m
444 $(JMC_EXPORT_FILES
) $(JMCSRCDIR
)
782 # JMC_GEN -- for generating java modules
784 # Provide default export & install rules when using JMC_GEN
788 INCLUDES
+= -I
$(JMC_GEN_DIR
) -I.
789 JMC_HEADERS
:= $(patsubst %,$(JMC_GEN_DIR
)/%.h
,$(JMC_GEN
))
790 JMC_STUBS
:= $(patsubst %,$(JMC_GEN_DIR
)/%.c
,$(JMC_GEN
))
791 JMC_OBJS
:= $(patsubst %,$(OBJDIR
)/%$(OBJ_SUFFIX
),$(JMC_GEN
))
793 $(JMC_GEN_DIR
)/M
%.h
: $(JMCSRCDIR
)/%.class
794 $(JMC
) -d
$(JMC_GEN_DIR
) -interface
$(JMC_GEN_FLAGS
) $(?F
:.class
=)
796 $(JMC_GEN_DIR
)/M
%.c
: $(JMCSRCDIR
)/%.class
797 $(JMC
) -d
$(JMC_GEN_DIR
) -module
$(JMC_GEN_FLAGS
) $(?F
:.class
=)
799 $(OBJDIR
)/M
%$(OBJ_SUFFIX
): $(JMC_GEN_DIR
)/M
%.c
$(JMC_GEN_DIR
)/M
%.h
801 $(CC
) -o
$@
-c
$(CFLAGS
) $<
803 export:: $(JMC_HEADERS
) $(JMC_STUBS
)
808 # Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/
810 PUBLIC_EXPORT_DIR
= $(SOURCE_XP_DIR
)/public
/$(MODULE
)
813 $(PUBLIC_EXPORT_DIR
)::
814 @if
test ! -d
$@
; then \
816 $(NSINSTALL
) -D
$@
; \
819 export:: $(PUBLIC_EXPORT_DIR
)
822 $(INSTALL
) -m
444 $^
$(PUBLIC_EXPORT_DIR
)
824 export:: $(BUILT_SRCS
)
827 # Duplicate export rule for private exports, with different directories
829 PRIVATE_EXPORT_DIR
= $(SOURCE_XP_DIR
)/private
/$(MODULE
)
831 ifneq ($(PRIVATE_EXPORTS
),)
832 $(PRIVATE_EXPORT_DIR
)::
833 @if
test ! -d
$@
; then \
835 $(NSINSTALL
) -D
$@
; \
838 private_export
:: $(PRIVATE_EXPORT_DIR
)
840 private_export
:: $(PRIVATE_EXPORTS
)
841 $(INSTALL
) -m
444 $^
$(PRIVATE_EXPORT_DIR
)
844 @echo There are no private exports.
;
847 ##########################################################################
848 ### RULES FOR RUNNING REGRESSION SUITE TESTS
849 ### REQUIRES 'REGRESSION_SPEC' TO BE SET TO THE NAME OF A REGRESSION SPECFILE
850 ### AND RESULTS_SUBDIR TO BE SET TO SOMETHING LIKE SECURITY/PKCS5
851 ##########################################################################
853 TESTS_DIR
= $(RESULTS_DIR
)/$(RESULTS_SUBDIR
)/$(OS_TARGET
)$(OS_RELEASE
)$(CPU_TAG
)$(COMPILER_TAG
)$(IMPL_STRATEGY
)
855 ifneq ($(REGRESSION_SPEC
),)
857 ifneq ($(BUILD_OPT
),)
858 REGDATE
= $(subst \
,, $(shell $(PERL
) $(CORE_DEPTH
)/$(MODULE
)/scripts
/now
))
861 tests
:: $(REGRESSION_SPEC
)
863 ..
/$(SOURCE_MD_DIR
)/bin
/regress
$(PROG_SUFFIX
) specfile
=..
/$(REGRESSION_SPEC
) progress
$(EXTRA_REGRESS_OPTIONS
); \
864 if
test ! -d
$(TESTS_DIR
); then \
865 echo Creating
$(TESTS_DIR
); \
866 $(NSINSTALL
) -D
$(TESTS_DIR
); \
868 ifneq ($(BUILD_OPT
),)
869 $(NSINSTALL
) -m
664 $(PLATFORM
)/$(REGDATE
).sum
$(TESTS_DIR
); \
870 $(NSINSTALL
) -m
664 $(PLATFORM
)/$(REGDATE
).htm
$(TESTS_DIR
); \
871 echo
"Please now make sure your results files are copied to $(TESTS_DIR), "; \
872 echo
"then run 'reporter specfile=$(RESULTS_DIR)/rptspec'"
876 @echo Error
: you didn
't specify REGRESSION_SPEC in your manifest.mn file!;
880 # Duplicate export rule for releases, with different directories
883 $(SOURCE_RELEASE_XP_DIR)/include::
884 @if test ! -d $@; then \
886 $(NSINSTALL) -D $@; \
889 release_export:: $(SOURCE_RELEASE_XP_DIR)/include
891 release_export:: $(EXPORTS)
892 $(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include
898 ################################################################################
900 -include $(DEPENDENCIES)
902 ifneq (,$(filter-out OpenVMS OS2 WIN%,$(OS_TARGET)))
903 # Can't use sed because of its
4000-char line length limit
, so resort to perl
904 PERL_DEPENDENCIES_PROGRAM
= \
905 open
(MD
, "< $(DEPENDENCIES)"); \
907 if
(m@ \.
*/*$< @
) { \
913 print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \
915 $$tmpname = "$(OBJDIR)/fix.md" .
$$$$; \
916 open
(TMD
, "> " .
$$tmpname); \
919 if
(!print TMD
"$$_") { \
920 unlink
(($$tmpname)); \
925 if
(!rename
($$tmpname, "$(DEPENDENCIES)")) { \
926 unlink
(($$tmpname)); \
928 } elsif
("$<" ne
"$(DEPENDENCIES)") { \
929 print "$(MAKE): *** No rule to make target $<. Stop.\n"; \
934 @
$(PERL
) -e
'$(PERL_DEPENDENCIES_PROGRAM)'
937 #############################################################################
938 # X dependency system
939 #############################################################################
943 # For Windows, $(MKDEPENDENCIES) must be -included before including rules.mk
947 touch
$(MKDEPENDENCIES
)
948 chmod u
+w
$(MKDEPENDENCIES
)
949 #on NT, the preceeding touch command creates a read-only file !?!?!
950 #which is why we have to explicitly chmod it.
951 $(MKDEPEND
) -p
$(OBJDIR_NAME
)/ -o
'$(OBJ_SUFFIX)' -f
$(MKDEPENDENCIES
) \
952 $(NOMD_CFLAGS
) $(YOPT
) $(CSRCS
) $(CPPSRCS
) $(ASFILES
)
954 $(MKDEPEND
):: $(MKDEPEND_DIR
)/*.c
$(MKDEPEND_DIR
)/*.h
955 cd
$(MKDEPEND_DIR
); $(MAKE
)
958 depend
:: $(MKDEPEND
) $(MKDEPENDENCIES
)
965 rm -f
$(MKDEPENDENCIES
)
968 #-include $(NSINSTALL_DIR)/$(OBJDIR)/depend.mk
974 ################################################################################
975 # Special gmake rules.
976 ################################################################################
979 # Re-define the list of default suffixes, so gmake won't have to churn through
980 # hundreds of built-in suffix rules for stuff we don't need.
983 .SUFFIXES
: .out .a .ln .o .obj .c .
cc .C .
cpp .y .l .s .S .h .sh .i .pl .class .java .html .asm
986 # Don't delete these files if we get killed.
988 .PRECIOUS
: .java
$(JDK_HEADERS
) $(JDK_STUBS
) $(JRI_HEADERS
) $(JRI_STUBS
) $(JMC_HEADERS
) $(JMC_STUBS
) $(JNI_HEADERS
)
991 # Fake targets. Always run these rules, even if a file/directory with that
992 # name already exists.
994 .PHONY
: all all_platforms alltags boot
clean clobber clobber_all
export install libs program
realclean release
$(OBJDIR
) $(DIRS
)