have a consistent appearance
[privoxy.git] / GNUmakefile.in
1 # Note:  Makefile is built automatically from Makefile.in
2 #
3 # $Id: GNUmakefile.in,v 1.36 2002/03/27 14:58:08 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  = foobar
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 # sun solaris  distribution
272 #############################################################################
273
274 solaris-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 solaris-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 solaris-clean:
307         $(RM) privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar*
308
309 #############################################################################
310 # hpux distribution
311 #############################################################################
312 hpux-dist:
313         @$(ECHO) coming soon. 
314 hpux-upload:
315         @$(ECHO) coming soon. 
316
317 #############################################################################
318 # debian distribution
319 #############################################################################
320 debian-dist:
321         @$(ECHO) coming soon. 
322 debian-upload:
323         @$(ECHO) coming soon. 
324
325 #############################################################################
326 # macosx distribution
327 #############################################################################
328 macosx-dist:
329         @$(ECHO) coming soon. 
330 macosx-upload:
331         @$(ECHO) coming soon. 
332
333 #############################################################################
334 # amiga distribution
335 #############################################################################
336 amiga-dist:
337         @$(ECHO) coming soon. 
338 amiga-upload:
339         @$(ECHO) coming soon. 
340
341 #############################################################################
342 # freebsd distribution
343 #############################################################################
344 freebsd-dist:
345         @$(ECHO) coming soon. 
346 freebsd-upload:
347         @$(ECHO) coming soon. 
348
349 #############################################################################
350 # suse distribution. works fine. no need to be root. 
351 #############################################################################
352 suse-dist:
353         for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
354                 if [ ! -w $(RPM_BASE)/$$dir ]; then \
355                         $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
356                         $(ECHO) "Or add a suitable path to .rpmmacros like."; \
357                         $(ECHO) "%_topdir /home/foo/rpm-build"; \
358                         exit 1; \
359                 fi; \
360         done; \
361
362         $(MAKE) clobber
363         if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
364
365         TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
366         if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSIO)/g' \
367              -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
368               privoxy-suse.spec > $$TMPFILE ; then \
369       $(MV) -f $$TMPFILE privoxy-suse.spec; \
370    else \
371       $(ECHO) "Could not set version info in specfile."; \
372       exit 1;\
373    fi
374
375         $(TAR) --exclude "CVS" --exclude "privoxy-rh.spec" -czf $(TAR_ARCH) .
376         $(RPM) --clean -ta  $(TAR_ARCH)
377         if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
378
379 #
380 # anonymously ncftps the rpms to sourceforge
381 #
382 suse-upload:
383         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/privoxy-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
384 # better should use `arch` here instead of ix86 to support other platforms too
385         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/privoxy-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
386         @$(ECHO) -------------------------------------------------------
387         @$(ECHO) Now goto
388         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
389         @$(ECHO) ... and release the files.
390         @$(ECHO) -------------------------------------------------------
391
392 # handle with care. use with root.
393 suse-clean:
394         rpm -e junkbuster-suse || true
395         rm -rf /etc/junkbuster
396         rm -rf /etc/rc.d/junkbuster*
397         rm -rf /var/run/junkbuster.pid 
398         rm -rf /var/log/junkbuster
399         rm -f /etc/init.d/junkbuster
400         rm -f /usr/sbin/junkbuster
401         rm -f /usr/sbin/rcjunkbuster
402         rm -f /usr/share/man/man1/junkbuster.1.gz
403         rpm -e privoxy-suse || true
404         rm -rf /etc/privoxy
405         rm -rf /etc/rc.d/privoxy*
406         rm -rf /var/run/privoxy.pid 
407         rm -rf /var/log/privoxy
408         rm -f /etc/init.d/privoxy
409         rm -f /usr/sbin/privoxy
410         rm -f /usr/sbin/rcprivoxy
411         rm -f /usr/share/man/man1/privoxy.1.gz
412
413 #############################################################################
414 # Windows distribution
415 #############################################################################
416 win-dist:
417         $(ECHO) Not implemented.
418
419
420 #############################################################################
421 # Tarball distribution
422 #############################################################################
423 tarball-dist: clobber
424         $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
425         $(TAR) -C.. --exclude "CVS" --exclude "#*" --exclude ".#*" --exclude ".cvsignore" -cvhzf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz privoxy-$(VERSION)-$(CODE_STATUS)
426         $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
427         @$(ECHO) Tarball (without any binary) created.
428
429 # anonymously ncftps the tarball to sourceforge
430 tarball-upload:
431         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
432         @$(ECHO) -------------------------------------------------------
433         @$(ECHO) Now goto
434         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
435         @$(ECHO) ... and release the files.
436         @$(ECHO) -------------------------------------------------------
437
438 # handle with care
439 tarball-clean:
440         $(RM) privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
441
442 #############################################################################
443 #
444 # Documentation
445 #
446 # converts doc/source/*.sgml into html, text and man pages
447 #
448 #############################################################################
449 dok: doc/source/ldpOK.dsl man2html-swa
450         mkdir -p doc/text doc/man
451 #  user manual
452         rm -rf doc/webserver/user-manual
453         cd doc/source && $(DB2HTML) -s ldpOK.dsl user-manual.sgml && mv user-manual ../webserver
454         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
455 ##  developer manual
456         rm -rf doc/webserver/developer-manual
457         cd doc/source && $(DB2HTML) -s ldpOK.dsl developer-manual.sgml && mv developer-manual ../webserver
458         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
459 ##  faq
460         rm -rf doc/webserver/faq
461         cd doc/source && $(DB2HTML) -s ldpOK.dsl faq.sgml && mv faq ../webserver
462         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks faq.sgml > tmp.html && lynx -dump tmp.html > ../text/faq.txt && rm -rf tmp.html faq
463
464 man2html-swa:
465         if [ "$(MAN2HTML)" != "false" ]; then \
466                 mkdir -p doc/webserver/man-page; \
467                 $(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; \
468                 man ./privoxy.1 | $(MAN2HTML) -bare \
469                  >> doc/webserver/man-page/privoxy-man-page.html; \
470                 $(ECHO) "</body></html>" >> doc/webserver/man-page/privoxy-man-page.html; \
471         fi
472
473 redhat-dok: doc/source/ldpOK.dsl man2html
474         mkdir -p doc/text doc/man doc/source/user-manual \
475           doc/source/developer-manual doc/source/faq
476 ##  user manual
477         rm -rf doc/webserver/user-manual
478         cd doc/source/user-manual && $(DB) ../user-manual.sgml && cd .. &&\
479           mv user-manual ../webserver
480         cd doc/source && $(DB) -V nochunks user-manual.sgml > tmp.html && \
481           $(WDUMP) tmp.html > ../text/user-manual.txt && rm -rf tmp.html \
482           user-manual
483 ##  developer manual
484         rm -rf doc/webserver/developer-manual
485         cd doc/source/developer-manual && $(DB) ../developer-manual.sgml &&\
486           cd .. && mv developer-manual ../webserver
487         cd doc/source && $(DB) -V nochunks developer-manual.sgml > tmp.html && \
488           $(WDUMP) tmp.html > ../text/developer-manual.txt && rm -rf tmp.html \
489           developer-manual
490 ##  faq
491         rm -rf doc/webserver/faq
492         cd doc/source/faq && $(DB) ../faq.sgml && cd .. && mv faq ../webserver
493         cd doc/source && $(DB) -V nochunks faq.sgml > tmp.html && $(WDUMP) \
494           tmp.html > ../text/faq.txt && rm -rf tmp.html faq
495
496 doc/source/ldpOK.dsl:
497         if [ "$(DKPREFIX)" != "none" ]; then \
498                 sed -e "s@/usr/share/sgml/docbook/dsssl-stylesheets@$(DKPREFIX)@g" doc/source/ldp.dsl > doc/source/ldpOK.dsl; \
499         else \
500                 cp doc/source/ldp.dsl doc/source/ldpOK.dsl; \
501         fi
502
503 man2html:
504         if [ "$(MAN2HTML)" != "false" ]; then \
505                 $(MAN2HTML) privoxy.1 |grep -v "^Content-type" > doc/webserver/man-page/privoxy-man-page.html; \
506         fi
507
508 #############################################################################
509 #
510 # Webserver
511 #
512 # moves dokumentation to webserver
513 #
514 #############################################################################
515 webserver:
516         @$(ECHO) -------------------------------------------------------
517         @$(ECHO) You have run make dok/redhat-dok before, right?
518         @$(ECHO) Note that this command scps all stuff to the webserver,
519         @$(ECHO) it will not remove obsolete documents.
520         @$(ECHO) -------------------------------------------------------
521         chmod -R a+r doc/webserver
522         find doc/webserver -type d -exec chmod a+rx {} \;
523         cd doc/webserver && scp -Cr . ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
524
525 #############################################################################
526 # Source file dependencies
527 #############################################################################
528
529 actions.@OBJEXT@:   actions.c   actions.h   config.h $(PROJECT_H_DEPS) errlog.h jcc.h list.h loaders.h miscutil.h actionlist.h
530 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
531 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
532 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
533 deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
534 encode.@OBJEXT@:    encode.c    encode.h    config.h
535 errlog.@OBJEXT@:    errlog.c    errlog.h    config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
536 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 
537 gateway.@OBJEXT@:   gateway.c   gateway.h   config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
538 jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
539 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
540 killpopup.@OBJEXT@: killpopup.c killpopup.h config.h $(PROJECT_H_DEPS) jcc.h loadcfg.h
541 list.@OBJEXT@:      list.c      list.h      config.h $(PROJECT_H_DEPS) list.h miscutil.h
542 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
543 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
544 miscutil.@OBJEXT@:  miscutil.c  miscutil.h  config.h
545 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
546 ssplit.@OBJEXT@:    ssplit.c    ssplit.h    config.h miscutil.h
547 urlmatch.@OBJEXT@:  urlmatch.c  urlmatch.h  config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
548
549 # GNU regex
550 gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
551
552 # PCRS
553 pcrs.@OBJEXT@: pcrs.c pcre/pcre.h pcrs.h
554
555 # PCRE
556 pcre/get.@OBJEXT@:        pcre/get.c        pcre/config.h pcre/internal.h pcre/pcre.h
557 pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
558 pcre/pcre.@OBJEXT@:       pcre/pcre.c       pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c 
559 pcre/pcreposix.@OBJEXT@:  pcre/pcreposix.c  pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
560 pcre/study.@OBJEXT@:      pcre/study.c      pcre/config.h pcre/internal.h pcre/pcre.h
561
562 # An auxiliary program makes the PCRE default character table source
563
564 pcre/chartables.c:   pcre/dftables@EXEEXT@
565                 pcre/dftables@EXEEXT@ >pcre/chartables.c
566
567 pcre/dftables@EXEEXT@:       pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
568                 $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
569
570 # Win32
571 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
572 w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
573 win32.@OBJEXT@: win32.c config.h jcc.h loadcfg.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h win32.h
574
575 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
576         windres -D__MINGW32__=0.2 -O coff -i $< -o $@
577
578 # AmigaOS
579 @AMIGAOS_ONLY@OBJS += amiga.o
580 @AMIGAOS_ONLY@CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -W -m68020 -noixemul -fbaserel -msmall-code
581 @AMIGAOS_ONLY@LDFLAGS += -m68020 -noixemul -fbaserel
582 @AMIGAOS_ONLY@LIBS = -lm /gg/lib/libb/libm020/libnix/swapstack.o
583 @AMIGAOS_ONLY@amiga.o: amiga.c amiga.h config.h
584
585
586 $(PROGRAM): $(OBJS) $(W32_FILES)
587         $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
588
589 clean:
590         $(RM) a.out core $(OBJS) $(W32_FILES) $(W32_INIS) $(PROGRAM) junkbuster
591
592 clobber: clean
593         $(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
594
595 tags: $(SRCS) $(HDRS)
596         etags $(SRCS) $(HDRS)
597
598 install: all
599         #
600         # FIXME: This is a dirty hack to have an install target
601         #        that works at least for some setups. This needs
602         #        to be fixed!
603         #
604         $(STRIP_PROG) $(PROGRAM)
605         $(INSTALL) $(PROGRAM) $(SBIN_DEST)
606         mkdir -p $(DEST)/user-manual
607         mkdir -p $(DEST)/templates
608         cp -r doc/webserver/user-manual $(DEST)
609         cp -r templates $(DEST)
610         $(INSTALL) config default.action default.filter trust $(DEST)
611         # FIXME $(ECHO) privoxy.logrotate privoxy.monthly privoxy.weekly
612         # FIXME: Need new manual! $(GZIP_PROG) -c privoxy.1 > $(MAN_DEST)/privoxy.1.gz
613         $(INSTALL) privoxy.init /etc/init.d/privoxy
614
615
616 #############################################################################
617
618 ## Local Variables:
619 ## tab-width: 3
620 ## end:
621
622 # $Log: GNUmakefile.in,v $
623 # Revision 1.36  2002/03/27 14:58:08  swa
624 # can be used by mutilple targets
625 #
626 # Revision 1.35  2002/03/27 14:53:19  swa
627 # added solaris-dist
628 #
629 # Revision 1.34  2002/03/27 10:30:11  swa
630 # we want a html man file on the webserver
631 #
632 # Revision 1.33  2002/03/27 03:05:35  hal9
633 # Added man2html target for docs (redhat-dok only for now)
634 #
635 # Revision 1.32  2002/03/26 22:29:54  swa
636 # we have a new homepage!
637 #
638 # Revision 1.31  2002/03/26 14:00:18  swa
639 # fixed make tarball, tarball-dist, tarball-clean
640 #
641 # Revision 1.30  2002/03/25 12:52:25  swa
642 # new targets
643 #
644 # Revision 1.29  2002/03/24 17:03:55  jongfoster
645 # Name change
646 #
647 # Revision 1.28  2002/03/24 16:19:48  swa
648 # configure needs to be generated.
649 #
650 # Revision 1.27  2002/03/24 16:13:57  swa
651 # generated files are a nono in cvs
652 #
653 # Revision 1.26  2002/03/24 15:36:02  swa
654 # did not build.
655 #
656 # Revision 1.25  2002/03/24 14:31:08  swa
657 # remove more crappy files. set RPM
658 # release version correctly.
659 #
660 # Revision 1.24  2002/03/24 14:19:55  swa
661 # set rpm package release in configure.in. nowhere else.
662 #
663 # Revision 1.23  2002/03/24 13:06:49  swa
664 # suse-clean now runs fine
665 #
666 # Revision 1.22  2002/03/24 12:56:21  swa
667 # name change related issues.
668 #
669 # Revision 1.21  2002/03/24 12:43:57  swa
670 # name change
671 #
672 # Revision 1.20  2002/03/24 11:39:17  jongfoster
673 # Renaming config files
674 #
675 # Revision 1.19  2002/03/22 20:53:03  morcego
676 # - Ongoing process to change name to JunkbusterNG
677 # - configure/configure.in: no change needed
678 # - GNUmakefile.in:
679 #         - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
680 #         - PROGRAM    = jbng@EXEEXT@
681 #         - rh-spec now references as junkbusterng-rh.spec
682 #         - redhat-upload: references changed to junkbusterng-* (package names)
683 #         - tarball-dist: references changed to JunkbusterNG-distribution-*
684 #         - tarball-src: now JunkbusterNG-*
685 #         - install: initscript now junkbusterng.init and junkbusterng (when
686 #                    installed)
687 # - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
688 # - junkbusterng.spec:
689 #         - References to the expression ijb where changed where possible
690 #         - New package name: junkbusterng (all in lower case, acording to
691 #           the LSB recomendation)
692 #         - Version changed to: 2.9.13
693 #         - Release: 1
694 #         - Added: junkbuster to obsoletes and conflicts (Not sure this is
695 #           right. If it obsoletes, why conflict ? Have to check it later)
696 #         - Summary changed: Stefan, please check and aprove it
697 #         - Changes description to use the new name
698 #         - Sed string was NOT changed. Have to wait to the manpage to
699 #           change first
700 #         - Keeping the user junkbuster for now. It will require some aditional
701 #           changes on the script (scheduled for the next specfile release)
702 #         - Added post entry to move the old logfile to the new log directory
703 #         - Removing "chkconfig --add" entry (not good to have it automaticaly
704 #           added to the startup list).
705 #         - Added preun section to stop the service with the old name, as well
706 #           as remove it from the startup list
707 #         - Removed the chkconfig --del entry from the conditional block on
708 #           the preun scriptlet (now handled on the %files section)
709 # - junkbuster.init: renamed to junkbusterng.init
710 # - junkbusterng.init:
711 #         - Changed JB_BIN to jbng
712 #         - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
713 #           be used where necessary (config dir)
714 #
715 # Aditional notes:
716 # - The config directory is /etc/junkbuster yet. Have to change it on the
717 # specfile, after it is changes on the code
718 # - The only files that got renamed on the cvs tree were the rh specfile and
719 # the init file. Some file references got changes on the makefile and on the
720 # rh-spec (as listed above)
721 #
722 # Revision 1.18  2002/03/21 23:00:00  swa
723 # want to autogenerate stuff.
724 #
725 # Revision 1.17  2002/03/19 19:30:04  morcego
726 # - Fixing stylesheet checking on configure. If it is found, no further checks
727 #   should be done
728 #
729 # - configure will now check for db2html or docbook2html (should work now
730 #   on SuSe without the docbktls package)
731 #
732 # Revision 1.16  2002/03/14 22:32:32  hal9
733 # Bumped the RPM version.
734 #
735 # Revision 1.15  2002/03/08 20:00:28  swa
736 # some leftovers.
737 #
738 # Revision 1.14  2002/03/07 18:25:56  swa
739 # synced redhat and suse build process
740 #
741 # Revision 1.13  2002/03/07 17:17:56  oes
742 # (Hopefully) fixed for older make versions
743 #
744 # Revision 1.12  2002/03/07 15:28:27  swa
745 # more informative
746 #
747 # Revision 1.11  2002/03/06 14:33:18  sarantis
748 # Use proper temp file, not "abc".
749 #
750 # Revision 1.10  2002/03/06 14:19:35  sarantis
751 # Cleanup PID_FILE_PATH from redhat-dist target
752 #
753 # Revision 1.9  2002/03/05 17:31:11  morcego
754 # Search for docbook.dsl. Should solve portability problems for SuSe.
755 #
756 # Revision 1.8  2002/03/05 14:07:42  morcego
757 # configure now detects rpm topdir, and change GNUmakefile acordingly
758 #    (based on sugestion by Sarantis Paskalis)
759 #
760 # Revision 1.7  2002/03/05 13:43:28  morcego
761 # Checking for text browser, so redhat-dok can work.
762 #
763 # Revision 1.6  2002/03/05 13:10:51  morcego
764 # Changes to implement redhat-dok (Hal Burgiss)
765 # Changes to make it work on other distros and out-of-the-shelf configurations
766 #
767 # Revision 1.5  2002/02/27 15:30:39  hal9
768 # Reset $(RPM_PACKAGEV) to 1 (was 2)
769 #
770 # Revision 1.4  2002/01/17 21:44:04  jongfoster
771 # Adding urlmatch.[ch]
772 #
773 # Revision 1.3  2002/01/04 15:26:08  oes
774 # Added tarball-src target
775 #
776 # Revision 1.2  2001/12/30 14:07:31  steudten
777 # - Add signal handling (unix)
778 # - Add SIGHUP handler (unix)
779 # - Add creation of pidfile (unix)
780 # - Add action 'top' in rc file (RH)
781 # - Add entry 'SIGNALS' to manpage
782 # - Add exit message to logfile (unix)
783 #
784 # Revision 1.1  2001/12/01 11:22:57  jongfoster
785 # Renaming Makefile.in to GNUmakefile.in so that non-GNU versions of
786 # make break in a more obvious way.
787 # Adding .PHONY section.
788 #
789 # Revision 1.40  2001/12/01 00:24:11  jongfoster
790 # Renaming various config files
791 # Fixing CR->CRLF under Win32 (I hope)
792 #
793 # Revision 1.39  2001/11/06 12:07:30  steudten
794 # Add --clean for building rpm in target redhat-dist.
795 #
796 # Revision 1.38  2001/11/05 21:35:23  steudten
797 # Complete rewrite for the 'redhat-dist' target.
798 # Checks for writeable RPM build directories for calling user.
799 # So you must not be root, just set the modes to 1777 to
800 # build a RH package.
801 # Fix the upload-target to be arch independant.
802 # Add target for 'solaris-dist' - coming soon.
803 #
804 # Revision 1.37  2001/11/01 00:52:04  hal9
805 # Redhat-upload stuff per Stefan.
806 #
807 # Revision 1.36  2001/10/31 19:26:13  swa
808 # automate process of uploading new releases
809 # to sf.
810 #
811 # Revision 1.35  2001/10/15 22:14:59  joergs
812 # Removed -O2 and -Wall from AmigaOS-only CFLAGS since they are now in
813 #  the general CFLAGS already.
814 #
815 # Revision 1.34  2001/10/15 18:28:06  steudten
816 # remove config.cache for target clobber.
817 # Cleanup make dist for RH and S.u.S.E.
818 #
819 # Revision 1.33  2001/10/10 12:43:33  oes
820 # Added ugly hack to make install target work at least for some setups.
821 #
822 # Revision 1.32  2001/10/09 22:38:19  jongfoster
823 # Correcting actionsfile filename for Win32 INI build
824 #
825 # Revision 1.31  2001/09/23 10:13:48  swa
826 # upload process established. run make webserver and
827 # the documentation is moved to the webserver. documents
828 # are now linked correctly.
829 #
830 # Revision 1.30  2001/09/19 17:55:49  oes
831 # Fixed CFLAGS
832 #
833 # Revision 1.29  2001/09/16 17:34:27  jongfoster
834 # Removing showargs.[ch], adding cgi(simple|edit).[ch]
835 # Replacing $(OBJEXT) with @OBJEXT@ - this seems to be a common source
836 # of build problems.
837 #
838 # Revision 1.28  2001/09/13 15:19:08  swa
839 # we want text files as well.
840 #
841 # Revision 1.27  2001/09/13 13:11:37  steudten
842 #
843 # Replace DEBUG_CFLAGS with OTHER_CFLAGS
844 #
845 # Revision 1.26  2001/09/12 23:44:54  david__schmidt
846 # Mac OSX (Darwin) support added.
847 #
848 # Revision 1.25  2001/09/12 22:55:45  joergs
849 # AmigaOS support added.
850 #
851 # Revision 1.24  2001/09/12 17:28:59  david__schmidt
852 #
853 # OS/2 port: update autoconf'd support for the platform.
854 #
855 # Revision 1.23  2001/09/12 16:28:42  swa
856 # added "make dok" section to generate html pages from
857 # the sgml source documents. note that the we do not want
858 # generated stuff in cvs.
859 #
860 # Revision 1.22  2001/09/10 16:31:23  swa
861 # buildroot definition in the specfile fucks up the build
862 # process under suse. hence I moved it to the "rpm -ta"
863 # command
864 #
865 # Revision 1.21  2001/09/10 11:12:49  oes
866 # Turning on -Wall
867 #
868 # Revision 1.20  2001/08/02 22:04:29  jongfoster
869 # Removing some remaining references to obsolete w32rulesdlg.[ch]
870 #
871 # Revision 1.19  2001/07/30 22:14:03  jongfoster
872 # Removing obsolete w32rulesdlg.c and w32rulesdlg.h
873 #
874 # Revision 1.18  2001/07/29 17:09:17  jongfoster
875 # Major changes to build system in order to fix these bugs:
876 # - pthreads under Linux was broken - changed -lpthread to -pthread
877 # - Compiling in MinGW32 mode under CygWin now correctly detects
878 #   which shared libraries are available
879 # - Solaris support (?) (Not tested under Solaris yet)
880 #
881 # Revision 1.17  2001/07/28 16:44:54  oes
882 # Fixed sed LF->CRLF conversion and removed deprecated files
883 #
884 # Revision 1.16  2001/07/15 19:45:33  jongfoster
885 # Added support for linking with POSIX threads library
886 #
887 # Revision 1.15  2001/07/13 13:48:07  oes
888 #  - Moved STATIC #define for pcre to (ac)config.h
889 #  - Made -Ipcre depandant on static pcre compilation to
890 #    avoid version conflicts
891 #  - Included compilation and depandancies for new deanimate.c
892 #  - Made changes to the pcre/pcreposix/pcrs build process
893 #    as required by the new library autodetection in
894 #    configure.in
895 #
896 # Revision 1.14  2001/07/01 16:27:44  oes
897 # Fixed misplaced dependancy
898 #
899 # Revision 1.13  2001/06/29 13:18:36  oes
900 # - added depandancy of filters.o on cgi.h
901 #
902 # Revision 1.12  2001/06/12 17:15:56  swa
903 # fixes, because a clean build on rh6.1 was impossible.
904 # GZIP confuses make, %configure confuses rpm, etc.
905 #
906 # Revision 1.11  2001/06/11 11:26:35  sarantis
907 # RPM version should be the same as ijbswa version.  The rpm release is
908 # specified in the specfile.
909 #
910 # Revision 1.10  2001/06/07 17:27:45  swa
911 # added suse build section
912 #
913 # Revision 1.9  2001/06/04 18:31:58  swa
914 # files are now prefixed with either `confdir' or `logdir'.
915 # `make redhat-dist' replaces both entries confdir and logdir
916 # with redhat values
917 #
918 # Revision 1.8  2001/06/04 10:44:57  swa
919 # `make redhatr-dist' now works. Except for the paths
920 # in the config file.
921 #
922 # Revision 1.7  2001/06/03 17:09:09  swa
923 # swa for oes: reversed my earlier change
924 #
925 # Revision 1.6  2001/06/03 17:07:27  swa
926 # swa for oes
927 #
928 # Revision 1.5  2001/06/03 13:57:26  swa
929 # compile cgi.c (for andreas' GUI)
930 #
931 # Revision 1.4  2001/05/31 21:18:45  jongfoster
932 # Added files actions.[ch], actionlist.h, list.[ch] to Makefile
933 #
934 # Revision 1.3  2001/05/29 20:02:48  joergs
935 # Changes for AmigaOS added.
936 #
937 # Revision 1.2  2001/05/17 22:23:23  oes
938 #  - Added auto-generation of CRLFs for Win32 config files
939 #  - Added comment-prefix to all Win32-only options in the config file
940 #    and provided auto stripping of this prefix for the Win32 platform by make
941 #
942 # Revision 1.1.1.1  2001/05/15 13:59:00  oes
943 # Initial import of version 2.9.3 source tree
944 #
945 #