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