Makefile.in 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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. #! gmake
  6. MOD_DEPTH = ../..
  7. topsrcdir = @top_srcdir@
  8. srcdir = @srcdir@
  9. VPATH = @srcdir@
  10. include $(MOD_DEPTH)/config/autoconf.mk
  11. include $(topsrcdir)/config/config.mk
  12. DIRS = dll
  13. CSRCS = \
  14. abstract.c \
  15. accept.c \
  16. acceptread.c \
  17. acceptreademu.c \
  18. addrstr.c \
  19. affinity.c \
  20. alarm.c \
  21. anonfm.c \
  22. append.c \
  23. atomic.c \
  24. attach.c \
  25. bigfile.c \
  26. bigfile2.c \
  27. bigfile3.c \
  28. cleanup.c \
  29. cltsrv.c \
  30. concur.c \
  31. cvar.c \
  32. cvar2.c \
  33. dceemu.c \
  34. dlltest.c \
  35. dtoa.c \
  36. env.c \
  37. errcodes.c \
  38. errset.c \
  39. exit.c \
  40. fdcach.c \
  41. fileio.c \
  42. foreign.c \
  43. forktest.c \
  44. formattm.c \
  45. fsync.c \
  46. getai.c \
  47. gethost.c \
  48. getproto.c \
  49. i2l.c \
  50. initclk.c \
  51. inrval.c \
  52. instrumt.c \
  53. intrio.c \
  54. intrupt.c \
  55. io_timeout.c \
  56. ioconthr.c \
  57. ipv6.c \
  58. join.c \
  59. joinkk.c \
  60. joinku.c \
  61. joinuk.c \
  62. joinuu.c \
  63. layer.c \
  64. lazyinit.c \
  65. libfilename.c \
  66. lltest.c \
  67. lock.c \
  68. lockfile.c \
  69. logfile.c \
  70. logger.c \
  71. makedir.c \
  72. mbcs.c \
  73. multiacc.c \
  74. multiwait.c \
  75. many_cv.c \
  76. monref.c \
  77. nameshm1.c \
  78. nbconn.c \
  79. nblayer.c \
  80. nonblock.c \
  81. ntioto.c \
  82. ntoh.c \
  83. obsints.c \
  84. op_2long.c \
  85. op_excl.c \
  86. op_filnf.c \
  87. op_filok.c \
  88. op_noacc.c \
  89. op_nofil.c \
  90. openfile.c \
  91. parent.c \
  92. parsetm.c \
  93. peek.c \
  94. perf.c \
  95. pipeping.c \
  96. pipeping2.c \
  97. pipepong.c \
  98. pipepong2.c \
  99. pipeself.c \
  100. poll_er.c \
  101. poll_nm.c \
  102. poll_to.c \
  103. pollable.c \
  104. prfdbl.c \
  105. prftest.c \
  106. prftest1.c \
  107. prftest2.c \
  108. prfz.c \
  109. primblok.c \
  110. priotest.c \
  111. provider.c \
  112. prpoll.c \
  113. prpollml.c \
  114. pushtop.c \
  115. ranfile.c \
  116. randseed.c \
  117. reinit.c \
  118. rmdir.c \
  119. rwlockrank.c \
  120. rwlocktest.c \
  121. sel_spd.c \
  122. selct_er.c \
  123. selct_nm.c \
  124. selct_to.c \
  125. select2.c \
  126. selintr.c \
  127. sem.c \
  128. sema.c \
  129. semaerr.c \
  130. semaerr1.c \
  131. semaping.c \
  132. semapong.c \
  133. sendzlf.c \
  134. server_test.c \
  135. servr_kk.c \
  136. servr_ku.c \
  137. servr_uk.c \
  138. servr_uu.c \
  139. short_thread.c \
  140. sigpipe.c \
  141. socket.c \
  142. sockopt.c \
  143. sockping.c \
  144. sockpong.c \
  145. sprintf.c \
  146. stack.c \
  147. stdio.c \
  148. str2addr.c \
  149. strod.c \
  150. suspend.c \
  151. switch.c \
  152. system.c \
  153. testbit.c \
  154. testfile.c \
  155. thrpool_server.c \
  156. thrpool_client.c \
  157. threads.c \
  158. thruput.c \
  159. timemac.c \
  160. timetest.c \
  161. tmoacc.c \
  162. tmocon.c \
  163. tpd.c \
  164. vercheck.c \
  165. version.c \
  166. udpsrv.c \
  167. writev.c \
  168. xnotify.c \
  169. y2k.c \
  170. y2ktmo.c \
  171. zerolen.c \
  172. $(NULL)
  173. ifeq ($(OS_ARCH),WINCE)
  174. CFLAGS += -FImozce_shunt.h -Zi -UDEBUG -DNDEBUG
  175. LDOPTS += -link $(DIST)/lib/mozce_shunt.lib ws2.lib -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO -PDB:$(@:.exe=.pdb)
  176. endif
  177. ifeq ($(OS_TARGET),OS2)
  178. CSRCS += \
  179. sleep.c \
  180. stat.c \
  181. yield.c \
  182. $(NULL)
  183. endif
  184. ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
  185. PROG_SUFFIX = .exe
  186. DLL_SUFFIX = .dll
  187. else
  188. PROG_SUFFIX =
  189. DLL_SUFFIX =
  190. endif
  191. PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
  192. TARGETS = $(PROGS)
  193. INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
  194. ifeq ($(OS_ARCH), WINNT)
  195. ifdef NS_USE_GCC
  196. EXTRA_LIBS += -lws2_32
  197. else
  198. EXTRA_LIBS += ws2_32.lib
  199. LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
  200. ifdef PROFILE
  201. LDOPTS += -PROFILE -MAP
  202. endif # profile
  203. endif # NS_USE_GCC
  204. endif
  205. ifeq ($(OS_ARCH),OS2)
  206. EXTRA_LIBS = $(OS_LIBS)
  207. LDOPTS = -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x64000
  208. endif
  209. ifneq ($(OS_ARCH), WINNT)
  210. # Use an absolute pathname as the runtime library path (for the -R
  211. # or -rpath linker option or the LD_RUN_PATH environment variable).
  212. ifeq (,$(patsubst /%,,$(DIST)))
  213. # $(DIST) is already an absolute pathname.
  214. ABSOLUTE_LIB_DIR = $(dist_libdir)
  215. else
  216. # $(DIST) is a relative pathname: prepend the current directory.
  217. PWD = $(shell pwd)
  218. ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir)
  219. endif
  220. endif
  221. ifeq ($(OS_ARCH), HP-UX)
  222. LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR)
  223. ifeq ($(USE_64),1)
  224. LDOPTS += +DD64
  225. endif
  226. ifeq ($(USE_PTHREADS),1)
  227. EXTRA_LIBS = $(LIBPTHREAD)
  228. endif
  229. endif
  230. # AIX
  231. ifeq ($(OS_ARCH),AIX)
  232. LDOPTS += -blibpath:$(ABSOLUTE_LIB_DIR):/usr/lib:/lib
  233. ifneq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
  234. LDOPTS += -brtl
  235. EXTRA_LIBS = -ldl
  236. endif
  237. endif
  238. # Solaris
  239. ifeq ($(OS_ARCH), SunOS)
  240. ifdef NS_USE_GCC
  241. LDOPTS += -Xlinker -R -Xlinker $(ABSOLUTE_LIB_DIR)
  242. else
  243. ifeq ($(USE_CPLUS), 1)
  244. CC = CC
  245. endif
  246. LDOPTS += -R $(ABSOLUTE_LIB_DIR)
  247. endif
  248. ifdef USE_PTHREADS
  249. EXTRA_LIBS = -lpthread
  250. endif
  251. endif # SunOS
  252. ifeq (,$(filter-out Linux GNU GNU_%,$(OS_ARCH)))
  253. LDOPTS += -Xlinker -rpath $(ABSOLUTE_LIB_DIR)
  254. ifeq ($(USE_PTHREADS),1)
  255. EXTRA_LIBS = -lpthread
  256. endif
  257. endif
  258. ifeq ($(OS_ARCH), SCOOS)
  259. # SCO Unix needs to link against -lsocket again even though we
  260. # already linked with these system libraries when we built libnspr.so.
  261. EXTRA_LIBS = -lsocket
  262. # This hardcodes in the executable programs the directory to find
  263. # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
  264. # option for ld on other platforms.
  265. export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
  266. endif
  267. ifeq ($(OS_ARCH),OpenUNIX)
  268. export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
  269. ifeq ($(USE_PTHREADS),1)
  270. LDOPTS += -pthread
  271. endif
  272. endif
  273. ifeq ($(OS_ARCH), UNIXWARE)
  274. export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
  275. endif
  276. ifeq ($(OS_ARCH),FreeBSD)
  277. ifeq ($(USE_PTHREADS),1)
  278. LDOPTS += -pthread
  279. endif
  280. LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR)
  281. endif
  282. ifeq ($(OS_ARCH),OpenBSD)
  283. ifeq ($(USE_PTHREADS),1)
  284. LDOPTS += -pthread
  285. endif
  286. endif
  287. ifeq ($(OS_ARCH),BSD_OS)
  288. ifneq ($(OS_RELEASE),1.1)
  289. EXTRA_LIBS = -ldl
  290. endif
  291. endif
  292. ifeq ($(OS_ARCH),RISCOS)
  293. EXTRA_LIBS = -ldl
  294. endif
  295. ifeq ($(USE_PTHREADS),1)
  296. LIBPTHREAD = -lpthread
  297. ifeq ($(OS_ARCH),AIX)
  298. LIBPTHREAD = -lpthreads
  299. endif
  300. ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
  301. LIBPTHREAD =
  302. endif
  303. endif
  304. ifeq ($(OS_TARGET),Android)
  305. LIBPTHREAD =
  306. XCFLAGS = $(OS_CFLAGS)
  307. endif
  308. #####################################################
  309. #
  310. # The rules
  311. #
  312. #####################################################
  313. include $(topsrcdir)/config/rules.mk
  314. AIX_PRE_4_2 = 0
  315. ifeq ($(OS_ARCH),AIX)
  316. ifeq ($(OS_RELEASE),4.1)
  317. ifneq ($(USE_PTHREADS), 1)
  318. #AIX_PRE_4_2 = 1
  319. endif
  320. endif
  321. endif
  322. ifeq ($(AIX_PRE_4_2),1)
  323. # AIX releases prior to 4.2 need a special two-step linking hack
  324. # in order to both override the system select() and be able to
  325. # get at the original system select().
  326. #
  327. # We use a pattern rule in ns/nspr20/config/rules.mk to generate
  328. # the .$(OBJ_SUFFIX) file from the .c source file, then do the
  329. # two-step linking hack below.
  330. $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
  331. @$(MAKE_OBJDIR)
  332. rm -f $@ $(AIX_TMP)
  333. $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
  334. $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
  335. rm -f $(AIX_TMP)
  336. else
  337. # All platforms that are not AIX pre-4.2.
  338. $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
  339. @$(MAKE_OBJDIR)
  340. ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
  341. link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -out:$@
  342. ifdef MT
  343. @if test -f $@.manifest; then \
  344. $(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
  345. rm -f $@.manifest; \
  346. fi
  347. endif
  348. else
  349. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
  350. endif # WINNT
  351. endif # AIX_PRE_4_2
  352. export:: $(TARGETS)
  353. clean::
  354. rm -f $(TARGETS)
  355. # The following tests call BSD socket functions, so they need to link
  356. # with -lsocket on some platforms.
  357. ifeq ($(OS_ARCH),SunOS)
  358. ifeq ($(USE_IPV6),1)
  359. $(OBJDIR)/gethost: $(OBJDIR)/gethost.o
  360. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@
  361. endif
  362. $(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o
  363. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@
  364. endif
  365. ifeq ($(USE_PTHREADS), 1)
  366. $(OBJDIR)/attach: $(OBJDIR)/attach.o
  367. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
  368. $(OBJDIR)/foreign: $(OBJDIR)/foreign.o
  369. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
  370. $(OBJDIR)/provider: $(OBJDIR)/provider.o
  371. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
  372. $(OBJDIR)/socket: $(OBJDIR)/socket.o
  373. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
  374. $(OBJDIR)/testfile: $(OBJDIR)/testfile.o
  375. $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@
  376. endif
  377. #
  378. # Run the test programs with no arguments
  379. #
  380. # Test output goes to the file pointed to by the environment variable
  381. # NSPR_TEST_LOGFILE, if set, else to /dev/null
  382. #
  383. ECHO = echo
  384. PROGRAMS = $(notdir $(PROGS))
  385. ifdef NSPR_TEST_LOGFILE
  386. LOGFILE = $(NSPR_TEST_LOGFILE)
  387. else
  388. ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
  389. LOGFILE = nul
  390. else
  391. LOGFILE = /dev/null
  392. endif
  393. endif
  394. ifeq ($(OS_TARGET),Linux)
  395. ECHO = /bin/echo
  396. endif
  397. ALWAYS:
  398. runtests:: $(PROGS) ALWAYS
  399. $(topsrcdir)/pr/tests/runtests.sh $(DIST)