rules.mk 30 KB

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