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