home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / lib / msgc / tests / Makefile < prev    next >
Encoding:
Makefile  |  1998-04-08  |  7.6 KB  |  288 lines

  1. #
  2. # The contents of this file are subject to the Netscape Public License
  3. # Version 1.0 (the "NPL"); you may not use this file except in
  4. # compliance with the NPL.  You may obtain a copy of the NPL at
  5. # http://www.mozilla.org/NPL/
  6. # Software distributed under the NPL is distributed on an "AS IS" basis,
  7. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  8. # for the specific language governing rights and limitations under the
  9. # NPL.
  10. # The Initial Developer of this code under the NPL is Netscape
  11. # Communications Corporation.  Portions created by Netscape are
  12. # Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  13. # Reserved.
  14. #
  15.  
  16. #! gmake
  17.  
  18. MOD_DEPTH = ../../..
  19.  
  20. include $(MOD_DEPTH)/config/config.mk
  21.  
  22. ifeq ($(OS_TARGET), WIN16)
  23. OS_CFLAGS = $(OS_EXE_CFLAGS)
  24. W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.o
  25. endif
  26.  
  27. ifeq ($(OS_TARGET), OS2)
  28. OS_CFLAGS = $(OS_EXE_CFLAGS)
  29. endif
  30.  
  31. CSRCS = gc1.c thrashgc.c
  32.  
  33. ifeq ($(OS_ARCH), WINNT)
  34. PROG_SUFFIX = .exe
  35. else
  36. PROG_SUFFIX =
  37. endif
  38.  
  39. PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
  40.  
  41. TARGETS = $(PROGS) $(OBJS)
  42.  
  43. INCLUDES = -I$(DIST)/include
  44.  
  45. # Setting the variables LDOPTS and LIBPR.  We first initialize
  46. # them to the default values, then adjust them for some platforms.
  47. LDOPTS = -L$(DIST)/lib
  48. NSPR_VERSION = $(MOD_VERSION)
  49. GC_VERSION = $(MOD_VERSION)
  50. LIBPR = -lnspr$(NSPR_VERSION)
  51. LIBPLC = -lplc$(NSPR_VERSION)
  52. LIBGC = -lmsgc$(GC_VERSION)
  53.  
  54. ifeq ($(OS_ARCH), WINNT)
  55. ifeq ($(OS_TARGET), WIN16)
  56.   LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib
  57.   LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib
  58.   LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib
  59. else
  60. ifeq ($(OS_TARGET),OS2)
  61.   LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
  62.   LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib
  63.   LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib
  64.   LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib
  65. else
  66.   LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
  67.   LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
  68.   LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
  69.   LIBGC= $(DIST)/lib/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
  70. endif
  71. endif
  72. endif
  73.  
  74. ifneq ($(OS_ARCH), WINNT)
  75. PWD = $(shell pwd)
  76. endif
  77.  
  78. ifeq ($(OS_ARCH), IRIX)
  79. LDOPTS += -rpath $(PWD)/$(DIST)/lib
  80.  
  81. ifeq ($(USE_N32),1)
  82. LDOPTS += -n32
  83. endif
  84.  
  85. endif
  86.  
  87. ifeq ($(OS_ARCH), OSF1)
  88. # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
  89. # we do static linking.
  90. ifeq ($(OS_RELEASE), V3.2)
  91.   LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a
  92.   LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a
  93.   LIBGC = $(DIST)/lib/libmsgc$(GC_VERSION).a
  94.   EXTRA_LIBS = -lc_r
  95. else
  96.   LDOPTS += -rpath $(PWD)/$(DIST)/lib
  97. endif
  98. endif
  99.  
  100. ifeq ($(OS_ARCH), HP-UX)
  101. LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib
  102. endif
  103.  
  104. # AIX
  105. ifeq ($(OS_ARCH),AIX)
  106. ifeq ($(CLASSIC_NSPR),1)
  107. LDOPTS += -blibpath:.:$(PWD)/$(DIST)/lib:/usr/lpp/xlC/lib:/usr/lib:/lib
  108. else
  109. LDOPTS += -blibpath:.:$(PWD)/$(DIST)/lib:/usr/lib/threads:/usr/lpp/xlC/lib:/usr/lib:/lib
  110. endif
  111. ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
  112. LIBPR = -lnspr$(NSPR_VERSION)_shr
  113. LIBPLC = -lplc$(NSPR_VERSION)_shr
  114. LIBGC = -lmsgc$(GC_VERSION)_shr
  115. else
  116. LDOPTS += -brtl
  117. EXTRA_LIBS = -ldl
  118. endif
  119. endif
  120.  
  121. # Solaris
  122. ifeq ($(OS_ARCH), SunOS)
  123. ifneq ($(OS_RELEASE), 4.1.3_U1)
  124. ifdef NS_USE_GCC
  125. LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib
  126. else
  127. LDOPTS += -R $(PWD)/$(DIST)/lib
  128. endif
  129. endif
  130.  
  131. ifneq ($(LOCAL_THREADS_ONLY),1)
  132. # SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
  133. # even though we already linked with these system libraries
  134. # when we built libnspr.so.
  135. ifeq ($(OS_RELEASE), 5.4)
  136. EXTRA_LIBS = -lthread
  137. endif
  138.  
  139. ifeq ($(OS_RELEASE), 5.4_i86pc)
  140. EXTRA_LIBS = -lthread
  141. endif
  142.  
  143. ifeq ($(OS_RELEASE), 5.5)
  144. ifdef USE_PTHREADS
  145. EXTRA_LIBS = -lpthread
  146. else
  147. EXTRA_LIBS = -lthread
  148. endif
  149. endif
  150. endif # LOCAL_THREADS_ONLY
  151. endif # SunOS
  152.  
  153. ifeq ($(OS_ARCH),NEC)
  154. EXTRA_LIBS = $(OS_LIBS)
  155. # This hardcodes in the executable programs the directory to find
  156. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
  157. # option for ld on other platforms.
  158. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  159. endif
  160.  
  161. ifeq ($(OS_ARCH), NCR)
  162. # XXX: We see some strange problems when we link with libnspr.so.
  163. # So for now we use static libraries on NCR.  The shared library
  164. # stuff below is commented out.
  165. LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a
  166. LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a
  167. LIBGC = $(DIST)/lib/libmsgc$(GC_VERSION).a
  168. EXTRA_LIBS = -lsocket -lnsl -ldl
  169.  
  170. # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
  171. # implicitly by $(CC)) again even though we already linked with these
  172. # system libraries when we built libnspr.so.
  173. #EXTRA_LIBS = -lsocket -lnsl
  174. # This hardcodes in the executable programs the directory to find
  175. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
  176. # option for ld on other platforms.
  177. #export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  178. endif
  179.  
  180. ifeq ($(OS_ARCH), Linux)
  181. ifeq ($(OS_RELEASE), 1.2)
  182. EXTRA_LIBS = -ldl
  183. endif
  184. endif
  185.  
  186. ifeq ($(OS_ARCH), SCO_SV)
  187. # SCO Unix needs to link against -lsocket again even though we
  188. # already linked with these system libraries when we built libnspr.so.
  189. EXTRA_LIBS = -lsocket
  190. # This hardcodes in the executable programs the directory to find
  191. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
  192. # option for ld on other platforms.
  193. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  194. endif
  195.  
  196. ifeq ($(OS_ARCH),ReliantUNIX)
  197. EXTRA_LIBS = -lsocket -lnsl -lgen -ldl -lresolv /usr/ucblib/libucb.a
  198. # This hardcodes in the executable programs the directory to find
  199. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
  200. # option for ld on other platforms.
  201. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  202. endif
  203.  
  204. ifeq ($(OS_ARCH), UNIXWARE)
  205. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  206. endif
  207.  
  208. ifeq ($(OS_ARCH),BSD_386)
  209. EXTRA_LIBS = -ldl
  210. endif
  211.  
  212. #####################################################
  213. #
  214. # The rules
  215. #
  216. #####################################################
  217.  
  218. include $(MOD_DEPTH)/config/rules.mk
  219.  
  220. AIX_PRE_4_2 = 0
  221. ifeq ($(OS_ARCH),AIX)
  222. ifneq ($(OS_RELEASE),4.2)
  223. ifneq ($(USE_PTHREADS), 1)
  224. #AIX_PRE_4_2 = 1
  225. endif
  226. endif
  227. endif
  228.  
  229. ifeq ($(AIX_PRE_4_2),1)
  230.  
  231. # AIX releases prior to 4.2 need a special two-step linking hack
  232. # in order to both override the system select() and be able to 
  233. # get at the original system select().
  234. #
  235. # We use a pattern rule in ns/nspr20/config/rules.mk to generate
  236. # the .o file from the .c source file, then do the two-step linking
  237. # hack below.
  238.  
  239. $(OBJDIR)/%: $(OBJDIR)/%.o
  240.     @$(MAKE_OBJDIR)
  241.     rm -f $@ $(AIX_TMP)
  242.     $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(NSPR_VERSION).a
  243.     $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
  244.     rm -f $(AIX_TMP)
  245.  
  246. else
  247.  
  248. # All platforms that are not AIX pre-4.2.
  249.  
  250. $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.o
  251.     @$(MAKE_OBJDIR)
  252. ifeq ($(OS_ARCH), WINNT)
  253. ifeq ($(OS_TARGET),WIN16)
  254.     echo system windows >w16link
  255.     echo name $@  >>w16link
  256.     echo option map >>w16link
  257. #    echo option CASEEXACT >>w16link
  258.     echo option stack=16K >>w16link
  259.     echo debug $(DEBUGTYPE) all >>w16link
  260.     echo file >>w16link
  261.     echo $< ,  >>w16link
  262.     echo $(W16STDIO) >>w16link
  263.     echo library  >>w16link
  264.     echo $(LIBPR),         >>w16link
  265.     echo $(LIBPLC),        >>w16link
  266.     echo $(LIBGC),         >>w16link
  267.     echo winsock.lib     >>w16link
  268.     wlink @w16link.
  269. else
  270. ifeq ($(OS_TARGET),OS2)
  271.     $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) so32dll.lib tcp32dll.lib -MAP:$(@:.exe=.map) -out:$@
  272. else
  273.     link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
  274. endif
  275. endif
  276. else
  277.     $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
  278. endif
  279.  
  280. endif
  281.  
  282. export:: $(TARGETS)
  283. export:: install
  284. clean::
  285.     rm -f $(TARGETS)
  286.