have a generic target
[privoxy.git] / GNUmakefile.in
1 # Note:  Makefile is built automatically from Makefile.in
2 #
3 # $Id: GNUmakefile.in,v 1.37 2002/03/27 15:30:26 swa Exp $
4 #
5 # Written by and Copyright (C) 2001 the SourceForge
6 # Privoxy team. http://www.privoxy.org/
7 #
8 # Based on the Internet Junkbuster originally written
9 # by and Copyright (C) 1997 Anonymous Coders and 
10 # Junkbusters Corporation.  http://www.junkbusters.com
11 #
12 # This program is free software; you can redistribute it 
13 # and/or modify it under the terms of the GNU General
14 # Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at
16 # your option) any later version.
17 #
18 # This program is distributed in the hope that it will
19 # be useful, but WITHOUT ANY WARRANTY; without even the
20 # implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE.  See the GNU General Public
22 # License for more details.
23 #
24 # The GNU General Public License should be included with
25 # this file.  If not, you can view it at
26 # http://www.gnu.org/copyleft/gpl.html
27 # or write to the Free Software Foundation, Inc., 59
28 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.
29 #
30
31 #############################################################################
32 # Version number (for RPM)
33 #############################################################################
34
35 VERSION_MAJOR = @VERSION_MAJOR@
36 VERSION_MINOR = @VERSION_MINOR@
37 VERSION_POINT = @VERSION_POINT@
38 CODE_STATUS   = @CODE_STATUS@
39 VERSION       = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
40 # will automatically be postfixed with -$(RPM_PACKAGEV) in the SPECfile
41 RPM_VERSION   = $(VERSION)
42 RPM_PACKAGEV  = @VERSION_RPM_PACKAGE@
43
44
45 #############################################################################
46 # Directories for "make install"
47 #############################################################################
48
49 DEST        = @sysconfdir@/privoxy
50 SBIN_DEST   = @sbindir@
51 MAN_DEST    = @mandir@
52
53
54 #############################################################################
55 # Build tools
56 #############################################################################
57
58 PROGRAM    = privoxy@EXEEXT@
59 CC         = @CC@
60 ECHO       = echo
61 GZIP_PROG  = gzip
62 INSTALL    = cp -f
63 LD         = @CC@
64 RM         = rm -f
65 STRIP_PROG = strip
66 SED        = sed
67 CAT        = cat
68 RPM        = rpm
69 MV         = mv
70 TAR        = tar
71 MAKE       = make
72 LN         = ln
73 WDUMP      = @WDUMP@ -dump
74 JADEBIN    = @JADEBIN@
75 DB         = $(JADEBIN) -t sgml -ihtml -D.. -d ldpOK.dsl\#html
76 DB2HTML    = @DB2HTML@
77 DKPREFIX   = @DKPREFIX@
78 MAN2HTML   = @MAN2HTML@
79 TARGET_OS  = @host@
80
81 # Program to do LF->CRLF
82 #
83 # The sed version should be the most portable, but it doesn't for for me,
84 # the other two do.  FIXME.
85 #   - Jon
86 #DOSFILTER  = $(SED) -e $$'s,$$,\r,'
87 #DOSFILTER  = gawk -v ORS='\r\n' '{print $0;}'
88 DOSFILTER  = perl -p -e 's/\n/\r\n/'
89
90 #############################################################################
91 # Setup for make distribution rh and suse for now 
92 #############################################################################
93
94 TAR_ARCH = /tmp/privoxy-$(RPM_VERSION).tar.gz
95 RPM_BASE = @RPM_BASE@
96
97 #############################################################################
98 # Filenames and libraries
99 #############################################################################
100
101 C_SRC  = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
102          errlog.c filters.c gateway.c jbsockets.c jcc.c killpopup.c \
103          list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
104          urlmatch.c
105
106 C_OBJS = $(C_SRC:.c=.@OBJEXT@)
107 C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
108
109 CONFIG_FILES = config trust \
110                 default.action \
111                 basic.action intermediate.action advanced.action \
112                 default.filter \
113                 templates/*
114
115 DOC_FILES = AUTHORS LICENSE README ChangeLog doc/text/* privoxy.1
116
117 W32_SRC   = @WIN_ONLY@w32log.c w32taskbar.c win32.c
118 W32_FILES = @WIN_ONLY@w32.res
119 W32_OBJS  = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
120 W32_HDRS  = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h
121 W32_LIB   = @WIN_ONLY@-lwsock32 -lcomctl32
122 W32_INIS  = @WIN_ONLY@config.txt trust.txt
123
124 PCRS_SRC     = @STATIC_PCRS_ONLY@pcrs.c
125 PCRS_OBJS    = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
126 PCRS_HDRS    = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
127
128 PCRE_SRC     = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
129 PCRE_OBJS    = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
130 PCRE_HDRS    = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
131
132 # No REGEX (Either because dynamically linked pcreposix, or no regex at all):
133 REGEX_SRC    =
134 # GNU REGEX:
135 @GNU_REGEX_ONLY@REGEX_SRC    = gnu_regex.c
136 # PCRE REGEX:
137 @PCRE_REGEX_ONLY@@STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
138
139 REGEX_OBJS   = $(REGEX_SRC:.c=.@OBJEXT@)
140 REGEX_HDRS   = $(REGEX_SRC:.c=.h)
141
142 # Dependencies introduced by #include "project.h".
143 PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
144
145 # Socket libraries for platforms that need them explicitly defined
146 SOCKET_LIB   = @SOCKET_LIB@
147
148 # PThreads library, if needed.
149 PTHREAD_LIB  = @PTHREAD_ONLY@@PTHREAD_LIB@
150
151 SRCS         = $(C_SRC)  $(W32_SRC)  $(PCRS_SRC)  $(PCRE_SRC)  $(REGEX_SRC)
152 OBJS         = $(C_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS)
153 HDRS         = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS)
154 LIBS         = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
155
156
157 #############################################################################
158 # Compiler switches
159 #############################################################################
160
161 # The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
162 # The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
163 # Win32 GUI build.
164 # The flag "-pthread" is required if using Pthreads under Linux (and
165 # possibly other OSs).
166 SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
167
168 # Add your flags here 
169 OTHER_CFLAGS =   
170
171 CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
172          @STATIC_PCRE_ONLY@ -Ipcre 
173
174 LDFLAGS = $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
175
176
177 #############################################################################
178 # Build section.
179 #
180 # There should NOT be any targets above this line.
181 #############################################################################
182 all: $(PROGRAM)
183
184
185 #############################################################################
186 # Phony targets
187 #############################################################################
188 .PHONY: all inifiles redhat-dist redhat-upload solaris-dist suse-dist \
189 suse-upload win-dist tarball-dist dok redhat-dok webserver clean clobber tags \
190 install
191
192
193 #############################################################################
194 # Define this explicitly because Solaris is broken!
195 #############################################################################
196 %.o: %.c
197         $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
198
199
200 #############################################################################
201 # Win32 config files
202 #############################################################################
203
204 inifiles: $(W32_INIS)
205
206 config.txt: config
207         $(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
208                -e 's!\jarfile jarfile!jarfile jar.log!' \
209                -e 's!\logfile logfile!logfile privoxy.log!' \
210                -e 's!#Win32-only: !!' \
211                < $< | \
212                $(DOSFILTER) > $@
213         # LF to CRLF in default.action
214         $(DOSFILTER) <default.action >default.action.txt && mv default.action.txt default.action
215         # LF to CRLF in default.filter
216         $(DOSFILTER) <default.filter >default.filter.txt && mv default.filter.txt default.filter
217
218 trust.txt: trust
219         $(DOSFILTER) < $< > $@ 
220
221 re_filterfile.txt: re_filterfile
222         $(DOSFILTER) < $< > $@ 
223
224
225 #############################################################################
226 # redhat distribution alpha and x86
227 #############################################################################
228
229 redhat-dist:
230         for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
231                 if [ ! -w $(RPM_BASE)/$$dir ]; then \
232                         $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
233                         $(ECHO) "Or add a suitable path to .rpmmacros like."; \
234                         $(ECHO) "%_topdir /home/foo/rpm-build"; \
235                         exit 1; \
236                 fi; \
237         done; \
238
239         $(MAKE) clobber
240         if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
241
242         TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
243         if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSION)/g' \
244              -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
245               privoxy-rh.spec > $$TMPFILE ; then \
246       $(MV) -f $$TMPFILE privoxy-rh.spec; \
247    else \
248       $(ECHO) "Could not set version info in specfile."; \
249       exit 1;\
250    fi
251
252         $(TAR) --exclude "CVS" --exclude "privoxy-suse.spec" -czf $(TAR_ARCH) .
253         $(RPM) --clean -ta  $(TAR_ARCH)
254         if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
255
256 #
257 # anonymously ncftps the rpms to sourceforge
258 #
259 redhat-upload:
260         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/privoxy-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
261 # better should use `arch` here instead of ix86 to support other platforms too
262         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/privoxy-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
263         @$(ECHO) -------------------------------------------------------
264         @$(ECHO) Now goto
265         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
266         @$(ECHO) ... and release the files.
267         @$(ECHO) -------------------------------------------------------
268      # w3m http://sourceforge.net/project/admin/editpackages.php?group_id=11118
269
270 #############################################################################
271 # generic distribution
272 #############################################################################
273
274 gen-dist:
275         @$(ECHO) ""
276         @$(ECHO) "You have run autoconf && autoheader && ./configure right?"
277         @$(ECHO) ""
278         $(MAKE) $(PROGRAM)
279         $(STRIP_PROG) $(PROGRAM)
280         $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
281 # add program
282         $(TAR) -C.. -cvhf privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$(PROGRAM)
283 # add config files
284         for foo in $(CONFIG_FILES); do \
285                 $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -uvhf privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$$foo; \
286         done; 
287 # add documentation
288         for foo in $(DOC_FILES); do \
289                 $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -uvhf privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$$foo; \
290         done; 
291 # and zip the archive
292         $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
293         $(GZIP_PROG) privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar
294         @$(ECHO) Distribution with binary created.
295
296 # anonymously ncftps the tarball to sourceforge
297 gen-upload:
298         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar.gz
299         @$(ECHO) -------------------------------------------------------
300         @$(ECHO) Now goto
301         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
302         @$(ECHO) ... and release the files.
303         @$(ECHO) -------------------------------------------------------
304
305 # use with care
306 gen-clean:
307         $(RM) privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar*
308
309 #############################################################################
310 # solaris distribution
311 #############################################################################
312 solaris-dist: gen-dist
313         @$(ECHO) Done.
314 # anonymously ncftps the tarball to sourceforge
315 solaris-upload: gen-upload
316         @$(ECHO) Done.
317 # use with care
318 solaris-clean: gen-clean
319         @$(ECHO) Done.
320
321 #############################################################################
322 # hpux distribution
323 #############################################################################
324 hpux-dist:
325         @$(ECHO) coming soon. 
326 hpux-upload:
327         @$(ECHO) coming soon. 
328
329 #############################################################################
330 # debian distribution
331 #############################################################################
332 debian-dist:
333         @$(ECHO) coming soon. 
334 debian-upload:
335         @$(ECHO) coming soon. 
336
337 #############################################################################
338 # macosx distribution
339 #############################################################################
340 macosx-dist:
341         @$(ECHO) coming soon. 
342 macosx-upload:
343         @$(ECHO) coming soon. 
344
345 #############################################################################
346 # amiga distribution
347 #############################################################################
348 amiga-dist:
349         @$(ECHO) coming soon. 
350 amiga-upload:
351         @$(ECHO) coming soon. 
352
353 #############################################################################
354 # freebsd distribution
355 #############################################################################
356 freebsd-dist:
357         @$(ECHO) coming soon. 
358 freebsd-upload:
359         @$(ECHO) coming soon. 
360
361 #############################################################################
362 # suse distribution. works fine. no need to be root. 
363 #############################################################################
364 suse-dist:
365         for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
366                 if [ ! -w $(RPM_BASE)/$$dir ]; then \
367                         $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
368                         $(ECHO) "Or add a suitable path to .rpmmacros like."; \
369                         $(ECHO) "%_topdir /home/foo/rpm-build"; \
370                         exit 1; \
371                 fi; \
372         done; \
373
374         $(MAKE) clobber
375         if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
376
377         TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
378         if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSIO)/g' \
379              -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
380               privoxy-suse.spec > $$TMPFILE ; then \
381       $(MV) -f $$TMPFILE privoxy-suse.spec; \
382    else \
383       $(ECHO) "Could not set version info in specfile."; \
384       exit 1;\
385    fi
386
387         $(TAR) --exclude "CVS" --exclude "privoxy-rh.spec" -czf $(TAR_ARCH) .
388         $(RPM) --clean -ta  $(TAR_ARCH)
389         if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
390
391 #
392 # anonymously ncftps the rpms to sourceforge
393 #
394 suse-upload:
395         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/privoxy-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
396 # better should use `arch` here instead of ix86 to support other platforms too
397         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/privoxy-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
398         @$(ECHO) -------------------------------------------------------
399         @$(ECHO) Now goto
400         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
401         @$(ECHO) ... and release the files.
402         @$(ECHO) -------------------------------------------------------
403
404 # handle with care. use with root.
405 suse-clean:
406         rpm -e junkbuster-suse || true
407         rm -rf /etc/junkbuster
408         rm -rf /etc/rc.d/junkbuster*
409         rm -rf /var/run/junkbuster.pid 
410         rm -rf /var/log/junkbuster
411         rm -f /etc/init.d/junkbuster
412         rm -f /usr/sbin/junkbuster
413         rm -f /usr/sbin/rcjunkbuster
414         rm -f /usr/share/man/man1/junkbuster.1.gz
415         rpm -e privoxy-suse || true
416         rm -rf /etc/privoxy
417         rm -rf /etc/rc.d/privoxy*
418         rm -rf /var/run/privoxy.pid 
419         rm -rf /var/log/privoxy
420         rm -f /etc/init.d/privoxy
421         rm -f /usr/sbin/privoxy
422         rm -f /usr/sbin/rcprivoxy
423         rm -f /usr/share/man/man1/privoxy.1.gz
424
425 #############################################################################
426 # Windows distribution
427 #############################################################################
428 win-dist:
429         $(ECHO) Not implemented.
430
431
432 #############################################################################
433 # Tarball distribution
434 #############################################################################
435 tarball-dist: clobber
436         $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
437         $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -cvhzf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz privoxy-$(VERSION)-$(CODE_STATUS)
438         $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
439         @$(ECHO) Tarball (without any binary) created.
440
441 # anonymously ncftps the tarball to sourceforge
442 tarball-upload:
443         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
444         @$(ECHO) -------------------------------------------------------
445         @$(ECHO) Now goto
446         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
447         @$(ECHO) ... and release the files.
448         @$(ECHO) -------------------------------------------------------
449
450 # handle with care
451 tarball-clean:
452         $(RM) privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
453
454 #############################################################################
455 #
456 # Documentation
457 #
458 # converts doc/source/*.sgml into html, text and man pages
459 #
460 #############################################################################
461 dok: doc/source/ldpOK.dsl man2html-swa
462         mkdir -p doc/text doc/man
463 #  user manual
464         rm -rf doc/webserver/user-manual
465         cd doc/source && $(DB2HTML) -s ldpOK.dsl user-manual.sgml && mv user-manual ../webserver
466         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks user-manual.sgml > tmp.html && lynx -dump tmp.html > ../text/user-manual.txt && rm -rf tmp.html user-manual
467 ##  developer manual
468         rm -rf doc/webserver/developer-manual
469         cd doc/source && $(DB2HTML) -s ldpOK.dsl developer-manual.sgml && mv developer-manual ../webserver
470         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks developer-manual.sgml > tmp.html && lynx -dump tmp.html > ../text/developer-manual.txt && rm -rf tmp.html developer-manual
471 ##  faq
472         rm -rf doc/webserver/faq
473         cd doc/source && $(DB2HTML) -s ldpOK.dsl faq.sgml && mv faq ../webserver
474         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks faq.sgml > tmp.html && lynx -dump tmp.html > ../text/faq.txt && rm -rf tmp.html faq
475
476 man2html-swa:
477         if [ "$(MAN2HTML)" != "false" ]; then \
478                 mkdir -p doc/webserver/man-page; \
479                 $(ECHO) "<html><head><title>Privoxy|Doc/Man page</title><link rel=\"stylesheet\" type=\"text/css\" href=\"../p_web.css\"></head><body><H2>NAME</H2>" > doc/webserver/man-page/privoxy-man-page.html; \
480                 man ./privoxy.1 | $(MAN2HTML) -bare \
481                  >> doc/webserver/man-page/privoxy-man-page.html; \
482                 $(ECHO) "</body></html>" >> doc/webserver/man-page/privoxy-man-page.html; \
483         fi
484
485 redhat-dok: doc/source/ldpOK.dsl man2html
486         mkdir -p doc/text doc/man doc/source/user-manual \
487           doc/source/developer-manual doc/source/faq
488 ##  user manual
489         rm -rf doc/webserver/user-manual
490         cd doc/source/user-manual && $(DB) ../user-manual.sgml && cd .. &&\
491           mv user-manual ../webserver
492         cd doc/source && $(DB) -V nochunks user-manual.sgml > tmp.html && \
493           $(WDUMP) tmp.html > ../text/user-manual.txt && rm -rf tmp.html \
494           user-manual
495 ##  developer manual
496         rm -rf doc/webserver/developer-manual
497         cd doc/source/developer-manual && $(DB) ../developer-manual.sgml &&\
498           cd .. && mv developer-manual ../webserver
499         cd doc/source && $(DB) -V nochunks developer-manual.sgml > tmp.html && \
500           $(WDUMP) tmp.html > ../text/developer-manual.txt && rm -rf tmp.html \
501           developer-manual
502 ##  faq
503         rm -rf doc/webserver/faq
504         cd doc/source/faq && $(DB) ../faq.sgml && cd .. && mv faq ../webserver
505         cd doc/source && $(DB) -V nochunks faq.sgml > tmp.html && $(WDUMP) \
506           tmp.html > ../text/faq.txt && rm -rf tmp.html faq
507
508 doc/source/ldpOK.dsl:
509         if [ "$(DKPREFIX)" != "none" ]; then \
510                 sed -e "s@/usr/share/sgml/docbook/dsssl-stylesheets@$(DKPREFIX)@g" doc/source/ldp.dsl > doc/source/ldpOK.dsl; \
511         else \
512                 cp doc/source/ldp.dsl doc/source/ldpOK.dsl; \
513         fi
514
515 man2html:
516         if [ "$(MAN2HTML)" != "false" ]; then \
517                 $(MAN2HTML) privoxy.1 |grep -v "^Content-type" > doc/webserver/man-page/privoxy-man-page.html; \
518         fi
519
520 #############################################################################
521 #
522 # Webserver
523 #
524 # moves dokumentation to webserver
525 #
526 #############################################################################
527 webserver:
528         @$(ECHO) -------------------------------------------------------
529         @$(ECHO) You have run make dok/redhat-dok before, right?
530         @$(ECHO) Note that this command scps all stuff to the webserver,
531         @$(ECHO) it will not remove obsolete documents.
532         @$(ECHO) -------------------------------------------------------
533         chmod -R a+r doc/webserver
534         find doc/webserver -type d -exec chmod a+rx {} \;
535         cd doc/webserver && scp -Cr . ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
536
537 #############################################################################
538 # Source file dependencies
539 #############################################################################
540
541 actions.@OBJEXT@:   actions.c   actions.h   config.h $(PROJECT_H_DEPS) errlog.h jcc.h list.h loaders.h miscutil.h actionlist.h
542 cgi.@OBJEXT@:       cgi.c       cgi.h       config.h $(PROJECT_H_DEPS) cgiedit.h cgisimple.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
543 cgiedit.@OBJEXT@:   cgiedit.c   cgiedit.h   config.h $(PROJECT_H_DEPS) cgi.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
544 cgisimple.@OBJEXT@: cgisimple.c cgisimple.h config.h $(PROJECT_H_DEPS) cgi.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
545 deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
546 encode.@OBJEXT@:    encode.c    encode.h    config.h
547 errlog.@OBJEXT@:    errlog.c    errlog.h    config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
548 filters.@OBJEXT@:   filters.c   filters.h   config.h $(PROJECT_H_DEPS) errlog.h encode.h gateway.h jbsockets.h jcc.h loadcfg.h parsers.h ssplit.h cgi.h deanimate.h @WIN_ONLY@win32.h 
549 gateway.@OBJEXT@:   gateway.c   gateway.h   config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
550 jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
551 jcc.@OBJEXT@:       jcc.c       jcc.h       config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h killpopup.h loadcfg.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h cgi.h
552 killpopup.@OBJEXT@: killpopup.c killpopup.h config.h $(PROJECT_H_DEPS) jcc.h loadcfg.h
553 list.@OBJEXT@:      list.c      list.h      config.h $(PROJECT_H_DEPS) list.h miscutil.h
554 loadcfg.@OBJEXT@:   loadcfg.c   loadcfg.h   config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h jcc.h killpopup.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h
555 loaders.@OBJEXT@:   loaders.c   loaders.h   config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h gateway.h jcc.h loadcfg.h miscutil.h parsers.h ssplit.h
556 miscutil.@OBJEXT@:  miscutil.c  miscutil.h  config.h
557 parsers.@OBJEXT@:   parsers.c   parsers.h   config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h jbsockets.h jcc.h loadcfg.h loaders.h miscutil.h ssplit.h
558 ssplit.@OBJEXT@:    ssplit.c    ssplit.h    config.h miscutil.h
559 urlmatch.@OBJEXT@:  urlmatch.c  urlmatch.h  config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
560
561 # GNU regex
562 gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
563
564 # PCRS
565 pcrs.@OBJEXT@: pcrs.c pcre/pcre.h pcrs.h
566
567 # PCRE
568 pcre/get.@OBJEXT@:        pcre/get.c        pcre/config.h pcre/internal.h pcre/pcre.h
569 pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
570 pcre/pcre.@OBJEXT@:       pcre/pcre.c       pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c 
571 pcre/pcreposix.@OBJEXT@:  pcre/pcreposix.c  pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
572 pcre/study.@OBJEXT@:      pcre/study.c      pcre/config.h pcre/internal.h pcre/pcre.h
573
574 # An auxiliary program makes the PCRE default character table source
575
576 pcre/chartables.c:   pcre/dftables@EXEEXT@
577                 pcre/dftables@EXEEXT@ >pcre/chartables.c
578
579 pcre/dftables@EXEEXT@:       pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
580                 $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
581
582 # Win32
583 w32log.@OBJEXT@: w32log.c errlog.h config.h jcc.h loadcfg.h miscutil.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h w32taskbar.h win32.h
584 w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
585 win32.@OBJEXT@: win32.c config.h jcc.h loadcfg.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h win32.h
586
587 w32.res: w32.rc w32res.h icons/ico00001.ico icons/ico00002.ico icons/ico00003.ico icons/ico00004.ico icons/ico00005.ico icons/ico00006.ico icons/ico00007.ico icons/ico00008.ico icons/idle.ico icons/privoxy.ico config.h
588         windres -D__MINGW32__=0.2 -O coff -i $< -o $@
589
590 # AmigaOS
591 @AMIGAOS_ONLY@OBJS += amiga.o
592 @AMIGAOS_ONLY@CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -W -m68020 -noixemul -fbaserel -msmall-code
593 @AMIGAOS_ONLY@LDFLAGS += -m68020 -noixemul -fbaserel
594 @AMIGAOS_ONLY@LIBS = -lm /gg/lib/libb/libm020/libnix/swapstack.o
595 @AMIGAOS_ONLY@amiga.o: amiga.c amiga.h config.h
596
597
598 $(PROGRAM): $(OBJS) $(W32_FILES)
599         $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
600
601 clean:
602         $(RM) a.out core $(OBJS) $(W32_FILES) $(W32_INIS) $(PROGRAM) junkbuster
603
604 clobber: clean
605         $(RM) $(PROGRAM) cscope.* logfile *.pdb *.lib *.exp `find . -name tags` `find . -name TAGS` config.status config.h.in config.log junkbuster.log privoxy.log config.cache *~ *.tar.gz configure
606
607 tags: $(SRCS) $(HDRS)
608         etags $(SRCS) $(HDRS)
609
610 install: all
611         #
612         # FIXME: This is a dirty hack to have an install target
613         #        that works at least for some setups. This needs
614         #        to be fixed!
615         #
616         $(STRIP_PROG) $(PROGRAM)
617         $(INSTALL) $(PROGRAM) $(SBIN_DEST)
618         mkdir -p $(DEST)/user-manual
619         mkdir -p $(DEST)/templates
620         cp -r doc/webserver/user-manual $(DEST)
621         cp -r templates $(DEST)
622         $(INSTALL) config default.action default.filter trust $(DEST)
623         # FIXME $(ECHO) privoxy.logrotate privoxy.monthly privoxy.weekly
624         # FIXME: Need new manual! $(GZIP_PROG) -c privoxy.1 > $(MAN_DEST)/privoxy.1.gz
625         $(INSTALL) privoxy.init /etc/init.d/privoxy
626
627
628 #############################################################################
629
630 ## Local Variables:
631 ## tab-width: 3
632 ## end:
633
634 # $Log: GNUmakefile.in,v $
635 # Revision 1.37  2002/03/27 15:30:26  swa
636 # have a consistent appearance
637 #
638 # Revision 1.36  2002/03/27 14:58:08  swa
639 # can be used by mutilple targets
640 #
641 # Revision 1.35  2002/03/27 14:53:19  swa
642 # added solaris-dist
643 #
644 # Revision 1.34  2002/03/27 10:30:11  swa
645 # we want a html man file on the webserver
646 #
647 # Revision 1.33  2002/03/27 03:05:35  hal9
648 # Added man2html target for docs (redhat-dok only for now)
649 #
650 # Revision 1.32  2002/03/26 22:29:54  swa
651 # we have a new homepage!
652 #
653 # Revision 1.31  2002/03/26 14:00:18  swa
654 # fixed make tarball, tarball-dist, tarball-clean
655 #
656 # Revision 1.30  2002/03/25 12:52:25  swa
657 # new targets
658 #
659 # Revision 1.29  2002/03/24 17:03:55  jongfoster
660 # Name change
661 #
662 # Revision 1.28  2002/03/24 16:19:48  swa
663 # configure needs to be generated.
664 #
665 # Revision 1.27  2002/03/24 16:13:57  swa
666 # generated files are a nono in cvs
667 #
668 # Revision 1.26  2002/03/24 15:36:02  swa
669 # did not build.
670 #
671 # Revision 1.25  2002/03/24 14:31:08  swa
672 # remove more crappy files. set RPM
673 # release version correctly.
674 #
675 # Revision 1.24  2002/03/24 14:19:55  swa
676 # set rpm package release in configure.in. nowhere else.
677 #
678 # Revision 1.23  2002/03/24 13:06:49  swa
679 # suse-clean now runs fine
680 #
681 # Revision 1.22  2002/03/24 12:56:21  swa
682 # name change related issues.
683 #
684 # Revision 1.21  2002/03/24 12:43:57  swa
685 # name change
686 #
687 # Revision 1.20  2002/03/24 11:39:17  jongfoster
688 # Renaming config files
689 #
690 # Revision 1.19  2002/03/22 20:53:03  morcego
691 # - Ongoing process to change name to JunkbusterNG
692 # - configure/configure.in: no change needed
693 # - GNUmakefile.in:
694 #         - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
695 #         - PROGRAM    = jbng@EXEEXT@
696 #         - rh-spec now references as junkbusterng-rh.spec
697 #         - redhat-upload: references changed to junkbusterng-* (package names)
698 #         - tarball-dist: references changed to JunkbusterNG-distribution-*
699 #         - tarball-src: now JunkbusterNG-*
700 #         - install: initscript now junkbusterng.init and junkbusterng (when
701 #                    installed)
702 # - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
703 # - junkbusterng.spec:
704 #         - References to the expression ijb where changed where possible
705 #         - New package name: junkbusterng (all in lower case, acording to
706 #           the LSB recomendation)
707 #         - Version changed to: 2.9.13
708 #         - Release: 1
709 #         - Added: junkbuster to obsoletes and conflicts (Not sure this is
710 #           right. If it obsoletes, why conflict ? Have to check it later)
711 #         - Summary changed: Stefan, please check and aprove it
712 #         - Changes description to use the new name
713 #         - Sed string was NOT changed. Have to wait to the manpage to
714 #           change first
715 #         - Keeping the user junkbuster for now. It will require some aditional
716 #           changes on the script (scheduled for the next specfile release)
717 #         - Added post entry to move the old logfile to the new log directory
718 #         - Removing "chkconfig --add" entry (not good to have it automaticaly
719 #           added to the startup list).
720 #         - Added preun section to stop the service with the old name, as well
721 #           as remove it from the startup list
722 #         - Removed the chkconfig --del entry from the conditional block on
723 #           the preun scriptlet (now handled on the %files section)
724 # - junkbuster.init: renamed to junkbusterng.init
725 # - junkbusterng.init:
726 #         - Changed JB_BIN to jbng
727 #         - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
728 #           be used where necessary (config dir)
729 #
730 # Aditional notes:
731 # - The config directory is /etc/junkbuster yet. Have to change it on the
732 # specfile, after it is changes on the code
733 # - The only files that got renamed on the cvs tree were the rh specfile and
734 # the init file. Some file references got changes on the makefile and on the
735 # rh-spec (as listed above)
736 #
737 # Revision 1.18  2002/03/21 23:00:00  swa
738 # want to autogenerate stuff.
739 #
740 # Revision 1.17  2002/03/19 19:30:04  morcego
741 # - Fixing stylesheet checking on configure. If it is found, no further checks
742 #   should be done
743 #
744 # - configure will now check for db2html or docbook2html (should work now
745 #   on SuSe without the docbktls package)
746 #
747 # Revision 1.16  2002/03/14 22:32:32  hal9
748 # Bumped the RPM version.
749 #
750 # Revision 1.15  2002/03/08 20:00:28  swa
751 # some leftovers.
752 #
753 # Revision 1.14  2002/03/07 18:25:56  swa
754 # synced redhat and suse build process
755 #
756 # Revision 1.13  2002/03/07 17:17:56  oes
757 # (Hopefully) fixed for older make versions
758 #
759 # Revision 1.12  2002/03/07 15:28:27  swa
760 # more informative
761 #
762 # Revision 1.11  2002/03/06 14:33:18  sarantis
763 # Use proper temp file, not "abc".
764 #
765 # Revision 1.10  2002/03/06 14:19:35  sarantis
766 # Cleanup PID_FILE_PATH from redhat-dist target
767 #
768 # Revision 1.9  2002/03/05 17:31:11  morcego
769 # Search for docbook.dsl. Should solve portability problems for SuSe.
770 #
771 # Revision 1.8  2002/03/05 14:07:42  morcego
772 # configure now detects rpm topdir, and change GNUmakefile acordingly
773 #    (based on sugestion by Sarantis Paskalis)
774 #
775 # Revision 1.7  2002/03/05 13:43:28  morcego
776 # Checking for text browser, so redhat-dok can work.
777 #
778 # Revision 1.6  2002/03/05 13:10:51  morcego
779 # Changes to implement redhat-dok (Hal Burgiss)
780 # Changes to make it work on other distros and out-of-the-shelf configurations
781 #
782 # Revision 1.5  2002/02/27 15:30:39  hal9
783 # Reset $(RPM_PACKAGEV) to 1 (was 2)
784 #
785 # Revision 1.4  2002/01/17 21:44:04  jongfoster
786 # Adding urlmatch.[ch]
787 #
788 # Revision 1.3  2002/01/04 15:26:08  oes
789 # Added tarball-src target
790 #
791 # Revision 1.2  2001/12/30 14:07:31  steudten
792 # - Add signal handling (unix)
793 # - Add SIGHUP handler (unix)
794 # - Add creation of pidfile (unix)
795 # - Add action 'top' in rc file (RH)
796 # - Add entry 'SIGNALS' to manpage
797 # - Add exit message to logfile (unix)
798 #
799 # Revision 1.1  2001/12/01 11:22:57  jongfoster
800 # Renaming Makefile.in to GNUmakefile.in so that non-GNU versions of
801 # make break in a more obvious way.
802 # Adding .PHONY section.
803 #
804 # Revision 1.40  2001/12/01 00:24:11  jongfoster
805 # Renaming various config files
806 # Fixing CR->CRLF under Win32 (I hope)
807 #
808 # Revision 1.39  2001/11/06 12:07:30  steudten
809 # Add --clean for building rpm in target redhat-dist.
810 #
811 # Revision 1.38  2001/11/05 21:35:23  steudten
812 # Complete rewrite for the 'redhat-dist' target.
813 # Checks for writeable RPM build directories for calling user.
814 # So you must not be root, just set the modes to 1777 to
815 # build a RH package.
816 # Fix the upload-target to be arch independant.
817 # Add target for 'solaris-dist' - coming soon.
818 #
819 # Revision 1.37  2001/11/01 00:52:04  hal9
820 # Redhat-upload stuff per Stefan.
821 #
822 # Revision 1.36  2001/10/31 19:26:13  swa
823 # automate process of uploading new releases
824 # to sf.
825 #
826 # Revision 1.35  2001/10/15 22:14:59  joergs
827 # Removed -O2 and -Wall from AmigaOS-only CFLAGS since they are now in
828 #  the general CFLAGS already.
829 #
830 # Revision 1.34  2001/10/15 18:28:06  steudten
831 # remove config.cache for target clobber.
832 # Cleanup make dist for RH and S.u.S.E.
833 #
834 # Revision 1.33  2001/10/10 12:43:33  oes
835 # Added ugly hack to make install target work at least for some setups.
836 #
837 # Revision 1.32  2001/10/09 22:38:19  jongfoster
838 # Correcting actionsfile filename for Win32 INI build
839 #
840 # Revision 1.31  2001/09/23 10:13:48  swa
841 # upload process established. run make webserver and
842 # the documentation is moved to the webserver. documents
843 # are now linked correctly.
844 #
845 # Revision 1.30  2001/09/19 17:55:49  oes
846 # Fixed CFLAGS
847 #
848 # Revision 1.29  2001/09/16 17:34:27  jongfoster
849 # Removing showargs.[ch], adding cgi(simple|edit).[ch]
850 # Replacing $(OBJEXT) with @OBJEXT@ - this seems to be a common source
851 # of build problems.
852 #
853 # Revision 1.28  2001/09/13 15:19:08  swa
854 # we want text files as well.
855 #
856 # Revision 1.27  2001/09/13 13:11:37  steudten
857 #
858 # Replace DEBUG_CFLAGS with OTHER_CFLAGS
859 #
860 # Revision 1.26  2001/09/12 23:44:54  david__schmidt
861 # Mac OSX (Darwin) support added.
862 #
863 # Revision 1.25  2001/09/12 22:55:45  joergs
864 # AmigaOS support added.
865 #
866 # Revision 1.24  2001/09/12 17:28:59  david__schmidt
867 #
868 # OS/2 port: update autoconf'd support for the platform.
869 #
870 # Revision 1.23  2001/09/12 16:28:42  swa
871 # added "make dok" section to generate html pages from
872 # the sgml source documents. note that the we do not want
873 # generated stuff in cvs.
874 #
875 # Revision 1.22  2001/09/10 16:31:23  swa
876 # buildroot definition in the specfile fucks up the build
877 # process under suse. hence I moved it to the "rpm -ta"
878 # command
879 #
880 # Revision 1.21  2001/09/10 11:12:49  oes
881 # Turning on -Wall
882 #
883 # Revision 1.20  2001/08/02 22:04:29  jongfoster
884 # Removing some remaining references to obsolete w32rulesdlg.[ch]
885 #
886 # Revision 1.19  2001/07/30 22:14:03  jongfoster
887 # Removing obsolete w32rulesdlg.c and w32rulesdlg.h
888 #
889 # Revision 1.18  2001/07/29 17:09:17  jongfoster
890 # Major changes to build system in order to fix these bugs:
891 # - pthreads under Linux was broken - changed -lpthread to -pthread
892 # - Compiling in MinGW32 mode under CygWin now correctly detects
893 #   which shared libraries are available
894 # - Solaris support (?) (Not tested under Solaris yet)
895 #
896 # Revision 1.17  2001/07/28 16:44:54  oes
897 # Fixed sed LF->CRLF conversion and removed deprecated files
898 #
899 # Revision 1.16  2001/07/15 19:45:33  jongfoster
900 # Added support for linking with POSIX threads library
901 #
902 # Revision 1.15  2001/07/13 13:48:07  oes
903 #  - Moved STATIC #define for pcre to (ac)config.h
904 #  - Made -Ipcre depandant on static pcre compilation to
905 #    avoid version conflicts
906 #  - Included compilation and depandancies for new deanimate.c
907 #  - Made changes to the pcre/pcreposix/pcrs build process
908 #    as required by the new library autodetection in
909 #    configure.in
910 #
911 # Revision 1.14  2001/07/01 16:27:44  oes
912 # Fixed misplaced dependancy
913 #
914 # Revision 1.13  2001/06/29 13:18:36  oes
915 # - added depandancy of filters.o on cgi.h
916 #
917 # Revision 1.12  2001/06/12 17:15:56  swa
918 # fixes, because a clean build on rh6.1 was impossible.
919 # GZIP confuses make, %configure confuses rpm, etc.
920 #
921 # Revision 1.11  2001/06/11 11:26:35  sarantis
922 # RPM version should be the same as ijbswa version.  The rpm release is
923 # specified in the specfile.
924 #
925 # Revision 1.10  2001/06/07 17:27:45  swa
926 # added suse build section
927 #
928 # Revision 1.9  2001/06/04 18:31:58  swa
929 # files are now prefixed with either `confdir' or `logdir'.
930 # `make redhat-dist' replaces both entries confdir and logdir
931 # with redhat values
932 #
933 # Revision 1.8  2001/06/04 10:44:57  swa
934 # `make redhatr-dist' now works. Except for the paths
935 # in the config file.
936 #
937 # Revision 1.7  2001/06/03 17:09:09  swa
938 # swa for oes: reversed my earlier change
939 #
940 # Revision 1.6  2001/06/03 17:07:27  swa
941 # swa for oes
942 #
943 # Revision 1.5  2001/06/03 13:57:26  swa
944 # compile cgi.c (for andreas' GUI)
945 #
946 # Revision 1.4  2001/05/31 21:18:45  jongfoster
947 # Added files actions.[ch], actionlist.h, list.[ch] to Makefile
948 #
949 # Revision 1.3  2001/05/29 20:02:48  joergs
950 # Changes for AmigaOS added.
951 #
952 # Revision 1.2  2001/05/17 22:23:23  oes
953 #  - Added auto-generation of CRLFs for Win32 config files
954 #  - Added comment-prefix to all Win32-only options in the config file
955 #    and provided auto stripping of this prefix for the Win32 platform by make
956 #
957 # Revision 1.1.1.1  2001/05/15 13:59:00  oes
958 # Initial import of version 2.9.3 source tree
959 #
960 #