nsprpub/config/rules.mk

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 #! gmake
michael@0 2 #
michael@0 3 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6
michael@0 7 ################################################################################
michael@0 8 # We used to have a 4 pass build process. Now we do everything in one pass.
michael@0 9 #
michael@0 10 # export - Create generated headers and stubs. Publish public headers to
michael@0 11 # dist/<arch>/include.
michael@0 12 # Create libraries. Publish libraries to dist/<arch>/lib.
michael@0 13 # Create programs.
michael@0 14 #
michael@0 15 # libs - obsolete. Now a synonym of "export".
michael@0 16 #
michael@0 17 # all - the default makefile target. Now a synonym of "export".
michael@0 18 #
michael@0 19 # install - Install headers, libraries, and programs on the system.
michael@0 20 #
michael@0 21 # Parameters to this makefile (set these before including):
michael@0 22 #
michael@0 23 # a)
michael@0 24 # TARGETS -- the target to create
michael@0 25 # (defaults to $LIBRARY $PROGRAM)
michael@0 26 # b)
michael@0 27 # DIRS -- subdirectories for make to recurse on
michael@0 28 # (the 'all' rule builds $TARGETS $DIRS)
michael@0 29 # c)
michael@0 30 # CSRCS -- .c files to compile
michael@0 31 # (used to define $OBJS)
michael@0 32 # d)
michael@0 33 # PROGRAM -- the target program name to create from $OBJS
michael@0 34 # ($OBJDIR automatically prepended to it)
michael@0 35 # e)
michael@0 36 # LIBRARY -- the target library name to create from $OBJS
michael@0 37 # ($OBJDIR automatically prepended to it)
michael@0 38 #
michael@0 39 ################################################################################
michael@0 40
michael@0 41 ifndef topsrcdir
michael@0 42 topsrcdir=$(MOD_DEPTH)
michael@0 43 endif
michael@0 44
michael@0 45 ifndef srcdir
michael@0 46 srcdir=.
michael@0 47 endif
michael@0 48
michael@0 49 ifndef NSPR_CONFIG_MK
michael@0 50 include $(topsrcdir)/config/config.mk
michael@0 51 endif
michael@0 52
michael@0 53 ifdef USE_AUTOCONF
michael@0 54 ifdef CROSS_COMPILE
michael@0 55 ifdef INTERNAL_TOOLS
michael@0 56 CC=$(HOST_CC)
michael@0 57 CCC=$(HOST_CXX)
michael@0 58 CFLAGS=$(HOST_CFLAGS)
michael@0 59 CXXFLAGS=$(HOST_CXXFLAGS)
michael@0 60 LDFLAGS=$(HOST_LDFLAGS)
michael@0 61 endif
michael@0 62 endif
michael@0 63 endif
michael@0 64
michael@0 65 #
michael@0 66 # This makefile contains rules for building the following kinds of
michael@0 67 # libraries:
michael@0 68 # - LIBRARY: a static (archival) library
michael@0 69 # - SHARED_LIBRARY: a shared (dynamic link) library
michael@0 70 # - IMPORT_LIBRARY: an import library, used only on Windows and OS/2
michael@0 71 #
michael@0 72 # The names of these libraries can be generated by simply specifying
michael@0 73 # LIBRARY_NAME and LIBRARY_VERSION.
michael@0 74 #
michael@0 75
michael@0 76 ifdef LIBRARY_NAME
michael@0 77 ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
michael@0 78
michael@0 79 #
michael@0 80 # Win95 and OS/2 require library names conforming to the 8.3 rule.
michael@0 81 # other platforms do not.
michael@0 82 #
michael@0 83 ifeq (,$(filter-out WIN95 WINCE WINMO OS2,$(OS_TARGET)))
michael@0 84 LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
michael@0 85 SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
michael@0 86 IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
michael@0 87 SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
michael@0 88 else
michael@0 89 LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
michael@0 90 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
michael@0 91 IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
michael@0 92 SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
michael@0 93 endif
michael@0 94
michael@0 95 else
michael@0 96
michael@0 97 LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
michael@0 98 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
michael@0 99 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
michael@0 100 else
michael@0 101 ifdef MKSHLIB
michael@0 102 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
michael@0 103 endif
michael@0 104 endif
michael@0 105
michael@0 106 endif
michael@0 107 endif
michael@0 108
michael@0 109 ifndef TARGETS
michael@0 110 ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
michael@0 111 TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
michael@0 112 ifdef MOZ_DEBUG_SYMBOLS
michael@0 113 ifdef MSC_VER
michael@0 114 ifneq (,$(filter-out 1100 1200,$(MSC_VER)))
michael@0 115 TARGETS += $(SHARED_LIB_PDB)
michael@0 116 endif
michael@0 117 endif
michael@0 118 endif
michael@0 119 else
michael@0 120 TARGETS = $(LIBRARY) $(SHARED_LIBRARY)
michael@0 121 endif
michael@0 122 endif
michael@0 123
michael@0 124 #
michael@0 125 # OBJS is the list of object files. It can be constructed by
michael@0 126 # specifying CSRCS (list of C source files) and ASFILES (list
michael@0 127 # of assembly language source files).
michael@0 128 #
michael@0 129
michael@0 130 ifndef OBJS
michael@0 131 OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
michael@0 132 $(addprefix $(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
michael@0 133 endif
michael@0 134
michael@0 135 ALL_TRASH = $(TARGETS) $(OBJS) $(RES) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
michael@0 136 $(NOSUCHFILE) \
michael@0 137 $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
michael@0 138 so_locations
michael@0 139
michael@0 140 ifndef RELEASE_LIBS_DEST
michael@0 141 RELEASE_LIBS_DEST = $(RELEASE_LIB_DIR)
michael@0 142 endif
michael@0 143
michael@0 144 define MAKE_IN_DIR
michael@0 145 $(MAKE) -C $(dir) $@
michael@0 146
michael@0 147 endef # do not remove the blank line!
michael@0 148
michael@0 149 ifdef DIRS
michael@0 150 LOOP_OVER_DIRS = $(foreach dir,$(DIRS),$(MAKE_IN_DIR))
michael@0 151 endif
michael@0 152
michael@0 153 ################################################################################
michael@0 154
michael@0 155 all:: export
michael@0 156
michael@0 157 export::
michael@0 158 +$(LOOP_OVER_DIRS)
michael@0 159
michael@0 160 libs:: export
michael@0 161
michael@0 162 clean::
michael@0 163 rm -rf $(OBJS) $(RES) so_locations $(NOSUCHFILE) $(GARBAGE)
michael@0 164 +$(LOOP_OVER_DIRS)
michael@0 165
michael@0 166 clobber::
michael@0 167 rm -rf $(OBJS) $(RES) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
michael@0 168 +$(LOOP_OVER_DIRS)
michael@0 169
michael@0 170 realclean clobber_all::
michael@0 171 rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
michael@0 172 +$(LOOP_OVER_DIRS)
michael@0 173
michael@0 174 distclean::
michael@0 175 rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
michael@0 176 +$(LOOP_OVER_DIRS)
michael@0 177
michael@0 178 install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS)
michael@0 179 ifdef RELEASE_BINS
michael@0 180 $(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir)
michael@0 181 endif
michael@0 182 ifdef RELEASE_HEADERS
michael@0 183 $(NSINSTALL) -t -m 0644 $(RELEASE_HEADERS) $(DESTDIR)$(includedir)/$(include_subdir)
michael@0 184 endif
michael@0 185 ifdef RELEASE_LIBS
michael@0 186 $(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir)
michael@0 187 endif
michael@0 188 +$(LOOP_OVER_DIRS)
michael@0 189
michael@0 190 release:: export
michael@0 191 ifdef RELEASE_BINS
michael@0 192 @echo "Copying executable programs and scripts to release directory"
michael@0 193 @if test -z "$(BUILD_NUMBER)"; then \
michael@0 194 echo "BUILD_NUMBER must be defined"; \
michael@0 195 false; \
michael@0 196 else \
michael@0 197 true; \
michael@0 198 fi
michael@0 199 @if test ! -d $(RELEASE_BIN_DIR); then \
michael@0 200 rm -rf $(RELEASE_BIN_DIR); \
michael@0 201 $(NSINSTALL) -D $(RELEASE_BIN_DIR);\
michael@0 202 else \
michael@0 203 true; \
michael@0 204 fi
michael@0 205 cp $(RELEASE_BINS) $(RELEASE_BIN_DIR)
michael@0 206 endif
michael@0 207 ifdef RELEASE_LIBS
michael@0 208 @echo "Copying libraries to release directory"
michael@0 209 @if test -z "$(BUILD_NUMBER)"; then \
michael@0 210 echo "BUILD_NUMBER must be defined"; \
michael@0 211 false; \
michael@0 212 else \
michael@0 213 true; \
michael@0 214 fi
michael@0 215 @if test ! -d $(RELEASE_LIBS_DEST); then \
michael@0 216 rm -rf $(RELEASE_LIBS_DEST); \
michael@0 217 $(NSINSTALL) -D $(RELEASE_LIBS_DEST);\
michael@0 218 else \
michael@0 219 true; \
michael@0 220 fi
michael@0 221 cp $(RELEASE_LIBS) $(RELEASE_LIBS_DEST)
michael@0 222 endif
michael@0 223 ifdef RELEASE_HEADERS
michael@0 224 @echo "Copying header files to release directory"
michael@0 225 @if test -z "$(BUILD_NUMBER)"; then \
michael@0 226 echo "BUILD_NUMBER must be defined"; \
michael@0 227 false; \
michael@0 228 else \
michael@0 229 true; \
michael@0 230 fi
michael@0 231 @if test ! -d $(RELEASE_HEADERS_DEST); then \
michael@0 232 rm -rf $(RELEASE_HEADERS_DEST); \
michael@0 233 $(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\
michael@0 234 else \
michael@0 235 true; \
michael@0 236 fi
michael@0 237 cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
michael@0 238 endif
michael@0 239 +$(LOOP_OVER_DIRS)
michael@0 240
michael@0 241 alltags:
michael@0 242 rm -f TAGS tags
michael@0 243 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
michael@0 244 find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
michael@0 245
michael@0 246 $(NFSPWD):
michael@0 247 cd $(@D); $(MAKE) $(@F)
michael@0 248
michael@0 249 $(PROGRAM): $(OBJS)
michael@0 250 @$(MAKE_OBJDIR)
michael@0 251 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
michael@0 252 ifdef MOZ_PROFILE_USE
michael@0 253 # In the second pass, we need to merge the pgc files into the pgd file.
michael@0 254 # The compiler would do this for us automatically if they were in the right
michael@0 255 # place, but they're in dist/bin.
michael@0 256 python $(topsrcdir)/build/win32/pgomerge.py \
michael@0 257 $(notdir $(PROGRAM:.exe=)) $(DIST)/bin
michael@0 258 endif # MOZ_PROFILE_USE
michael@0 259 $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
michael@0 260 ifdef MT
michael@0 261 @if test -f $@.manifest; then \
michael@0 262 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
michael@0 263 rm -f $@.manifest; \
michael@0 264 fi
michael@0 265 endif # MSVC with manifest tool
michael@0 266 ifdef MOZ_PROFILE_GENERATE
michael@0 267 # touch it a few seconds into the future to work around FAT's
michael@0 268 # 2-second granularity
michael@0 269 touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
michael@0 270 endif # MOZ_PROFILE_GENERATE
michael@0 271 else # WINNT && !GCC
michael@0 272 $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(WRAP_LDFLAGS)
michael@0 273 endif # WINNT && !GCC
michael@0 274 ifdef ENABLE_STRIP
michael@0 275 $(STRIP) $@
michael@0 276 endif
michael@0 277
michael@0 278 $(LIBRARY): $(OBJS)
michael@0 279 @$(MAKE_OBJDIR)
michael@0 280 rm -f $@
michael@0 281 $(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
michael@0 282 $(RANLIB) $@
michael@0 283
michael@0 284 ifeq ($(OS_TARGET), OS2)
michael@0 285 $(IMPORT_LIBRARY): $(MAPFILE)
michael@0 286 rm -f $@
michael@0 287 $(IMPLIB) $@ $(MAPFILE)
michael@0 288 else
michael@0 289 ifeq (,$(filter-out WIN95 WINCE WINMO,$(OS_TARGET)))
michael@0 290 # PDBs and import libraries need to depend on the shared library to
michael@0 291 # order dependencies properly.
michael@0 292 $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
michael@0 293 $(SHARED_LIB_PDB): $(SHARED_LIBRARY)
michael@0 294 endif
michael@0 295 endif
michael@0 296
michael@0 297 $(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
michael@0 298 @$(MAKE_OBJDIR)
michael@0 299 rm -f $@
michael@0 300 ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
michael@0 301 echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
michael@0 302 nm -B -C -g $(OBJS) \
michael@0 303 | awk '/ [T,D] / {print $$3}' \
michael@0 304 | sed -e 's/^\.//' \
michael@0 305 | sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
michael@0 306 $(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
michael@0 307 -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
michael@0 308 else # AIX 4.1
michael@0 309 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
michael@0 310 ifdef MOZ_PROFILE_USE
michael@0 311 python $(topsrcdir)/build/win32/pgomerge.py \
michael@0 312 $(notdir $(SHARED_LIBRARY:.$(DLL_SUFFIX)=)) $(DIST)/bin
michael@0 313 endif # MOZ_PROFILE_USE
michael@0 314 $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
michael@0 315 ifdef MT
michael@0 316 @if test -f $@.manifest; then \
michael@0 317 $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
michael@0 318 rm -f $@.manifest; \
michael@0 319 fi
michael@0 320 endif # MSVC with manifest tool
michael@0 321 ifdef MOZ_PROFILE_GENERATE
michael@0 322 touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
michael@0 323 endif # MOZ_PROFILE_GENERATE
michael@0 324 else # WINNT && !GCC
michael@0 325 $(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(WRAP_LDFLAGS) $(EXTRA_LIBS)
michael@0 326 endif # WINNT && !GCC
michael@0 327 endif # AIX 4.1
michael@0 328 ifdef ENABLE_STRIP
michael@0 329 $(STRIP) $@
michael@0 330 endif
michael@0 331
michael@0 332 ################################################################################
michael@0 333
michael@0 334 ifdef MOZ_PROFILE_USE
michael@0 335 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
michael@0 336 # When building with PGO, we have to make sure to re-link
michael@0 337 # in the MOZ_PROFILE_USE phase if we linked in the
michael@0 338 # MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
michael@0 339 # file in the link rule in the GENERATE phase to indicate
michael@0 340 # that we need a relink.
michael@0 341 $(SHARED_LIBRARY): pgo.relink
michael@0 342
michael@0 343 $(PROGRAM): pgo.relink
michael@0 344
michael@0 345 endif # WINNT && !GCC
michael@0 346 endif # MOZ_PROFILE_USE
michael@0 347
michael@0 348 ifneq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
michael@0 349 ifdef NS_USE_GCC
michael@0 350 # Force rebuilding libraries and programs in both passes because each
michael@0 351 # pass uses different object files.
michael@0 352 $(PROGRAM) $(SHARED_LIBRARY) $(LIBRARY): FORCE
michael@0 353 .PHONY: FORCE
michael@0 354 endif
michael@0 355 endif
michael@0 356
michael@0 357 ################################################################################
michael@0 358
michael@0 359 ifdef MOZ_PROFILE_GENERATE
michael@0 360 # Clean up profiling data during PROFILE_GENERATE phase
michael@0 361 export::
michael@0 362 ifeq ($(OS_ARCH)_$(NS_USE_GCC), WINNT_)
michael@0 363 $(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
michael@0 364 else
michael@0 365 ifdef NS_USE_GCC
michael@0 366 -$(RM) *.gcda
michael@0 367 endif
michael@0 368 endif
michael@0 369 endif
michael@0 370
michael@0 371 ################################################################################
michael@0 372
michael@0 373 ifeq ($(OS_ARCH),WINNT)
michael@0 374 $(RES): $(RESNAME)
michael@0 375 @$(MAKE_OBJDIR)
michael@0 376 # The resource compiler does not understand the -U option.
michael@0 377 ifdef NS_USE_GCC
michael@0 378 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
michael@0 379 else
michael@0 380 $(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
michael@0 381 endif # GCC
michael@0 382 @echo $(RES) finished
michael@0 383 endif
michael@0 384
michael@0 385 $(MAPFILE): $(LIBRARY_NAME).def
michael@0 386 @$(MAKE_OBJDIR)
michael@0 387 ifeq ($(OS_ARCH),SunOS)
michael@0 388 grep -v ';-' $< | \
michael@0 389 sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
michael@0 390 endif
michael@0 391 ifeq ($(OS_ARCH),OS2)
michael@0 392 echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@
michael@0 393 echo PROTMODE >> $@
michael@0 394 echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
michael@0 395 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
michael@0 396 echo EXPORTS >> $@
michael@0 397 grep -v ';+' $< | grep -v ';-' | \
michael@0 398 sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \
michael@0 399 awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@
michael@0 400 $(ADD_TO_DEF_FILE)
michael@0 401 endif
michael@0 402
michael@0 403 #
michael@0 404 # Translate source filenames to absolute paths. This is required for
michael@0 405 # debuggers under Windows and OS/2 to find source files automatically.
michael@0 406 #
michael@0 407
michael@0 408 ifeq (,$(filter-out AIX OS2,$(OS_ARCH)))
michael@0 409 NEED_ABSOLUTE_PATH = 1
michael@0 410 endif
michael@0 411
michael@0 412 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
michael@0 413 NEED_ABSOLUTE_PATH = 1
michael@0 414 endif
michael@0 415
michael@0 416 ifdef NEED_ABSOLUTE_PATH
michael@0 417 # The quotes allow absolute paths to contain spaces.
michael@0 418 pr_abspath = "$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))"
michael@0 419 endif
michael@0 420
michael@0 421 $(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
michael@0 422 @$(MAKE_OBJDIR)
michael@0 423 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
michael@0 424 $(CCC) -Fo$@ -c $(CCCFLAGS) $(call pr_abspath,$<)
michael@0 425 else
michael@0 426 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
michael@0 427 $(CCC) -Fo$@ -c $(CCCFLAGS) $<
michael@0 428 else
michael@0 429 ifdef NEED_ABSOLUTE_PATH
michael@0 430 $(CCC) -o $@ -c $(CCCFLAGS) $(call pr_abspath,$<)
michael@0 431 else
michael@0 432 $(CCC) -o $@ -c $(CCCFLAGS) $<
michael@0 433 endif
michael@0 434 endif
michael@0 435 endif
michael@0 436
michael@0 437 WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
michael@0 438 WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
michael@0 439 WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
michael@0 440 $(OBJDIR)/%.$(OBJ_SUFFIX): %.c
michael@0 441 @$(MAKE_OBJDIR)
michael@0 442 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
michael@0 443 $(CC) -Fo$@ -c $(CFLAGS) $(call pr_abspath,$<)
michael@0 444 else
michael@0 445 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINCE)
michael@0 446 $(CC) -Fo$@ -c $(CFLAGS) $<
michael@0 447 else
michael@0 448 ifdef NEED_ABSOLUTE_PATH
michael@0 449 $(CC) -o $@ -c $(CFLAGS) $(call pr_abspath,$<)
michael@0 450 else
michael@0 451 $(CC) -o $@ -c $(CFLAGS) $<
michael@0 452 endif
michael@0 453 endif
michael@0 454 endif
michael@0 455
michael@0 456
michael@0 457 $(OBJDIR)/%.$(OBJ_SUFFIX): %.s
michael@0 458 @$(MAKE_OBJDIR)
michael@0 459 $(AS) -o $@ $(ASFLAGS) -c $<
michael@0 460
michael@0 461 %.i: %.c
michael@0 462 $(CC) -C -E $(CFLAGS) $< > $*.i
michael@0 463
michael@0 464 %: %.pl
michael@0 465 rm -f $@; cp $< $@; chmod +x $@
michael@0 466
michael@0 467 #
michael@0 468 # HACK ALERT
michael@0 469 #
michael@0 470 # The only purpose of this rule is to pass Mozilla's Tinderbox depend
michael@0 471 # builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's
michael@0 472 # Tinderbox builds NSPR continuously as part of the Mozilla client.
michael@0 473 # Because NSPR's make depend is not implemented, whenever we change
michael@0 474 # an NSPR header file, the depend build does not recompile the NSPR
michael@0 475 # files that depend on the header.
michael@0 476 #
michael@0 477 # This rule makes all the objects depend on a dummy header file.
michael@0 478 # Touch this dummy header file to force the depend build to recompile
michael@0 479 # everything.
michael@0 480 #
michael@0 481 # This rule should be removed when make depend is implemented.
michael@0 482 #
michael@0 483
michael@0 484 DUMMY_DEPEND_H = $(topsrcdir)/config/prdepend.h
michael@0 485
michael@0 486 $(filter $(OBJDIR)/%.$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%.$(OBJ_SUFFIX): $(DUMMY_DEPEND_H)
michael@0 487
michael@0 488 # END OF HACK
michael@0 489
michael@0 490 ################################################################################
michael@0 491 # Special gmake rules.
michael@0 492 ################################################################################
michael@0 493
michael@0 494 #
michael@0 495 # Disallow parallel builds with MSVC < 8 since it can't open the PDB file in
michael@0 496 # parallel.
michael@0 497 #
michael@0 498 ifeq (,$(filter-out 1200 1300 1310,$(MSC_VER)))
michael@0 499 .NOTPARALLEL:
michael@0 500 endif
michael@0 501
michael@0 502 #
michael@0 503 # Re-define the list of default suffixes, so gmake won't have to churn through
michael@0 504 # hundreds of built-in suffix rules for stuff we don't need.
michael@0 505 #
michael@0 506 .SUFFIXES:
michael@0 507 .SUFFIXES: .a .$(OBJ_SUFFIX) .c .cpp .s .h .i .pl
michael@0 508
michael@0 509 #
michael@0 510 # Fake targets. Always run these rules, even if a file/directory with that
michael@0 511 # name already exists.
michael@0 512 #
michael@0 513 .PHONY: all alltags clean export install libs realclean release
michael@0 514
michael@0 515 #
michael@0 516 # List the target pattern of an implicit rule as a dependency of the
michael@0 517 # special target .PRECIOUS to preserve intermediate files made by
michael@0 518 # implicit rules whose target patterns match that file's name.
michael@0 519 # (See GNU Make documentation, Edition 0.51, May 1996, Sec. 10.4,
michael@0 520 # p. 107.)
michael@0 521 #
michael@0 522 .PRECIOUS: $(OBJDIR)/%.$(OBJ_SUFFIX)

mercurial