1 # Makefile for `wget' utility
2 # Copyright (C) 1995-2005 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Wget. If not, see <http://www.gnu.org/licenses/>.
17 # In addition, as a special exception, the Free Software Foundation
18 # gives permission to link the code of its release of Wget with the
19 # OpenSSL project's "OpenSSL" library (or with modified versions of it
20 # that use the same license as the "OpenSSL" library), and distribute
21 # the linked executables. You must obey the GNU General Public License
22 # in all respects for all of the code used other than "OpenSSL". If you
23 # modify this file, you may extend this exception to your version of the
24 # file, but you are not obligated to do so. If you do not wish to do
25 # so, delete this exception statement from your version.
35 top_srcdir = @top_srcdir@
40 exec_prefix = @exec_prefix@
42 sysconfdir = @sysconfdir@
44 localedir = $(datadir)/locale
50 # The following line is losing on some versions of make!
51 DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
54 LIBS = @LIBS@ @LIBSSL@ @LIBGNUTLS@
57 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../src
59 COMPILE = $(CC) $(INCLUDES) $(CPPFLAGS) $(DEFS) $(CFLAGS)
60 LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
62 INSTALL_PROGRAM = @INSTALL_PROGRAM@
66 # Conditional compiles
72 GETOPT_OBJ = @GETOPT_OBJ@
79 test: @top_srcdir@/src/wget run-unit-tests run-px-tests
81 @top_srcdir@/src/wget:
82 cd @top_srcdir@ && $(MAKE)
84 run-unit-tests: unit-tests$(exeext)
87 run-px-tests: WgetTest.pm
88 ./Test-auth-basic.px && echo && echo
89 ./Test-c-full.px && echo && echo
90 ./Test-c-partial.px && echo && echo
91 ./Test-c.px && echo && echo
92 ./Test-E-k-K.px && echo && echo
93 ./Test-E-k.px && echo && echo
94 ./Test-ftp.px && echo && echo
95 ./Test-HTTP-Content-Disposition-1.px && echo && echo
96 ./Test-HTTP-Content-Disposition-2.px && echo && echo
97 ./Test-HTTP-Content-Disposition.px && echo && echo
98 ./Test-N-current-HTTP-CD.px && echo && echo
99 ./Test-N-current.px && echo && echo
100 ./Test-N-HTTP-Content-Disposition.px && echo && echo
101 ./Test-N--no-content-disposition.px && echo && echo
102 ./Test-N--no-content-disposition-trivial.px && echo && echo
103 ./Test--no-content-disposition.px && echo && echo
104 ./Test--no-content-disposition-trivial.px && echo && echo
105 ./Test-N-old.px && echo && echo
106 ./Test-nonexisting-quiet.px && echo && echo
107 ./Test-noop.px && echo && echo
108 ./Test-np.px && echo && echo
109 ./Test-N.px && echo && echo
110 ./Test-O-HTTP-Content-Disposition.px && echo && echo
111 ./Test-O--no-content-disposition.px && echo && echo
112 ./Test-O--no-content-disposition-trivial.px && echo && echo
113 ./Test-O-nonexisting.px && echo && echo
114 ./Test-O.px && echo && echo
115 ./Test-Restrict-Lowercase.px && echo && echo
116 ./Test-Restrict-Uppercase.px && echo && echo
117 ./Test--spider-fail.px && echo && echo
118 ./Test--spider-HTTP-Content-Disposition.px && echo && echo
119 ./Test--spider--no-content-disposition.px && echo && echo
120 ./Test--spider--no-content-disposition-trivial.px && echo && echo
121 ./Test--spider.px && echo && echo
122 ./Test--spider-r-HTTP-Content-Disposition.px && echo && echo
123 ./Test--spider-r--no-content-disposition.px && echo && echo
124 ./Test--spider-r--no-content-disposition-trivial.px && echo && echo
125 ./Test--spider-r.px && echo && echo
127 WgetTest.pm: WgetTest.pm.in @top_srcdir@/config.status
128 cd @top_srcdir@ && ./config.status
131 # Dependencies for test binary
134 TESTOBJ = $(ALLOCA) cmpt.o connect.o convert.o cookies.o \
135 ftp.o ftp-basic.o ftp-ls.o $(OPIE_OBJ) $(GETOPT_OBJ) hash.o \
136 host.o html-parse.o html-url.o http.o $(NTLM_OBJ) init.o \
137 log.o main.o $(MD5_OBJ) netrc.o progress.o \
138 ptimer.o recur.o res.o retr.o safe-ctype.o snprintf.o \
139 spider.o $(SSL_OBJ) test.o url.o utils.o version.o xmalloc.o
141 # We make object files depend on every header. Rather than attempt to
142 # track dependencies, everything gets recompiled when a header
143 # changes. With a program of Wget's size this doesn't waste much
144 # time, and it's a lot safer than attempting to get all the
145 # dependencies right.
147 HEADERS = ../src/config-post.h ../src/config.h \
148 ../src/connect.h ../src/convert.h ../src/cookies.h \
149 ../src/ftp.h ../src/gen-md5.h ../src/getopt.h \
150 ../src/gnu-md5.h ../src/hash.h ../src/host.h \
151 ../src/html-parse.h ../src/http-ntlm.h ../src/init.h \
152 ../src/log.h ../src/mswindows.h ../src/netrc.h \
153 ../src/options.h ../src/progress.h \
154 ../src/ptimer.h ../src/recur.h ../src/res.h \
155 ../src/retr.h ../src/safe-ctype.h ../src/spider.h \
156 ../src/ssl.h ../src/sysdep.h ../src/test.h \
157 ../src/url.h ../src/utils.h ../src/wget.h \
160 alloca.o: ../src/alloca.c $(HEADERS)
161 $(COMPILE) -DTESTING -c $<
163 ccache.o: ../src/ccache.c $(HEADERS)
164 $(COMPILE) -DTESTING -c $<
166 cmpt.o: ../src/cmpt.c $(HEADERS)
167 $(COMPILE) -DTESTING -c $<
169 connect.o: ../src/connect.c $(HEADERS)
170 $(COMPILE) -DTESTING -c $<
172 convert.o: ../src/convert.c $(HEADERS)
173 $(COMPILE) -DTESTING -c $<
175 cookies.o: ../src/cookies.c $(HEADERS)
176 $(COMPILE) -DTESTING -c $<
178 ftp-basic.o: ../src/ftp-basic.c $(HEADERS)
179 $(COMPILE) -DTESTING -c $<
181 ftp.o: ../src/ftp.c $(HEADERS)
182 $(COMPILE) -DTESTING -c $<
184 ftp-ls.o: ../src/ftp-ls.c $(HEADERS)
185 $(COMPILE) -DTESTING -c $<
187 ftp-opie.o: ../src/ftp-opie.c $(HEADERS)
188 $(COMPILE) -DTESTING -c $<
190 gen-md5.o: ../src/gen-md5.c $(HEADERS)
191 $(COMPILE) -DTESTING -c $<
193 getopt.o: ../src/getopt.c $(HEADERS)
194 $(COMPILE) -DTESTING -c $<
196 gnu-md5.o: ../src/gnu-md5.c $(HEADERS)
197 $(COMPILE) -DTESTING -c $<
199 gnutls.o: ../src/gnutls.c $(HEADERS)
200 $(COMPILE) -DTESTING -c $<
202 hash.o: ../src/hash.c $(HEADERS)
203 $(COMPILE) -DTESTING -c $<
205 host.o: ../src/host.c $(HEADERS)
206 $(COMPILE) -DTESTING -c $<
208 html-parse.o: ../src/html-parse.c $(HEADERS)
209 $(COMPILE) -DTESTING -c $<
211 html-url.o: ../src/html-url.c $(HEADERS)
212 $(COMPILE) -DTESTING -c $<
214 http.o: ../src/http.c $(HEADERS)
215 $(COMPILE) -DTESTING -c $<
217 http-ntlm.o: ../src/http-ntlm.c $(HEADERS)
218 $(COMPILE) -DTESTING -c $<
220 init.o: ../src/init.c $(HEADERS)
221 $(COMPILE) -DTESTING -c $<
223 log.o: ../src/log.c $(HEADERS)
224 $(COMPILE) -DTESTING -c $<
226 main.o: ../src/main.c $(HEADERS)
227 $(COMPILE) -DTESTING -c $<
229 mswindows.o: ../src/mswindows.c $(HEADERS)
230 $(COMPILE) -DTESTING -c $<
232 netrc.o: ../src/netrc.c $(HEADERS)
233 $(COMPILE) -DTESTING -c $<
235 openssl.o: ../src/openssl.c $(HEADERS)
236 $(COMPILE) -DTESTING -c $<
238 progress.o: ../src/progress.c $(HEADERS)
239 $(COMPILE) -DTESTING -c $<
241 protocol.o: ../src/protocol.c $(HEADERS)
242 $(COMPILE) -DTESTING -c $<
244 ptimer.o: ../src/ptimer.c $(HEADERS)
245 $(COMPILE) -DTESTING -c $<
247 recur.o: ../src/recur.c $(HEADERS)
248 $(COMPILE) -DTESTING -c $<
250 res.o: ../src/res.c $(HEADERS)
251 $(COMPILE) -DTESTING -c $<
253 retr.o: ../src/retr.c $(HEADERS)
254 $(COMPILE) -DTESTING -c $<
256 safe-ctype.o: ../src/safe-ctype.c $(HEADERS)
257 $(COMPILE) -DTESTING -c $<
259 snprintf.o: ../src/snprintf.c $(HEADERS)
260 $(COMPILE) -DTESTING -c $<
262 spider.o: ../src/spider.c $(HEADERS)
263 $(COMPILE) -DTESTING -c $<
265 test.o: ../src/test.c $(HEADERS)
266 $(COMPILE) -DTESTING -c $<
268 url.o: ../src/url.c $(HEADERS)
269 $(COMPILE) -DTESTING -c $<
271 utils.o: ../src/utils.c $(HEADERS)
272 $(COMPILE) -DTESTING -c $<
274 version.o: ../src/version.c $(HEADERS)
275 $(COMPILE) -DTESTING -c $<
277 xmalloc.o: ../src/xmalloc.c $(HEADERS)
278 $(COMPILE) -DTESTING -c $<
281 unit-tests$(exeext): $(TESTOBJ)
282 $(LINK) $(TESTOBJ) $(LIBS)
285 # Dependencies for cleanup
289 $(RM) *.o unit-tests$(exeext) *~ *.bak core core.[0-9]*
297 # Dependencies for maintenance
302 Makefile: Makefile.in ../config.status
303 cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status