Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/.
6 #! gmake
8 MOD_DEPTH = ../..
9 topsrcdir = @top_srcdir@
10 srcdir = @srcdir@
11 VPATH = @srcdir@
13 include $(MOD_DEPTH)/config/autoconf.mk
15 include $(topsrcdir)/config/config.mk
17 CSRCS = \
18 arena.c \
19 base64t.c \
20 getopt.c \
21 string.c
23 ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
24 CSRCS += arena.c
25 endif
27 ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
28 PROG_SUFFIX = .exe
29 else
30 PROG_SUFFIX =
31 endif
33 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
35 TARGETS = $(PROGS) $(OBJS)
37 INCLUDES = -I$(dist_includedir)
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)
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
59 ifeq ($(OS_ARCH),OS2)
60 LDOPTS += -Zomf -Zlinker /PM:VIO
61 endif
63 ifneq ($(OS_ARCH), WINNT)
64 PWD = $(shell pwd)
65 endif
67 ifeq ($(OS_ARCH), IRIX)
68 LDOPTS += -rpath $(PWD)/$(dist_libdir)
69 endif
71 ifeq ($(OS_ARCH), Linux)
72 ifeq ($(OS_RELEASE), 1.2)
73 EXTRA_LIBS = -ldl
74 else
75 LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
76 ifeq ($(USE_PTHREADS),1)
77 EXTRA_LIBS = -lpthread
78 endif
79 endif
80 endif
82 ifeq (,$(filter-out OpenBSD,$(OS_ARCH)))
83 ifeq ($(USE_PTHREADS),1)
84 EXTRA_LIBS = -lpthread
85 endif
86 endif
88 ifeq ($(OS_ARCH), OSF1)
89 LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
90 endif
92 ifeq ($(OS_ARCH), HP-UX)
93 LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
94 endif
96 # AIX
97 ifeq ($(OS_ARCH),AIX)
98 LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
99 LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr
100 LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr
101 endif
103 # Solaris
104 ifeq ($(OS_ARCH), SunOS)
105 ifdef NS_USE_GCC
106 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
107 else
108 LDOPTS += -R $(PWD)/$(dist_libdir)
109 endif
111 # SunOS 5.5 needs to link with -lpthread, even though we already
112 # linked with this system library when we built libnspr.so.
113 ifeq ($(OS_RELEASE), 5.5)
114 ifdef USE_PTHREADS
115 EXTRA_LIBS = -lpthread
116 endif
117 endif
118 endif # SunOS
120 #####################################################
121 #
122 # The rules
123 #
124 #####################################################
126 include $(topsrcdir)/config/rules.mk
128 AIX_PRE_4_2 = 0
129 ifeq ($(OS_ARCH),AIX)
130 ifneq ($(OS_RELEASE),4.2)
131 ifneq ($(USE_PTHREADS), 1)
132 #AIX_PRE_4_2 = 1
133 endif
134 endif
135 endif
137 ifeq ($(AIX_PRE_4_2),1)
139 # AIX releases prior to 4.2 need a special two-step linking hack
140 # in order to both override the system select() and be able to
141 # get at the original system select().
142 #
143 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
144 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
145 # two-step linking hack below.
147 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
148 @$(MAKE_OBJDIR)
149 rm -f $@ $(AIX_TMP)
150 $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
151 $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
152 rm -f $(AIX_TMP)
154 else
156 # All platforms that are not AIX pre-4.2.
158 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
159 @$(MAKE_OBJDIR)
161 ifeq ($(OS_ARCH), WINNT)
162 link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2_32.lib -out:$@
163 else
164 ifeq ($(OS_ARCH), WINCE)
165 $(LD) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2.lib -out:$@
166 else
167 ifeq ($(OS_ARCH),OS2)
168 $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
169 else
170 $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
171 endif
172 endif
173 endif
174 endif
176 export:: $(TARGETS)
177 clean::
178 rm -f $(TARGETS)