|
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 ifeq ($(OS_TARGET), WIN16) |
|
18 OS_CFLAGS = $(OS_EXE_CFLAGS) |
|
19 endif |
|
20 |
|
21 |
|
22 DIRS = |
|
23 |
|
24 CSRCS = \ |
|
25 httpget.c \ |
|
26 tail.c \ |
|
27 $(NULL) |
|
28 |
|
29 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) |
|
30 PROG_SUFFIX = .exe |
|
31 else |
|
32 PROG_SUFFIX = |
|
33 endif |
|
34 |
|
35 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) |
|
36 |
|
37 TARGETS = $(PROGS) |
|
38 |
|
39 INCLUDES = -I$(dist_includedir) |
|
40 |
|
41 NSPR_VERSION = 3 |
|
42 |
|
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) |
|
48 |
|
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 |
|
53 else |
|
54 LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO |
|
55 LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) |
|
56 LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX) |
|
57 endif |
|
58 endif |
|
59 |
|
60 ifeq ($(OS_ARCH),OS2) |
|
61 LDOPTS += -Zomf -Zlinker /PM:VIO |
|
62 endif |
|
63 |
|
64 ifneq ($(OS_ARCH), WINNT) |
|
65 PWD = $(shell pwd) |
|
66 endif |
|
67 |
|
68 ifeq ($(OS_ARCH), IRIX) |
|
69 LDOPTS += -rpath $(PWD)/$(dist_libdir) |
|
70 endif |
|
71 |
|
72 ifeq ($(OS_ARCH), OSF1) |
|
73 LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread |
|
74 endif |
|
75 |
|
76 ifeq ($(OS_ARCH), HP-UX) |
|
77 LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) |
|
78 endif |
|
79 |
|
80 # AIX |
|
81 ifeq ($(OS_ARCH),AIX) |
|
82 LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib |
|
83 LIBPR = -lnspr$(NSPR_VERSION)_shr |
|
84 LIBPLC = -lplc$(NSPR_VERSION)_shr |
|
85 endif |
|
86 |
|
87 # Solaris |
|
88 ifeq ($(OS_ARCH), SunOS) |
|
89 ifdef NS_USE_GCC |
|
90 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) |
|
91 else |
|
92 LDOPTS += -R $(PWD)/$(dist_libdir) |
|
93 endif |
|
94 |
|
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) |
|
98 ifdef USE_PTHREADS |
|
99 EXTRA_LIBS = -lpthread |
|
100 endif |
|
101 endif |
|
102 endif # SunOS |
|
103 |
|
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) |
|
112 endif |
|
113 |
|
114 ##################################################### |
|
115 # |
|
116 # The rules |
|
117 # |
|
118 ##################################################### |
|
119 |
|
120 include $(topsrcdir)/config/rules.mk |
|
121 |
|
122 AIX_PRE_4_2 = 0 |
|
123 ifeq ($(OS_ARCH),AIX) |
|
124 ifneq ($(OS_RELEASE),4.2) |
|
125 ifneq ($(USE_PTHREADS), 1) |
|
126 #AIX_PRE_4_2 = 1 |
|
127 endif |
|
128 endif |
|
129 endif |
|
130 |
|
131 ifeq ($(AIX_PRE_4_2),1) |
|
132 |
|
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(). |
|
136 # |
|
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. |
|
140 |
|
141 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) |
|
142 @$(MAKE_OBJDIR) |
|
143 rm -f $@ $(AIX_TMP) |
|
144 $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a |
|
145 $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) |
|
146 rm -f $(AIX_TMP) |
|
147 |
|
148 else |
|
149 |
|
150 # All platforms that are not AIX pre-4.2. |
|
151 |
|
152 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) |
|
153 @$(MAKE_OBJDIR) |
|
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 |
|
162 echo file >>w16link |
|
163 echo $< >>w16link |
|
164 echo library >>w16link |
|
165 echo $(LIBPR), >>w16link |
|
166 echo $(LIBPLC), >>w16link |
|
167 echo winsock.lib >>w16link |
|
168 wlink @w16link. |
|
169 else |
|
170 link $(LDOPTS) $< $(LIBPR) $(LIBPLC) ws2_32.lib -out:$@ |
|
171 endif |
|
172 else |
|
173 ifeq ($(OS_ARCH),OS2) |
|
174 $(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@ |
|
175 else |
|
176 $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@ |
|
177 endif |
|
178 endif |
|
179 endif |
|
180 |
|
181 export:: $(TARGETS) |
|
182 clean:: |
|
183 rm -f $(TARGETS) |
|
184 |