Makefile.in 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. CSRCS = \
  13. arena.c \
  14. base64t.c \
  15. getopt.c \
  16. string.c
  17. ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
  18. CSRCS += arena.c
  19. endif
  20. ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
  21. PROG_SUFFIX = .exe
  22. else
  23. PROG_SUFFIX =
  24. endif
  25. PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
  26. TARGETS = $(PROGS) $(OBJS)
  27. INCLUDES = -I$(dist_includedir)
  28. # Setting the variables LDOPTS and LIBPR. We first initialize
  29. # them to the default values, then adjust them for some platforms.
  30. LDOPTS = -L$(dist_libdir)
  31. LIBPR = -lnspr$(MOD_MAJOR_VERSION)
  32. LIBPLC = -lplc$(MOD_MAJOR_VERSION)
  33. LIBPLDS = -lplds$(MOD_MAJOR_VERSION)
  34. ifeq (,$(filter-out WINCE WINNT, $(OS_ARCH)))
  35. LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
  36. ifeq (,$(filter-out WIN95 WINCE WINMO, $(OS_TARGET)))
  37. LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
  38. LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
  39. LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
  40. else
  41. LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
  42. LIBPLC= $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
  43. LIBPLDS= $(dist_libdir)/libplds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
  44. endif
  45. endif
  46. ifeq ($(OS_ARCH),OS2)
  47. LDOPTS += -Zomf -Zlinker /PM:VIO
  48. endif
  49. ifneq ($(OS_ARCH), WINNT)
  50. PWD = $(shell pwd)
  51. endif
  52. ifeq ($(OS_ARCH), Linux)
  53. ifeq ($(OS_RELEASE), 1.2)
  54. EXTRA_LIBS = -ldl
  55. else
  56. LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
  57. ifeq ($(USE_PTHREADS),1)
  58. EXTRA_LIBS = -lpthread
  59. endif
  60. endif
  61. endif
  62. ifeq (,$(filter-out OpenBSD,$(OS_ARCH)))
  63. ifeq ($(USE_PTHREADS),1)
  64. EXTRA_LIBS = -lpthread
  65. endif
  66. endif
  67. ifeq ($(OS_ARCH), HP-UX)
  68. LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
  69. endif
  70. # AIX
  71. ifeq ($(OS_ARCH),AIX)
  72. LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
  73. LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr
  74. LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr
  75. endif
  76. # Solaris
  77. ifeq ($(OS_ARCH), SunOS)
  78. ifdef NS_USE_GCC
  79. LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
  80. else
  81. LDOPTS += -R $(PWD)/$(dist_libdir)
  82. endif
  83. # SunOS 5.5 needs to link with -lpthread, even though we already
  84. # linked with this system library when we built libnspr.so.
  85. ifeq ($(OS_RELEASE), 5.5)
  86. ifdef USE_PTHREADS
  87. EXTRA_LIBS = -lpthread
  88. endif
  89. endif
  90. endif # SunOS
  91. #####################################################
  92. #
  93. # The rules
  94. #
  95. #####################################################
  96. include $(topsrcdir)/config/rules.mk
  97. AIX_PRE_4_2 = 0
  98. ifeq ($(OS_ARCH),AIX)
  99. ifneq ($(OS_RELEASE),4.2)
  100. ifneq ($(USE_PTHREADS), 1)
  101. #AIX_PRE_4_2 = 1
  102. endif
  103. endif
  104. endif
  105. ifeq ($(AIX_PRE_4_2),1)
  106. # AIX releases prior to 4.2 need a special two-step linking hack
  107. # in order to both override the system select() and be able to
  108. # get at the original system select().
  109. #
  110. # We use a pattern rule in ns/nspr20/config/rules.mk to generate
  111. # the .$(OBJ_SUFFIX) file from the .c source file, then do the
  112. # two-step linking hack below.
  113. $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
  114. @$(MAKE_OBJDIR)
  115. rm -f $@ $(AIX_TMP)
  116. $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
  117. $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
  118. rm -f $(AIX_TMP)
  119. else
  120. # All platforms that are not AIX pre-4.2.
  121. $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
  122. @$(MAKE_OBJDIR)
  123. ifeq ($(OS_ARCH), WINNT)
  124. link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2_32.lib -out:$@
  125. else
  126. ifeq ($(OS_ARCH), WINCE)
  127. $(LD) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2.lib -out:$@
  128. else
  129. ifeq ($(OS_ARCH),OS2)
  130. $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
  131. else
  132. $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
  133. endif
  134. endif
  135. endif
  136. endif
  137. export:: $(TARGETS)
  138. clean::
  139. rm -f $(TARGETS)