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