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