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/.
9 topsrcdir = @top_srcdir@
13 include $(MOD_DEPTH)/config/autoconf.mk
15 include $(topsrcdir)/config/config.mk
17 ifeq ($(OS_TARGET), WIN16)
18 OS_CFLAGS = $(OS_EXE_CFLAGS)
29 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
35 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
39 INCLUDES = -I$(dist_includedir)
43 # Setting the variables LDOPTS and LIBPR. We first initialize
44 # them to the default values, then adjust them for some platforms.
45 LDOPTS = -L$(dist_libdir)
46 LIBPR = -lnspr$(NSPR_VERSION)
47 LIBPLC = -lplc$(NSPR_VERSION)
49 ifeq ($(OS_ARCH), WINNT)
50 ifeq ($(OS_TARGET), WIN16)
51 LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
52 LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib
54 LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
55 LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
56 LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
61 LDOPTS += -Zomf -Zlinker /PM:VIO
64 ifneq ($(OS_ARCH), WINNT)
68 ifeq ($(OS_ARCH), IRIX)
69 LDOPTS += -rpath $(PWD)/$(dist_libdir)
72 ifeq ($(OS_ARCH), OSF1)
73 LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
76 ifeq ($(OS_ARCH), HP-UX)
77 LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
82 LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
83 LIBPR = -lnspr$(NSPR_VERSION)_shr
84 LIBPLC = -lplc$(NSPR_VERSION)_shr
88 ifeq ($(OS_ARCH), SunOS)
90 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
92 LDOPTS += -R $(PWD)/$(dist_libdir)
95 # SunOS 5.5 needs to link with -lpthread, even though we already
96 # linked with this system library when we built libnspr.so.
97 ifeq ($(OS_RELEASE), 5.5)
99 EXTRA_LIBS = -lpthread
104 ifeq ($(OS_ARCH), SCOOS)
105 # SCO Unix needs to link against -lsocket again even though we
106 # already linked with these system libraries when we built libnspr.so.
107 EXTRA_LIBS = -lsocket
108 # This hardcodes in the executable programs the directory to find
109 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
110 # option for ld on other platforms.
111 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
114 #####################################################
118 #####################################################
120 include $(topsrcdir)/config/rules.mk
123 ifeq ($(OS_ARCH),AIX)
124 ifneq ($(OS_RELEASE),4.2)
125 ifneq ($(USE_PTHREADS), 1)
131 ifeq ($(AIX_PRE_4_2),1)
133 # AIX releases prior to 4.2 need a special two-step linking hack
134 # in order to both override the system select() and be able to
135 # get at the original system select().
137 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
138 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
139 # two-step linking hack below.
141 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
144 $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
145 $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
150 # All platforms that are not AIX pre-4.2.
152 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
154 ifeq ($(OS_ARCH), WINNT)
155 ifeq ($(OS_TARGET),WIN16)
156 echo system windows >w16link
157 echo option map >>w16link
158 echo option stack=10K >>w16link
159 echo option heapsize=32K >>w16link
160 echo debug $(DEBUGTYPE) all >>w16link
161 echo name $@ >>w16link
164 echo library >>w16link
165 echo $(LIBPR), >>w16link
166 echo $(LIBPLC), >>w16link
167 echo winsock.lib >>w16link
170 link $(LDOPTS) $< $(LIBPR) $(LIBPLC) ws2_32.lib -out:$@
173 ifeq ($(OS_ARCH),OS2)
174 $(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@
176 $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@