security/nss/coreconf/rules.mk

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/coreconf/rules.mk	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,948 @@
     1.4 +#
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +#######################################################################
    1.10 +###                                                                 ###
    1.11 +###              R U L E S   O F   E N G A G E M E N T              ###
    1.12 +###                                                                 ###
    1.13 +#######################################################################
    1.14 +
    1.15 +#######################################################################
    1.16 +# Double-Colon rules for utilizing the binary release model.          #
    1.17 +#######################################################################
    1.18 +
    1.19 +all:: export libs 
    1.20 +
    1.21 +ifeq ($(AUTOCLEAN),1)
    1.22 +autobuild:: clean export private_export libs program install
    1.23 +else
    1.24 +autobuild:: export private_export libs program install
    1.25 +endif
    1.26 +
    1.27 +platform::
    1.28 +	@echo $(OBJDIR_NAME)
    1.29 +
    1.30 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
    1.31 +USE_NT_C_SYNTAX=1
    1.32 +endif
    1.33 +
    1.34 +#
    1.35 +# IMPORTS will always be associated with a component.  Therefore,
    1.36 +# the "import" rule will always change directory to the top-level
    1.37 +# of a component, and traverse the IMPORTS keyword from the
    1.38 +# "manifest.mn" file located at this level only.
    1.39 +#
    1.40 +# note: if there is a trailing slash, the component will be appended
    1.41 +#       (see import.pl - only used for xpheader.jar)
    1.42 +
    1.43 +import::
    1.44 +	@echo "== import.pl =="
    1.45 +	@$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/import.pl \
    1.46 +		"RELEASE_TREE=$(RELEASE_TREE)"   \
    1.47 +		"IMPORTS=$(IMPORTS)"             \
    1.48 +		"VERSION=$(VERSION)" \
    1.49 +		"OS_ARCH=$(OS_ARCH)"             \
    1.50 +		"PLATFORM=$(PLATFORM)" \
    1.51 +		"OVERRIDE_IMPORT_CHECK=$(OVERRIDE_IMPORT_CHECK)"   \
    1.52 +		"ALLOW_VERSION_OVERRIDE=$(ALLOW_VERSION_OVERRIDE)" \
    1.53 +		"SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)"   \
    1.54 +		"SOURCE_MD_DIR=$(SOURCE_MD_DIR)"      \
    1.55 +		"SOURCE_XP_DIR=$(SOURCE_XP_DIR)"      \
    1.56 +		"FILES=$(IMPORT_XPCLASS_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
    1.57 +		"$(IMPORT_XPCLASS_JAR)=$(IMPORT_XP_DIR)|$(IMPORT_XPCLASS_DIR)|"    \
    1.58 +		"$(XPHEADER_JAR)=$(IMPORT_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \
    1.59 +		"$(MDHEADER_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)/include|"        \
    1.60 +		"$(MDBINARY_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)|"
    1.61 +# On Mac OS X ranlib needs to be rerun after static libs are moved.
    1.62 +ifeq ($(OS_TARGET),Darwin)
    1.63 +	find $(SOURCE_MD_DIR)/lib -name "*.a" -exec $(RANLIB) {} \;
    1.64 +endif
    1.65 +
    1.66 +export:: 
    1.67 +	+$(LOOP_OVER_DIRS)
    1.68 +
    1.69 +private_export::
    1.70 +	+$(LOOP_OVER_DIRS)
    1.71 +
    1.72 +release_export::
    1.73 +	+$(LOOP_OVER_DIRS)
    1.74 +
    1.75 +release_classes::
    1.76 +	+$(LOOP_OVER_DIRS)
    1.77 +
    1.78 +libs program install:: $(TARGETS)
    1.79 +ifdef LIBRARY
    1.80 +	$(INSTALL) -m 664 $(LIBRARY) $(SOURCE_LIB_DIR)
    1.81 +endif
    1.82 +ifdef SHARED_LIBRARY
    1.83 +	$(INSTALL) -m 775 $(SHARED_LIBRARY) $(SOURCE_LIB_DIR)
    1.84 +ifdef MOZ_DEBUG_SYMBOLS
    1.85 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
    1.86 +	$(INSTALL) -m 644 $(SHARED_LIBRARY:$(DLL_SUFFIX)=pdb) $(SOURCE_LIB_DIR)
    1.87 +endif
    1.88 +endif
    1.89 +endif
    1.90 +ifdef IMPORT_LIBRARY
    1.91 +	$(INSTALL) -m 775 $(IMPORT_LIBRARY) $(SOURCE_LIB_DIR)
    1.92 +endif
    1.93 +ifdef PROGRAM
    1.94 +	$(INSTALL) -m 775 $(PROGRAM) $(SOURCE_BIN_DIR)
    1.95 +ifdef MOZ_DEBUG_SYMBOLS
    1.96 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
    1.97 +	$(INSTALL) -m 644 $(PROGRAM:$(PROG_SUFFIX)=.pdb) $(SOURCE_BIN_DIR)
    1.98 +endif
    1.99 +endif
   1.100 +endif
   1.101 +ifdef PROGRAMS
   1.102 +	$(INSTALL) -m 775 $(PROGRAMS) $(SOURCE_BIN_DIR)
   1.103 +endif
   1.104 +	+$(LOOP_OVER_DIRS)
   1.105 +
   1.106 +tests::
   1.107 +	+$(LOOP_OVER_DIRS)
   1.108 +
   1.109 +clean clobber::
   1.110 +	rm -rf $(ALL_TRASH)
   1.111 +	+$(LOOP_OVER_DIRS)
   1.112 +
   1.113 +realclean clobber_all::
   1.114 +	rm -rf $(wildcard *.OBJ) dist $(ALL_TRASH)
   1.115 +	+$(LOOP_OVER_DIRS)
   1.116 +
   1.117 +#######################################################################
   1.118 +# Double-Colon rules for populating the binary release model.         #
   1.119 +#######################################################################
   1.120 +
   1.121 +
   1.122 +release_clean::
   1.123 +	rm -rf $(SOURCE_XP_DIR)/release/$(RELEASE_MD_DIR)
   1.124 +
   1.125 +release:: release_clean release_export release_classes release_policy release_md release_jars release_cpdistdir
   1.126 +
   1.127 +release_cpdistdir::
   1.128 +	@echo "== cpdist.pl =="
   1.129 +	@$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/cpdist.pl \
   1.130 +		"RELEASE_TREE=$(RELEASE_TREE)" \
   1.131 +		"CORE_DEPTH=$(CORE_DEPTH)" \
   1.132 +		"MODULE=${MODULE}" \
   1.133 +		"OS_ARCH=$(OS_ARCH)" \
   1.134 +		"RELEASE=$(RELEASE)" \
   1.135 +		"PLATFORM=$(PLATFORM)" \
   1.136 +		"RELEASE_VERSION=$(RELEASE_VERSION)" \
   1.137 +		"SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
   1.138 +		"RELEASE_XP_DIR=$(RELEASE_XP_DIR)" \
   1.139 +		"RELEASE_MD_DIR=$(RELEASE_MD_DIR)" \
   1.140 +		"FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR) XP_FILES MD_FILES" \
   1.141 +		"$(XPCLASS_JAR)=$(SOURCE_RELEASE_CLASSES_DIR)|x"\
   1.142 +		"$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_CLASSES_DBG_DIR)|x"\
   1.143 +		"$(XPHEADER_JAR)=$(SOURCE_RELEASE_XPHEADERS_DIR)|x" \
   1.144 +		"$(MDHEADER_JAR)=$(SOURCE_RELEASE_MDHEADERS_DIR)|m" \
   1.145 +		"$(MDBINARY_JAR)=$(SOURCE_RELEASE_MD_DIR)|m" \
   1.146 +		"XP_FILES=$(XP_FILES)|xf" \
   1.147 +		"MD_FILES=$(MD_FILES)|mf"
   1.148 +
   1.149 +
   1.150 +# $(SOURCE_RELEASE_xxx_JAR) is a name like yyy.jar
   1.151 +# $(SOURCE_RELEASE_xx_DIR)  is a name like 
   1.152 +
   1.153 +release_jars::
   1.154 +	@echo "== release.pl =="
   1.155 +	@$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/release.pl \
   1.156 +		"RELEASE_TREE=$(RELEASE_TREE)" \
   1.157 +		"PLATFORM=$(PLATFORM)" \
   1.158 +		"OS_ARCH=$(OS_ARCH)" \
   1.159 +		"RELEASE_VERSION=$(RELEASE_VERSION)" \
   1.160 +		"SOURCE_RELEASE_DIR=$(SOURCE_RELEASE_DIR)" \
   1.161 +		"FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
   1.162 +		"$(XPCLASS_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)|b"\
   1.163 +		"$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)|b"\
   1.164 +		"$(XPHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_XPHEADERS_DIR)|a" \
   1.165 +		"$(MDHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MDHEADERS_DIR)|a" \
   1.166 +		"$(MDBINARY_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MD_DIR)|bi"
   1.167 +
   1.168 +# Rules for releasing classes.
   1.169 +# We have to do some REALLY gross stuff to deal with multiple classes in one
   1.170 +# file, as well as nested classes, which have a filename of the form
   1.171 +# ContainingClass$NestedClass.class.
   1.172 +# RELEASE_CLASSES simply performs a required patsubst on CLASSES
   1.173 +# RELEASE_CLASS_PATH is RELEASE_CLASSES with the path (in ns/dist) prepended
   1.174 +# RELEASE_NESTED is all the nested classes in RELEASE_CLASS_PATH.  We use a
   1.175 +#   foreach and wildcard to get all the files that start out like one of the
   1.176 +#   class files, then have a $.  So, for each class file, we look for file$*
   1.177 +# RELEASE_FILES is the combination of RELEASE_NESTED and the class files
   1.178 +#   specified by RELEASE_CLASSES which have .class appended to them.  Note that
   1.179 +#   the RELEASE_NESTED don't need to have .class appended because they were
   1.180 +#   read in from the wildcard as complete filenames.
   1.181 +#
   1.182 +# The _DBG versions are the debuggable ones.
   1.183 +ifneq ($(CLASSES),)
   1.184 +
   1.185 +RELEASE_CLASSES := $(patsubst %,%,$(CLASSES))
   1.186 +
   1.187 +ifdef BUILD_OPT
   1.188 +	RELEASE_CLASS_PATH := $(patsubst %,$(SOURCE_CLASSES_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES))
   1.189 +	RELEASE_NESTED := $(foreach file,$(RELEASE_CLASS_PATH),$(wildcard $(file)$$*))
   1.190 +	RELEASE_FILES := $(patsubst %,%.class,$(RELEASE_CLASS_PATH)) $(RELEASE_NESTED)
   1.191 +else
   1.192 +	RELEASE_DBG_CLASS_PATH:= $(patsubst %,$(SOURCE_CLASSES_DBG_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES))
   1.193 +	RELEASE_DBG_NESTED := $(foreach file,$(RELEASE_DBG_CLASS_PATH),$(wildcard $(file)$$*))
   1.194 +	RELEASE_DBG_FILES := $(patsubst %,%.class,$(RELEASE_DBG_CLASS_PATH)) $(RELEASE_DBG_NESTED)
   1.195 +endif
   1.196 +
   1.197 +# Substitute \$ for $ so the shell doesn't choke
   1.198 +ifdef BUILD_OPT
   1.199 +release_classes::
   1.200 +	$(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)/$(PACKAGE)
   1.201 +else
   1.202 +release_classes::
   1.203 +	$(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_DBG_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)/$(PACKAGE)
   1.204 +endif
   1.205 +
   1.206 +endif
   1.207 +
   1.208 +release_policy::
   1.209 +	+$(LOOP_OVER_DIRS)
   1.210 +
   1.211 +ifndef NO_MD_RELEASE
   1.212 +    ifdef LIBRARY
   1.213 +        MD_LIB_RELEASE_FILES +=  $(LIBRARY)
   1.214 +    endif
   1.215 +    ifdef SHARED_LIBRARY
   1.216 +        MD_LIB_RELEASE_FILES +=  $(SHARED_LIBRARY)
   1.217 +    endif
   1.218 +    ifdef IMPORT_LIBRARY
   1.219 +        MD_LIB_RELEASE_FILES +=  $(IMPORT_LIBRARY)
   1.220 +    endif
   1.221 +    ifdef PROGRAM
   1.222 +        MD_BIN_RELEASE_FILES +=  $(PROGRAM)
   1.223 +    endif
   1.224 +    ifdef PROGRAMS
   1.225 +        MD_BIN_RELEASE_FILES +=  $(PROGRAMS)
   1.226 +    endif
   1.227 +endif
   1.228 +
   1.229 +release_md::
   1.230 +ifneq ($(MD_LIB_RELEASE_FILES),)
   1.231 +	$(INSTALL) -m 444 $(MD_LIB_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)
   1.232 +endif
   1.233 +ifneq ($(MD_BIN_RELEASE_FILES),)
   1.234 +	$(INSTALL) -m 555 $(MD_BIN_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_BIN_DIR)
   1.235 +endif
   1.236 +	+$(LOOP_OVER_DIRS)
   1.237 +
   1.238 +
   1.239 +alltags:
   1.240 +	rm -f TAGS
   1.241 +	find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
   1.242 +	find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
   1.243 +
   1.244 +$(PROGRAM): $(OBJS) $(EXTRA_LIBS)
   1.245 +	@$(MAKE_OBJDIR)
   1.246 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
   1.247 +	$(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
   1.248 +ifdef MT
   1.249 +	if test -f $@.manifest; then \
   1.250 +		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.251 +		rm -f $@.manifest; \
   1.252 +	fi
   1.253 +endif	# MSVC with manifest tool
   1.254 +else
   1.255 +	$(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
   1.256 +endif
   1.257 +
   1.258 +get_objs:
   1.259 +	@echo $(OBJS)
   1.260 +
   1.261 +$(LIBRARY): $(OBJS)
   1.262 +	@$(MAKE_OBJDIR)
   1.263 +	rm -f $@
   1.264 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
   1.265 +	$(AR) $(subst /,\\,$(OBJS))
   1.266 +else
   1.267 +	$(AR) $(OBJS)
   1.268 +endif
   1.269 +	$(RANLIB) $@
   1.270 +
   1.271 +
   1.272 +ifeq ($(OS_TARGET),OS2)
   1.273 +$(IMPORT_LIBRARY): $(MAPFILE)
   1.274 +	rm -f $@
   1.275 +	$(IMPLIB) $@ $<
   1.276 +	$(RANLIB) $@
   1.277 +endif
   1.278 +
   1.279 +ifdef SHARED_LIBRARY_LIBS
   1.280 +ifdef BUILD_TREE
   1.281 +SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(shell $(MAKE) -C $(dir) --no-print-directory get_objs))
   1.282 +else
   1.283 +SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(addprefix $(dir)/,$(shell $(MAKE) -C $(dir) --no-print-directory get_objs)))
   1.284 +endif
   1.285 +endif
   1.286 +
   1.287 +$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) $(SUB_SHLOBJS)
   1.288 +	@$(MAKE_OBJDIR)
   1.289 +	rm -f $@
   1.290 +ifeq ($(OS_TARGET)$(OS_RELEASE), AIX4.1)
   1.291 +	echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
   1.292 +	nm -B -C -g $(OBJS) \
   1.293 +	| awk '/ [T,D] / {print $$3}' \
   1.294 +	| sed -e 's/^\.//' \
   1.295 +	| sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
   1.296 +	$(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
   1.297 +	-bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS)
   1.298 +else
   1.299 +ifeq (,$(filter-out WIN%,$(OS_TARGET)))
   1.300 +ifdef NS_USE_GCC
   1.301 +	$(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
   1.302 +else
   1.303 +	$(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
   1.304 +ifdef MT
   1.305 +	if test -f $@.manifest; then \
   1.306 +		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
   1.307 +		rm -f $@.manifest; \
   1.308 +	fi
   1.309 +endif	# MSVC with manifest tool
   1.310 +endif
   1.311 +else
   1.312 +	$(MKSHLIB) -o $@ $(OBJS) $(SUB_SHLOBJS) $(LD_LIBS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
   1.313 +	chmod +x $@
   1.314 +endif
   1.315 +endif
   1.316 +
   1.317 +ifeq (,$(filter-out WIN%,$(OS_TARGET)))
   1.318 +$(RES): $(RESNAME)
   1.319 +	@$(MAKE_OBJDIR)
   1.320 +# The resource compiler does not understand the -U option.
   1.321 +ifdef NS_USE_GCC
   1.322 +	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
   1.323 +else
   1.324 +	$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
   1.325 +endif
   1.326 +	@echo $(RES) finished
   1.327 +endif
   1.328 +
   1.329 +$(MAPFILE): $(MAPFILE_SOURCE)
   1.330 +	@$(MAKE_OBJDIR)
   1.331 +	$(PROCESS_MAP_FILE)
   1.332 +
   1.333 +
   1.334 +$(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX)
   1.335 +	@$(MAKE_OBJDIR)
   1.336 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
   1.337 +	$(MKPROG) $< -Fe$@ -link \
   1.338 +	$(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
   1.339 +ifdef MT
   1.340 +	if test -f $@.manifest; then \
   1.341 +		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
   1.342 +		rm -f $@.manifest; \
   1.343 +	fi
   1.344 +endif	# MSVC with manifest tool
   1.345 +else
   1.346 +	$(MKPROG) -o $@ $(CFLAGS) $< \
   1.347 +	$(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
   1.348 +endif
   1.349 +
   1.350 +WCCFLAGS1 := $(subst /,\\,$(CFLAGS))
   1.351 +WCCFLAGS2 := $(subst -I,-i=,$(WCCFLAGS1))
   1.352 +WCCFLAGS3 := $(subst -D,-d,$(WCCFLAGS2))
   1.353 +
   1.354 +# Translate source filenames to absolute paths. This is required for
   1.355 +# debuggers under Windows & OS/2 to find source files automatically
   1.356 +
   1.357 +ifeq (,$(filter-out OS2 AIX,$(OS_TARGET)))
   1.358 +# OS/2 and AIX
   1.359 +NEED_ABSOLUTE_PATH := 1
   1.360 +PWD := $(shell pwd)
   1.361 +
   1.362 +else
   1.363 +# Windows
   1.364 +ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
   1.365 +NEED_ABSOLUTE_PATH := 1
   1.366 +ifdef .PYMAKE
   1.367 +PWD := $(CURDIR)
   1.368 +else
   1.369 +PWD := $(shell pwd)
   1.370 +ifeq (,$(findstring ;,$(PATH)))
   1.371 +ifndef USE_MSYS
   1.372 +PWD := $(subst \,/,$(shell cygpath -w $(PWD)))
   1.373 +endif
   1.374 +endif
   1.375 +endif
   1.376 +
   1.377 +else
   1.378 +# everything else
   1.379 +PWD := $(shell pwd)
   1.380 +endif
   1.381 +endif
   1.382 +
   1.383 +# The quotes allow absolute paths to contain spaces.
   1.384 +core_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))"
   1.385 +
   1.386 +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
   1.387 +	@$(MAKE_OBJDIR)
   1.388 +ifdef USE_NT_C_SYNTAX
   1.389 +	$(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
   1.390 +else
   1.391 +ifdef NEED_ABSOLUTE_PATH
   1.392 +	$(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
   1.393 +else
   1.394 +	$(CC) -o $@ -c $(CFLAGS) $<
   1.395 +endif
   1.396 +endif
   1.397 +
   1.398 +$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
   1.399 +ifdef USE_NT_C_SYNTAX
   1.400 +	$(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
   1.401 +else
   1.402 +ifdef NEED_ABSOLUTE_PATH
   1.403 +	$(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
   1.404 +else
   1.405 +	$(CC) -o $@ -c $(CFLAGS) $<
   1.406 +endif
   1.407 +endif
   1.408 +
   1.409 +ifneq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
   1.410 +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s
   1.411 +	@$(MAKE_OBJDIR)
   1.412 +	$(AS) -o $@ $(ASFLAGS) -c $<
   1.413 +endif
   1.414 +
   1.415 +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.asm
   1.416 +	@$(MAKE_OBJDIR)
   1.417 +	$(AS) -Fo$@ $(ASFLAGS) -c $<
   1.418 +
   1.419 +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S
   1.420 +	@$(MAKE_OBJDIR)
   1.421 +	$(AS) -o $@ $(ASFLAGS) -c $<
   1.422 +
   1.423 +$(OBJDIR)/$(PROG_PREFIX)%: %.cpp
   1.424 +	@$(MAKE_OBJDIR)
   1.425 +ifdef USE_NT_C_SYNTAX
   1.426 +	$(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
   1.427 +else
   1.428 +ifdef NEED_ABSOLUTE_PATH
   1.429 +	$(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
   1.430 +else
   1.431 +	$(CCC) -o $@ -c $(CFLAGS) $<
   1.432 +endif
   1.433 +endif
   1.434 +
   1.435 +#
   1.436 +# Please keep the next two rules in sync.
   1.437 +#
   1.438 +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc
   1.439 +	@$(MAKE_OBJDIR)
   1.440 +	$(CCC) -o $@ -c $(CFLAGS) $<
   1.441 +
   1.442 +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp
   1.443 +	@$(MAKE_OBJDIR)
   1.444 +ifdef STRICT_CPLUSPLUS_SUFFIX
   1.445 +	echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
   1.446 +	$(CCC) -o $@ -c $(CFLAGS) $(OBJDIR)/t_$*.cc
   1.447 +	rm -f $(OBJDIR)/t_$*.cc
   1.448 +else
   1.449 +ifdef USE_NT_C_SYNTAX
   1.450 +	$(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
   1.451 +else
   1.452 +ifdef NEED_ABSOLUTE_PATH
   1.453 +	$(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
   1.454 +else
   1.455 +	$(CCC) -o $@ -c $(CFLAGS) $<
   1.456 +endif
   1.457 +endif
   1.458 +endif #STRICT_CPLUSPLUS_SUFFIX
   1.459 +
   1.460 +%.i: %.cpp
   1.461 +	$(CCC) -C -E $(CFLAGS) $< > $@
   1.462 +
   1.463 +%.i: %.c
   1.464 +ifeq (,$(filter-out WIN%,$(OS_TARGET)))
   1.465 +	$(CC) -C /P $(CFLAGS) $< 
   1.466 +else
   1.467 +	$(CC) -C -E $(CFLAGS) $< > $@
   1.468 +endif
   1.469 +
   1.470 +ifneq (,$(filter-out WIN%,$(OS_TARGET)))
   1.471 +%.i: %.s
   1.472 +	$(CC) -C -E $(CFLAGS) $< > $@
   1.473 +endif
   1.474 +
   1.475 +%: %.pl
   1.476 +	rm -f $@; cp $< $@; chmod +x $@
   1.477 +
   1.478 +%: %.sh
   1.479 +	rm -f $@; cp $< $@; chmod +x $@
   1.480 +
   1.481 +################################################################################
   1.482 +# Bunch of things that extend the 'export' rule (in order):
   1.483 +################################################################################
   1.484 +
   1.485 +$(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR)::
   1.486 +	@if test ! -d $@; then	    \
   1.487 +		echo Creating $@;   \
   1.488 +		rm -rf $@;	    \
   1.489 +		$(NSINSTALL) -D $@; \
   1.490 +	fi
   1.491 +
   1.492 +################################################################################
   1.493 +## IDL_GEN
   1.494 +
   1.495 +ifneq ($(IDL_GEN),)
   1.496 +
   1.497 +#export::
   1.498 +#	$(IDL2JAVA) $(IDL_GEN)
   1.499 +
   1.500 +#all:: export
   1.501 +
   1.502 +#clobber::
   1.503 +#	rm -f $(IDL_GEN:.idl=.class)	# XXX wrong!
   1.504 +
   1.505 +endif
   1.506 +
   1.507 +################################################################################
   1.508 +### JSRCS -- for compiling java files
   1.509 +###
   1.510 +###          NOTE:  For backwards compatibility, if $(NETLIBDEPTH) is defined,
   1.511 +###                 replace $(CORE_DEPTH) with $(NETLIBDEPTH).
   1.512 +###
   1.513 +
   1.514 +ifneq ($(JSRCS),)
   1.515 +ifneq ($(JAVAC),)
   1.516 +ifdef NETLIBDEPTH
   1.517 +	CORE_DEPTH := $(NETLIBDEPTH)
   1.518 +endif
   1.519 +
   1.520 +JAVA_EXPORT_SRCS=$(shell $(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG)	-d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS) $(PRIVATE_JSRCS))
   1.521 +
   1.522 +export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
   1.523 +ifneq ($(JAVA_EXPORT_SRCS),)
   1.524 +	$(JAVAC) $(JAVA_EXPORT_SRCS)
   1.525 +endif
   1.526 +
   1.527 +all:: export
   1.528 +
   1.529 +clobber::
   1.530 +	rm -f $(SOURCE_XP_DIR)/classes/$(PACKAGE)/*.class
   1.531 +
   1.532 +endif
   1.533 +endif
   1.534 +
   1.535 +#
   1.536 +# JDIRS -- like JSRCS, except you can give a list of directories and it will
   1.537 +# compile all the out-of-date java files in those directories.
   1.538 +#
   1.539 +# NOTE: recursing through these can speed things up, but they also cause
   1.540 +# some builds to run out of memory
   1.541 +#
   1.542 +# NOTE:  For backwards compatibility, if $(NETLIBDEPTH) is defined,
   1.543 +#        replace $(CORE_DEPTH) with $(NETLIBDEPTH).
   1.544 +#
   1.545 +ifdef JDIRS
   1.546 +ifneq ($(JAVAC),)
   1.547 +ifdef NETLIBDEPTH
   1.548 +	CORE_DEPTH := $(NETLIBDEPTH)
   1.549 +endif
   1.550 +
   1.551 +# !!!!! THIS WILL CRASH SHMSDOS.EXE !!!!!
   1.552 +# shmsdos does not support shell variables. It will crash when it tries
   1.553 +# to parse the '=' character. A solution is to rewrite outofdate.pl so it
   1.554 +# takes the Javac command as an argument and executes the command itself,
   1.555 +# instead of returning a list of files.
   1.556 +export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
   1.557 +	@echo "!!! THIS COMMAND IS BROKEN ON WINDOWS--SEE rules.mk FOR DETAILS !!!"
   1.558 +	return -1
   1.559 +	@for d in $(JDIRS); do							\
   1.560 +		if test -d $$d; then						\
   1.561 +			set $(EXIT_ON_ERROR);					\
   1.562 +			files=`echo $$d/*.java`;				\
   1.563 +			list=`$(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG)	\
   1.564 +				    -d $(JAVA_DESTPATH)/$(PACKAGE) $$files`;	\
   1.565 +			if test "$${list}x" != "x"; then			\
   1.566 +			    echo Building all java files in $$d;		\
   1.567 +			    echo $(JAVAC) $$list;				\
   1.568 +			    $(JAVAC) $$list;					\
   1.569 +			fi;							\
   1.570 +			set +e;							\
   1.571 +		else								\
   1.572 +			echo "Skipping non-directory $$d...";			\
   1.573 +		fi;								\
   1.574 +		$(CLICK_STOPWATCH);						\
   1.575 +	done
   1.576 +endif
   1.577 +endif
   1.578 +
   1.579 +#
   1.580 +# JDK_GEN -- for generating "old style" native methods 
   1.581 +#
   1.582 +# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
   1.583 +#
   1.584 +# NOTE:  For backwards compatibility, if $(NETLIBDEPTH) is defined,
   1.585 +#        replace $(CORE_DEPTH) with $(NETLIBDEPTH).
   1.586 +#
   1.587 +ifneq ($(JDK_GEN),)
   1.588 +ifneq ($(JAVAH),)
   1.589 +ifdef NSBUILDROOT
   1.590 +	INCLUDES += -I$(JDK_GEN_DIR) -I$(SOURCE_XP_DIR)
   1.591 +else
   1.592 +	INCLUDES += -I$(JDK_GEN_DIR)
   1.593 +endif
   1.594 +
   1.595 +ifdef NETLIBDEPTH
   1.596 +	CORE_DEPTH := $(NETLIBDEPTH)
   1.597 +endif
   1.598 +
   1.599 +JDK_PACKAGE_CLASSES	:= $(JDK_GEN)
   1.600 +JDK_PATH_CLASSES	:= $(subst .,/,$(JDK_PACKAGE_CLASSES))
   1.601 +JDK_HEADER_CLASSFILES	:= $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
   1.602 +JDK_STUB_CLASSFILES	:= $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
   1.603 +JDK_HEADER_CFILES	:= $(patsubst %,$(JDK_GEN_DIR)/%.h,$(JDK_GEN))
   1.604 +JDK_STUB_CFILES		:= $(patsubst %,$(JDK_STUB_DIR)/%.c,$(JDK_GEN))
   1.605 +
   1.606 +$(JDK_HEADER_CFILES): $(JDK_HEADER_CLASSFILES)
   1.607 +$(JDK_STUB_CFILES): $(JDK_STUB_CLASSFILES)
   1.608 +
   1.609 +export::
   1.610 +	@echo Generating/Updating JDK headers 
   1.611 +	$(JAVAH) -d $(JDK_GEN_DIR) $(JDK_PACKAGE_CLASSES)
   1.612 +	@echo Generating/Updating JDK stubs
   1.613 +	$(JAVAH) -stubs -d $(JDK_STUB_DIR) $(JDK_PACKAGE_CLASSES)
   1.614 +ifndef NO_MAC_JAVA_SHIT
   1.615 +	@if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then						\
   1.616 +		echo "!!! You need to have a ns/lib/mac/Java directory checked out.";		\
   1.617 +		echo "!!! This allows us to automatically update generated files for the mac.";	\
   1.618 +		echo "!!! If you see any modified files there, please check them in.";		\
   1.619 +	fi
   1.620 +	@echo Generating/Updating JDK headers for the Mac
   1.621 +	$(JAVAH) -mac -d $(CORE_DEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES)
   1.622 +	@echo Generating/Updating JDK stubs for the Mac
   1.623 +	$(JAVAH) -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES)
   1.624 +endif
   1.625 +endif
   1.626 +endif
   1.627 +
   1.628 +#
   1.629 +# JRI_GEN -- for generating "old style" JRI native methods
   1.630 +#
   1.631 +# Generate JRI Headers and Stubs into the 'jri' directory
   1.632 +#
   1.633 +# NOTE:  For backwards compatibility, if $(NETLIBDEPTH) is defined,
   1.634 +#        replace $(CORE_DEPTH) with $(NETLIBDEPTH).
   1.635 +#
   1.636 +ifneq ($(JRI_GEN),)
   1.637 +ifneq ($(JAVAH),)
   1.638 +ifdef NSBUILDROOT
   1.639 +	INCLUDES += -I$(JRI_GEN_DIR) -I$(SOURCE_XP_DIR)
   1.640 +else
   1.641 +	INCLUDES += -I$(JRI_GEN_DIR)
   1.642 +endif
   1.643 +
   1.644 +ifdef NETLIBDEPTH
   1.645 +	CORE_DEPTH := $(NETLIBDEPTH)
   1.646 +endif
   1.647 +
   1.648 +JRI_PACKAGE_CLASSES	:= $(JRI_GEN)
   1.649 +JRI_PATH_CLASSES	:= $(subst .,/,$(JRI_PACKAGE_CLASSES))
   1.650 +JRI_HEADER_CLASSFILES	:= $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES))
   1.651 +JRI_STUB_CLASSFILES	:= $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES))
   1.652 +JRI_HEADER_CFILES	:= $(patsubst %,$(JRI_GEN_DIR)/%.h,$(JRI_GEN))
   1.653 +JRI_STUB_CFILES		:= $(patsubst %,$(JRI_GEN_DIR)/%.c,$(JRI_GEN))
   1.654 +
   1.655 +$(JRI_HEADER_CFILES): $(JRI_HEADER_CLASSFILES)
   1.656 +$(JRI_STUB_CFILES): $(JRI_STUB_CLASSFILES)
   1.657 +
   1.658 +export::
   1.659 +	@echo Generating/Updating JRI headers 
   1.660 +	$(JAVAH) -jri -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
   1.661 +	@echo Generating/Updating JRI stubs
   1.662 +	$(JAVAH) -jri -stubs -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
   1.663 +ifndef NO_MAC_JAVA_SHIT
   1.664 +	@if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then						\
   1.665 +		echo "!!! You need to have a ns/lib/mac/Java directory checked out.";		\
   1.666 +		echo "!!! This allows us to automatically update generated files for the mac.";	\
   1.667 +		echo "!!! If you see any modified files there, please check them in.";		\
   1.668 +	fi
   1.669 +	@echo Generating/Updating JRI headers for the Mac
   1.670 +	$(JAVAH) -jri -mac -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
   1.671 +	@echo Generating/Updating JRI stubs for the Mac
   1.672 +	$(JAVAH) -jri -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
   1.673 +endif
   1.674 +endif
   1.675 +endif
   1.676 +
   1.677 +#
   1.678 +# JNI_GEN -- for generating JNI native methods
   1.679 +#
   1.680 +# Generate JNI Headers into the 'jni' directory
   1.681 +#
   1.682 +ifneq ($(JNI_GEN),)
   1.683 +ifneq ($(JAVAH),)
   1.684 +JNI_HEADERS		:= $(patsubst %,$(JNI_GEN_DIR)/%.h,$(JNI_GEN))
   1.685 +
   1.686 +export::
   1.687 +	@if test ! -d $(JNI_GEN_DIR); then						\
   1.688 +		echo $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN);			\
   1.689 +		$(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN);				\
   1.690 +	else										\
   1.691 +		echo "Checking for out of date header files" ;                          \
   1.692 +		$(PERL) $(CORE_DEPTH)/coreconf/jniregen.pl $(PERLARG)			\
   1.693 +		 -d $(JAVA_DESTPATH) -j "$(JAVAH) -jni -d $(JNI_GEN_DIR)" $(JNI_GEN);\
   1.694 +	fi
   1.695 +endif
   1.696 +endif
   1.697 +
   1.698 +#
   1.699 +# JMC_EXPORT -- for declaring which java classes are to be exported for jmc
   1.700 +#
   1.701 +ifneq ($(JMC_EXPORT),)
   1.702 +JMC_EXPORT_PATHS	:= $(subst .,/,$(JMC_EXPORT))
   1.703 +JMC_EXPORT_FILES	:= $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS))
   1.704 +
   1.705 +#
   1.706 +# We're doing NSINSTALL -t here (copy mode) because calling INSTALL will pick up 
   1.707 +# your NSDISTMODE and make links relative to the current directory. This is a
   1.708 +# problem because the source isn't in the current directory:
   1.709 +#
   1.710 +export:: $(JMC_EXPORT_FILES) $(JMCSRCDIR)
   1.711 +	$(NSINSTALL) -t -m 444 $(JMC_EXPORT_FILES) $(JMCSRCDIR)
   1.712 +endif
   1.713 +
   1.714 +#
   1.715 +# JMC_GEN -- for generating java modules
   1.716 +#
   1.717 +# Provide default export & install rules when using JMC_GEN
   1.718 +#
   1.719 +ifneq ($(JMC_GEN),)
   1.720 +ifneq ($(JMC),)
   1.721 +	INCLUDES    += -I$(JMC_GEN_DIR) -I.
   1.722 +	JMC_HEADERS := $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN))
   1.723 +	JMC_STUBS   := $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN))
   1.724 +	JMC_OBJS    := $(patsubst %,$(OBJDIR)/%$(OBJ_SUFFIX),$(JMC_GEN))
   1.725 +
   1.726 +$(JMC_GEN_DIR)/M%.h: $(JMCSRCDIR)/%.class
   1.727 +	$(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)
   1.728 +
   1.729 +$(JMC_GEN_DIR)/M%.c: $(JMCSRCDIR)/%.class
   1.730 +	$(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)
   1.731 +
   1.732 +$(OBJDIR)/M%$(OBJ_SUFFIX): $(JMC_GEN_DIR)/M%.c $(JMC_GEN_DIR)/M%.h
   1.733 +	@$(MAKE_OBJDIR)
   1.734 +	$(CC) -o $@ -c $(CFLAGS) $<
   1.735 +
   1.736 +export:: $(JMC_HEADERS) $(JMC_STUBS)
   1.737 +endif
   1.738 +endif
   1.739 +
   1.740 +#
   1.741 +# Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/
   1.742 +#
   1.743 +PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE)
   1.744 +
   1.745 +ifneq ($(EXPORTS),)
   1.746 +$(PUBLIC_EXPORT_DIR)::
   1.747 +	@if test ! -d $@; then	    \
   1.748 +		echo Creating $@;   \
   1.749 +		$(NSINSTALL) -D $@; \
   1.750 +	fi
   1.751 +
   1.752 +export:: $(PUBLIC_EXPORT_DIR) 
   1.753 +
   1.754 +export:: $(EXPORTS) 
   1.755 +	$(INSTALL) -m 444 $^ $(PUBLIC_EXPORT_DIR)
   1.756 +
   1.757 +export:: $(BUILT_SRCS)
   1.758 +endif
   1.759 +
   1.760 +# Duplicate export rule for private exports, with different directories
   1.761 +
   1.762 +PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/private/$(MODULE)
   1.763 +
   1.764 +ifneq ($(PRIVATE_EXPORTS),)
   1.765 +$(PRIVATE_EXPORT_DIR)::
   1.766 +	@if test ! -d $@; then	    \
   1.767 +		echo Creating $@;   \
   1.768 +		$(NSINSTALL) -D $@; \
   1.769 +	fi
   1.770 +
   1.771 +private_export:: $(PRIVATE_EXPORT_DIR)
   1.772 +
   1.773 +private_export:: $(PRIVATE_EXPORTS) 
   1.774 +	$(INSTALL) -m 444 $^ $(PRIVATE_EXPORT_DIR)
   1.775 +else
   1.776 +private_export:: 
   1.777 +	@echo There are no private exports.;
   1.778 +endif
   1.779 +
   1.780 +##########################################################################
   1.781 +###   RULES FOR RUNNING REGRESSION SUITE TESTS
   1.782 +###   REQUIRES 'REGRESSION_SPEC' TO BE SET TO THE NAME OF A REGRESSION SPECFILE
   1.783 +###   AND RESULTS_SUBDIR TO BE SET TO SOMETHING LIKE SECURITY/PKCS5
   1.784 +##########################################################################
   1.785 +
   1.786 +TESTS_DIR = $(RESULTS_DIR)/$(RESULTS_SUBDIR)/$(OS_TARGET)$(OS_RELEASE)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)
   1.787 +
   1.788 +ifneq ($(REGRESSION_SPEC),)
   1.789 +
   1.790 +ifneq ($(BUILD_OPT),)
   1.791 +REGDATE = $(subst \ ,, $(shell $(PERL)  $(CORE_DEPTH)/$(MODULE)/scripts/now))
   1.792 +endif
   1.793 +
   1.794 +tests:: $(REGRESSION_SPEC) 
   1.795 +	cd $(PLATFORM); \
   1.796 +	../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS); \
   1.797 +	if test ! -d $(TESTS_DIR); then \
   1.798 +		echo Creating $(TESTS_DIR);   \
   1.799 +		$(NSINSTALL) -D $(TESTS_DIR); \
   1.800 +	fi
   1.801 +ifneq ($(BUILD_OPT),)
   1.802 +	$(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).sum $(TESTS_DIR); \
   1.803 +	$(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).htm $(TESTS_DIR); \
   1.804 +	echo "Please now make sure your results files are copied to $(TESTS_DIR), "; \
   1.805 +	echo "then run 'reporter specfile=$(RESULTS_DIR)/rptspec'"
   1.806 +endif
   1.807 +else
   1.808 +tests:: 
   1.809 +	@echo Error: you didn't specify REGRESSION_SPEC in your manifest.mn file!;
   1.810 +endif
   1.811 +
   1.812 +
   1.813 +# Duplicate export rule for releases, with different directories
   1.814 +
   1.815 +ifneq ($(EXPORTS),)
   1.816 +$(SOURCE_RELEASE_XP_DIR)/include::
   1.817 +	@if test ! -d $@; then	    \
   1.818 +		echo Creating $@;   \
   1.819 +		$(NSINSTALL) -D $@; \
   1.820 +	fi
   1.821 +
   1.822 +release_export:: $(SOURCE_RELEASE_XP_DIR)/include
   1.823 +
   1.824 +release_export:: $(EXPORTS)
   1.825 +	$(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include
   1.826 +endif
   1.827 +
   1.828 +
   1.829 +
   1.830 +
   1.831 +################################################################################
   1.832 +
   1.833 +-include $(DEPENDENCIES)
   1.834 +
   1.835 +ifneq (,$(filter-out OS2 WIN%,$(OS_TARGET)))
   1.836 +# Can't use sed because of its 4000-char line length limit, so resort to perl
   1.837 +PERL_DEPENDENCIES_PROGRAM =                                                   \
   1.838 +	    open(MD, "< $(DEPENDENCIES)");                                    \
   1.839 +	    while (<MD>) {                                                    \
   1.840 +		if (m@ \.*/*$< @) {                                           \
   1.841 +		    $$found = 1;                                              \
   1.842 +		    last;                                                     \
   1.843 +		}                                                             \
   1.844 +	    }                                                                 \
   1.845 +	    if ($$found) {                                                    \
   1.846 +		print "Removing stale dependency $< from $(DEPENDENCIES)\n";  \
   1.847 +		seek(MD, 0, 0);                                               \
   1.848 +		$$tmpname = "$(OBJDIR)/fix.md" . $$$$;                        \
   1.849 +		open(TMD, "> " . $$tmpname);                                  \
   1.850 +		while (<MD>) {                                                \
   1.851 +		    s@ \.*/*$< @ @;                                           \
   1.852 +		    if (!print TMD "$$_") {                                   \
   1.853 +			unlink(($$tmpname));                                  \
   1.854 +			exit(1);                                              \
   1.855 +		    }                                                         \
   1.856 +		}                                                             \
   1.857 +		close(TMD);                                                   \
   1.858 +		if (!rename($$tmpname, "$(DEPENDENCIES)")) {                  \
   1.859 +		    unlink(($$tmpname));                                      \
   1.860 +		}                                                             \
   1.861 +	    } elsif ("$<" ne "$(DEPENDENCIES)") {                             \
   1.862 +		print "$(MAKE): *** No rule to make target $<.  Stop.\n";     \
   1.863 +		exit(1);                                                      \
   1.864 +	    }
   1.865 +
   1.866 +.DEFAULT:
   1.867 +	@$(PERL) -e '$(PERL_DEPENDENCIES_PROGRAM)'
   1.868 +endif
   1.869 +
   1.870 +#############################################################################
   1.871 +# X dependency system
   1.872 +#############################################################################
   1.873 +
   1.874 +ifdef MKDEPENDENCIES
   1.875 +
   1.876 +# For Windows, $(MKDEPENDENCIES) must be -included before including rules.mk
   1.877 +
   1.878 +$(MKDEPENDENCIES)::
   1.879 +	@$(MAKE_OBJDIR)
   1.880 +	touch $(MKDEPENDENCIES) 
   1.881 +	chmod u+w $(MKDEPENDENCIES) 
   1.882 +#on NT, the preceding touch command creates a read-only file !?!?!
   1.883 +#which is why we have to explicitly chmod it.
   1.884 +	$(MKDEPEND) -p$(OBJDIR_NAME)/ -o'$(OBJ_SUFFIX)' -f$(MKDEPENDENCIES) \
   1.885 +$(NOMD_CFLAGS) $(YOPT) $(CSRCS) $(CPPSRCS) $(ASFILES)
   1.886 +
   1.887 +$(MKDEPEND):: $(MKDEPEND_DIR)/*.c $(MKDEPEND_DIR)/*.h
   1.888 +	$(MAKE) -C $(MKDEPEND_DIR)
   1.889 +
   1.890 +ifdef OBJS
   1.891 +depend:: $(MKDEPEND) $(MKDEPENDENCIES)
   1.892 +else
   1.893 +depend::
   1.894 +endif
   1.895 +	+$(LOOP_OVER_DIRS)
   1.896 +
   1.897 +dependclean::
   1.898 +	rm -f $(MKDEPENDENCIES)
   1.899 +	+$(LOOP_OVER_DIRS)
   1.900 +
   1.901 +#-include $(NSINSTALL_DIR)/$(OBJDIR)/depend.mk
   1.902 +
   1.903 +else
   1.904 +depend::
   1.905 +endif
   1.906 +
   1.907 +#
   1.908 +# HACK ALERT
   1.909 +#
   1.910 +# The only purpose of this rule is to pass Mozilla's Tinderbox depend
   1.911 +# builds (http://tinderbox.mozilla.org/showbuilds.cgi).  Mozilla's
   1.912 +# Tinderbox builds NSS continuously as part of the Mozilla client.
   1.913 +# Because NSS's make depend is not implemented, whenever we change
   1.914 +# an NSS header file, the depend build does not recompile the NSS
   1.915 +# files that depend on the header.
   1.916 +#
   1.917 +# This rule makes all the objects depend on a dummy header file.
   1.918 +# Check in a change to this dummy header file to force the depend
   1.919 +# build to recompile everything.
   1.920 +#
   1.921 +# This rule should be removed when make depend is implemented.
   1.922 +#
   1.923 +
   1.924 +DUMMY_DEPEND = $(CORE_DEPTH)/coreconf/coreconf.dep
   1.925 +
   1.926 +$(filter $(OBJDIR)/%$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%$(OBJ_SUFFIX): $(DUMMY_DEPEND)
   1.927 +
   1.928 +# END OF HACK
   1.929 +
   1.930 +################################################################################
   1.931 +# Special gmake rules.
   1.932 +################################################################################
   1.933 +
   1.934 +#
   1.935 +# Re-define the list of default suffixes, so gmake won't have to churn through
   1.936 +# hundreds of built-in suffix rules for stuff we don't need.
   1.937 +#
   1.938 +.SUFFIXES:
   1.939 +.SUFFIXES: .out .a .ln .o .obj .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .class .java .html .asm .dep
   1.940 +
   1.941 +#
   1.942 +# Don't delete these files if we get killed.
   1.943 +#
   1.944 +.PRECIOUS: .java $(JDK_HEADERS) $(JDK_STUBS) $(JRI_HEADERS) $(JRI_STUBS) $(JMC_HEADERS) $(JMC_STUBS) $(JNI_HEADERS)
   1.945 +
   1.946 +#
   1.947 +# Fake targets.  Always run these rules, even if a file/directory with that
   1.948 +# name already exists.
   1.949 +#
   1.950 +.PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs program realclean release $(OBJDIR)
   1.951 +

mercurial