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