home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / lib / prstreams / tests / testprstrm / Makefile next >
Encoding:
Makefile  |  1998-04-08  |  5.5 KB  |  205 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. CXXSRCS =           \
  27.     testprstrm.cpp    \
  28.     $(NULL)
  29.  
  30. OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.o))
  31.  
  32. ifeq ($(OS_ARCH), WINNT)
  33. PROG_SUFFIX = .exe
  34. else
  35. PROG_SUFFIX =
  36. endif
  37.  
  38. PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(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. LIBPRSTRMS = -lprstrms$(MOD_VERSION)
  49.  
  50. ifeq ($(OS_ARCH), WINNT)
  51. ifeq ($(OS_TARGET), WIN16)
  52.   LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib
  53.   LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).lib
  54. else
  55. LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
  56. LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX)
  57. LIBPRSTRMS = $(DIST)/lib/libprstrms$(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
  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. LIBPRSTRMS = -lprstrms$(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. # CC on SunOS 5.4 and 5.5.x need to link with -lthread or -lpthread
  92. # (or use the -mt switch) even though we already linked with these
  93. # system libraries when we built libnspr.so.
  94. ifdef USE_PTHREADS
  95. EXTRA_LIBS = -lpthread
  96. else
  97. EXTRA_LIBS = -lthread
  98. endif # USE_PTHREADS
  99. endif # NS_USE_GCC
  100. endif # 4.1.3_U1
  101. endif # SunOS
  102.  
  103. ifeq ($(OS_ARCH), NCR)
  104. # XXX: We see some strange problems when we link with libnspr.so.
  105. # So for now we use static libraries on NCR.  The shared library
  106. # stuff below is commented out.
  107. LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a
  108. LIBPRSTRMS = $(DIST)/lib/libprstrms$(MOD_VERSION).a
  109. EXTRA_LIBS = -lsocket -lnsl -ldl
  110.  
  111. # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
  112. # implicitly by $(CC)) again even though we already linked with these
  113. # system libraries when we built libnspr.so.
  114. #EXTRA_LIBS = -lsocket -lnsl
  115. # This hardcodes in the executable programs the directory to find
  116. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
  117. # option for ld on other platforms.
  118. #export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  119. endif
  120.  
  121. ifeq ($(OS_ARCH), SCO_SV)
  122. # SCO Unix needs to link against -lsocket again even though we
  123. # already linked with these system libraries when we built libnspr.so.
  124. EXTRA_LIBS = -lsocket
  125. # This hardcodes in the executable programs the directory to find
  126. # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
  127. # option for ld on other platforms.
  128. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  129. endif
  130.  
  131. ifeq ($(OS_ARCH), UNIXWARE)
  132. export LD_RUN_PATH = $(PWD)/$(DIST)/lib
  133. endif
  134.  
  135. #####################################################
  136. #
  137. # The rules
  138. #
  139. #####################################################
  140.  
  141. include $(MOD_DEPTH)/config/rules.mk
  142.  
  143. AIX_PRE_4_2 = 0
  144. ifeq ($(OS_ARCH),AIX)
  145. ifneq ($(OS_RELEASE),4.2)
  146. ifneq ($(USE_PTHREADS), 1)
  147. #AIX_PRE_4_2 = 1
  148. endif
  149. endif
  150. endif
  151.  
  152. ifeq ($(AIX_PRE_4_2),1)
  153.  
  154. # AIX releases prior to 4.2 need a special two-step linking hack
  155. # in order to both override the system select() and be able to 
  156. # get at the original system select().
  157. #
  158. # We use a pattern rule in ns/nspr20/config/rules.mk to generate
  159. # the .o file from the .c source file, then do the two-step linking
  160. # hack below.
  161.  
  162. $(OBJDIR)/%: $(OBJDIR)/%.o
  163.     @$(MAKE_OBJDIR)
  164.     rm -f $@ $(AIX_TMP)
  165.     $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a
  166.     $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
  167.     rm -f $(AIX_TMP)
  168.  
  169. else
  170.  
  171. # All platforms that are not AIX pre-4.2.
  172.  
  173. $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.o
  174.     @$(MAKE_OBJDIR)
  175. ifeq ($(OS_ARCH), WINNT)
  176. ifeq ($(OS_TARGET),WIN16)
  177.     echo system windows >w16link
  178.     echo option map >>w16link
  179.     echo option stack=10K >>w16link
  180.     echo option heapsize=32K >>w16link
  181.     echo debug $(DEBUGTYPE) all >>w16link
  182.     echo name $@  >>w16link
  183.     echo file >>w16link
  184.     echo $<  >>w16link
  185.     echo library  >>w16link
  186.     echo $(LIBPR),         >>w16link
  187.     echo $(LIBPRSTRMS),         >>w16link
  188.     echo winsock.lib     >>w16link
  189.     wlink @w16link.
  190. else
  191.     link $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) wsock32.lib -out:$@
  192. endif
  193. else
  194.     $(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPRSTRMS) $(EXTRA_LIBS) -o $@
  195. endif
  196.  
  197. endif
  198.  
  199. export:: $(TARGETS)
  200. install:: export
  201. clean::
  202.     rm -f $(TARGETS)
  203.