home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / tools / Makefile < prev    next >
Encoding:
Makefile  |  1998-04-08  |  5.7 KB  |  226 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. endif
  25.  
  26.  
  27. DIRS =
  28.  
  29. CSRCS =             \
  30.     httpget.c        \
  31.     tail.c            \
  32.     unbundle.c        \
  33.     $(NULL)
  34.  
  35. ifeq ($(OS_ARCH), WINNT)
  36. PROG_SUFFIX = .exe
  37. else
  38. PROG_SUFFIX =
  39. endif
  40.  
  41. PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
  42.  
  43. TARGETS = $(PROGS)
  44.  
  45. INCLUDES = -I$(DIST)/include/private -I$(DIST)/include 
  46.  
  47. NSPR_VERSION = 21
  48.  
  49. # Setting the variables LDOPTS and LIBPR.  We first initialize
  50. # them to the default values, then adjust them for some platforms.
  51. LDOPTS = -L$(DIST)/lib
  52. LIBPR = -lnspr$(NSPR_VERSION)
  53. LIBPLC = -lplc$(NSPR_VERSION)
  54.  
  55. ifeq ($(OS_ARCH), WINNT)
  56. ifeq ($(OS_TARGET), WIN16)
  57.   LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib
  58.   LIBPLC= $(DIST)/lib/plc$(NSPR_VERSION).lib
  59. else
  60. LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
  61. LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
  62. LIBPLC= $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
  63. endif
  64. endif
  65.  
  66. ifneq ($(OS_ARCH), WINNT)
  67. PWD = $(shell pwd)
  68. endif
  69.  
  70. ifeq ($(OS_ARCH), IRIX)
  71. LDOPTS += -rpath $(PWD)/$(DIST)/lib
  72. endif
  73.  
  74. ifeq ($(OS_ARCH), OSF1)
  75. LDOPTS += -rpath $(PWD)/$(DIST)/lib -lpthread
  76. endif
  77.  
  78. ifeq ($(OS_ARCH), HP-UX)
  79. LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib
  80. endif
  81.  
  82. # AIX
  83. ifeq ($(OS_ARCH),AIX)
  84. LDOPTS += -blibpath:.:$(PWD)/$(DIST)/lib:/usr/lib/threads:/usr/lpp/xlC/lib:/usr/lib:/lib                                        
  85. LIBPR = -lnspr$(NSPR_VERSION)_shr
  86. LIBPLC = -lplc$(NSPR_VERSION)_shr
  87. endif
  88.  
  89. # Solaris
  90. ifeq ($(OS_ARCH), SunOS)
  91. ifneq ($(OS_RELEASE), 4.1.3_U1)
  92. ifdef NS_USE_GCC
  93. LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib
  94. else
  95. LDOPTS += -R $(PWD)/$(DIST)/lib
  96. endif
  97. endif
  98.  
  99. # SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
  100. # even though we already linked with these system libraries
  101. # when we built libnspr.so.
  102. ifeq ($(OS_RELEASE), 5.4)
  103. EXTRA_LIBS = -lthread
  104. endif
  105.  
  106. ifeq ($(OS_RELEASE), 5.4_i86pc)
  107. EXTRA_LIBS = -lthread
  108. endif
  109.  
  110. ifeq ($(OS_RELEASE), 5.5)
  111. ifdef USE_PTHREADS
  112. EXTRA_LIBS = -lpthread
  113. else
  114. EXTRA_LIBS = -lthread
  115. endif
  116. endif
  117. endif # SunOS
  118.  
  119. ifeq ($(OS_ARCH), NCR)
  120. # XXX: We see some strange problems when we link with libnspr.so.
  121. # So for now we use static libraries on NCR.  The shared library
  122. # stuff below is commented out.
  123. LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a
  124. LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a
  125. EXTRA_LIBS = -lsocket -lnsl -ldl
  126.  
  127. # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
  128. # implicitly by $(CC)) again even though we already linked with these
  129. # system libraries when we built libnspr.so.
  130. #EXTRA_LIBS = -lsocket -lnsl
  131. # This hardcodes in the executable programs the directory to find
  132. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
  133. # option for ld on other platforms.
  134. #export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  135. endif
  136.  
  137. ifeq ($(OS_ARCH), SCO_SV)
  138. # SCO Unix needs to link against -lsocket again even though we
  139. # already linked with these system libraries when we built libnspr.so.
  140. EXTRA_LIBS = -lsocket
  141. # This hardcodes in the executable programs the directory to find
  142. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
  143. # option for ld on other platforms.
  144. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  145. endif
  146.  
  147. #####################################################
  148. #
  149. # The rules
  150. #
  151. #####################################################
  152.  
  153. include $(MOD_DEPTH)/config/rules.mk
  154.  
  155. AIX_PRE_4_2 = 0
  156. ifeq ($(OS_ARCH),AIX)
  157. ifneq ($(OS_RELEASE),4.2)
  158. ifneq ($(USE_PTHREADS), 1)
  159. #AIX_PRE_4_2 = 1
  160. endif
  161. endif
  162. endif
  163.  
  164. ifeq ($(AIX_PRE_4_2),1)
  165.  
  166. # AIX releases prior to 4.2 need a special two-step linking hack
  167. # in order to both override the system select() and be able to 
  168. # get at the original system select().
  169. #
  170. # We use a pattern rule in ns/nspr20/config/rules.mk to generate
  171. # the .o file from the .c source file, then do the two-step linking
  172. # hack below.
  173.  
  174. $(OBJDIR)/%: $(OBJDIR)/%.o
  175.     @$(MAKE_OBJDIR)
  176.     rm -f $@ $(AIX_TMP)
  177.     $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(NSPR_VERSION).a
  178.     $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
  179.     rm -f $(AIX_TMP)
  180.  
  181. else
  182.  
  183. # All platforms that are not AIX pre-4.2.
  184.  
  185.  
  186. # ifeq ($(USE_PTHREADS), 1)
  187. # $(OBJDIR)/attach: $(OBJDIR)/attach.o
  188. #     @$(MAKE_OBJDIR)
  189. #     $(CC) $< $(LDOPTS) $(LIBPR) $(LIBPLC) -lpthread -o $@
  190. # endif
  191.  
  192.  
  193. $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.o
  194.     @$(MAKE_OBJDIR)
  195. ifeq ($(OS_ARCH), WINNT)
  196. ifeq ($(OS_TARGET),WIN16)
  197.     echo system windows >w16link
  198.     echo option map >>w16link
  199.     echo option stack=10K >>w16link
  200.     echo option heapsize=32K >>w16link
  201.     echo debug $(DEBUGTYPE) all >>w16link
  202.     echo name $@  >>w16link
  203.     echo file >>w16link
  204.     echo $<  >>w16link
  205.     echo library  >>w16link
  206.     echo $(LIBPR),         >>w16link
  207.     echo $(LIBPLC),         >>w16link
  208.     echo winsock.lib     >>w16link
  209.     wlink @w16link.
  210. else
  211.     link $(LDOPTS) $< $(LIBPR) $(LIBPLC) wsock32.lib -out:$@
  212. endif
  213. else
  214.     $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@
  215. endif
  216.  
  217. endif
  218.  
  219. export:: $(TARGETS)
  220. install:: export
  221. clean::
  222.     rm -f $(TARGETS)
  223.  
  224.