1 # Note: GNUmakefile is built automatically from GNUmakefile.in
3 # Written by and Copyright (C) 2001-2018 members of the
4 # Privoxy team. https://www.privoxy.org/
6 # Based on the Internet Junkbuster originally written
7 # by and Copyright (C) 1997 Anonymous Coders and
8 # Junkbusters Corporation. http://www.junkbusters.com
10 # This program is free software; you can redistribute it
11 # and/or modify it under the terms of the GNU General
12 # Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at
14 # your option) any later version.
16 # This program is distributed in the hope that it will
17 # be useful, but WITHOUT ANY WARRANTY; without even the
18 # implied warranty of MERCHANTABILITY or FITNESS FOR A
19 # PARTICULAR PURPOSE. See the GNU General Public
20 # License for more details.
22 # The GNU General Public License should be included with
23 # this file. If not, you can view it at
24 # http://www.gnu.org/copyleft/gpl.html
25 # or write to the Free Software Foundation, Inc., 59
26 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #############################################################################
30 # Set make command correctly
31 #############################################################################
34 #############################################################################
35 # Version number (for RPM)
36 #############################################################################
38 VERSION_MAJOR = @VERSION_MAJOR@
39 VERSION_MINOR = @VERSION_MINOR@
40 VERSION_POINT = @VERSION_POINT@
41 CODE_STATUS = @CODE_STATUS@
42 VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
43 SNAPVERSION = $(VERSION)-$(shell date "+%Y%m%d")
45 SOURCE_DATE_EPOCH ?= @SOURCE_DATE_EPOCH@
46 MTREE_SPEC_FILE = privoxy-$(VERSION)-$(CODE_STATUS).spec
48 #############################################################################
49 # "make install" directories and variables
50 #############################################################################
56 datarootdir = @datarootdir@
58 exec_prefix = @exec_prefix@
59 CONF_BASE = @sysconfdir@
62 MAN_DEST = $(MAN_DIR)/man1
64 SHARE_DEST = @datadir@
65 DOC_DEST = $(SHARE_DEST)/doc/privoxy
66 VAR_DEST = @localstatedir@
67 LOGS_DEST = $(VAR_DEST)/log/privoxy
68 PIDS_DEST = $(VAR_DEST)/run
70 # if $prefix = /usr/local then the default CONFDEST change from
71 # CONF_DEST = $(CONF_BASE) to CONF_DEST = $(CONF_BASE)/privoxy
72 # by the target rule CONF_DEST
74 # also if the $prefix is /usr/local and there is no
75 # $(SHARE_DEST)/doc, it checks for $prefix/doc and installs there
76 # instead in this situation
78 # finally if $prefix=/usr/local and VAR_DEST=$prefix/var it
79 # changes this to /var for storing the logs and pidfile
81 # used in source dir only, the install goes to $share_dest/doc/privoxy
82 DOK_WEB = doc/webserver/
84 # Install usage should be compatible with install-sh.
88 # Support files, docs, etc.
92 # Files daemon writes to.
94 INSTALL_P = -m $(BIN_MODE)
95 INSTALL_T = -m $(RA_MODE)
96 INSTALL_D = -m $(DIR_MODE) -d
97 INSTALL_R = -m $(RWD_MODE)
99 # install options for superuser install
100 #INSTALL_S = -g @GROUP@ -o @USER@
102 #############################################################################
104 #############################################################################
106 PROGRAM = privoxy@EXEEXT@
111 # id -u is not universal. FIXME: need to set from configure. Breaks on
119 MKDIR = ./mkinstalldirs
133 W3M_DUMP = @W3M@ -I ISO-8859 -O ASCII -dump
134 W3M_DUMP_UTF8 = @W3M@ -I ISO-8859 -O UTF-8 -dump
135 # docbook output is ISO-8859 (which is a superset of ascii)
139 DB = $(JADEBIN) $(JADECAT) -ihtml -t sgml -D.. -d ldp.dsl\#html
140 DB_TXT = $(JADEBIN) $(JADECAT) -ihtml -t sgml -D.. -d ldp.dsl\#print
142 # This specifies that dsssl_spec is the system identifier of the DSSSL specification to be used.
143 # ldp.dsl#html : keep '&char;' strings as is
144 # ldp.dsl#print : convert '&char;' strings to ISO-8859 equivalent
145 # NOTE: '-d ldp.dsl\#whatever' _MUST_ be last and _MUST NOT_ have
146 # a trailing space so that '$(DB)-notoc' or '$(DB_TXT)-notoc'
147 # pulls in the correct dsl stylesheet
149 MAN2HTML = @MAN2HTML@
150 G2H_CMD = groff -mandoc -Thtml
154 DOC_TMP = $(DOC_DIR)/tmp
155 DOC_STATUS = @DOC_STATUS@
156 TIDY = tidy -latin1 -q -modify -indent -wrap 120 --tidy-mark no --preserve-entities yes \
157 --mute MISSING_ATTRIBUTE --mute TRIM_EMPTY_ELEMENT
159 # use ISO-8859-1 for both input and output
160 # docbook output is ISO-8859 and tidy assumes UTF-8
162 # suppress nonessential output
164 # modify the original input file
165 # --mute MISSING_ATTRIBUTE
166 # don't show <img> lacks "alt" attribute
167 # or <table> lacks "summary" attribute
168 # --mute TRIM_EMPTY_ELEMENT
169 # don't show trimming empty <p>
171 RSYNC = rsync -av -c --chmod=D755,F644
173 # Program to do LF->CRLF
174 DOSFILTER = $(PERL) -p -e 's/\n/\r\n/'
175 CVSROOT = :pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa
176 #TMPDIR := $(shell mktemp -d /tmp/$(PROGRAM).XXXXXX)
177 # If your SF user name differs from your local one,
178 # change this to "ssh -l sf-username"
180 WWW_ROOT = /home/project-web/ijbswa
181 # SourceForge login name used by the 'sf-shell' target (optional)
182 SOURCE_FORGE_NAME = ''
184 #############################################################################
185 # Setup for make distribution for now.
186 #############################################################################
188 TAR_ARCH = /tmp/privoxy-$(VERSION).tar.gz
189 GEN_DIST_TAR_NAME = privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS).tar
191 #############################################################################
192 # We include these files in our distributions
193 #############################################################################
194 CONFIGS = config trust default.action match-all.action \
195 user.action default.filter user.filter \
196 regression-tests.action
198 # take care that no CVS .cvsignore or other crappy files
200 # and escape every '#' in the find. doh.
201 CONFIG_FILES = $(CONFIGS) \
202 `find templates/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS" | sort`
204 DOC_FILES = AUTHORS LICENSE LICENSE.GPLv3 README ChangeLog INSTALL \
205 `find doc/webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html" | sort` \
206 `find doc/webserver/ -name "*.css" | sort` \
209 #############################################################################
210 # Filenames and libraries
211 #############################################################################
213 C_SRC = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
214 errlog.c filters.c gateway.c jbsockets.c jcc.c \
215 list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
218 C_OBJS = $(C_SRC:.c=.@OBJEXT@)
219 C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
221 CLIENT_TAG_SRC = @FEATURE_CLIENT_TAGS_ONLY@client-tags.c
222 CLIENT_TAG_OBJS = @FEATURE_CLIENT_TAGS_ONLY@client-tags.@OBJEXT@
224 FUZZ_SRC = @FUZZ_ONLY@fuzz.c
225 FUZZ_OBJS = @FUZZ_ONLY@fuzz.@OBJEXT@
227 W32_SRC = @WIN_ONLY@w32log.c w32taskbar.c win32.c w32svrapi.c
228 W32_FILES = @WIN_ONLY@w32.res
229 W32_OBJS = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
230 W32_HDRS = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h w32svrapi.h
231 W32_LIB = @WIN_ONLY@-lwsock32 -lcomctl32
232 W32_INIS = @WIN_ONLY@config.txt trust.txt
234 SSL_SRC = @FEATURE_HTTPS_INSPECTION_ONLY@ssl_common.c
235 SSL_OBJS = @FEATURE_HTTPS_INSPECTION_ONLY@$(SSL_SRC:.c=.o)
236 SSL_HDRS = @FEATURE_HTTPS_INSPECTION_ONLY@$(SSL_SRC:.c=.h) project.h
238 MBEDTLS_SRC = @FEATURE_HTTPS_INSPECTION_ONLY_MBEDTLS@ssl.c
239 MBEDTLS_OBJS = @FEATURE_HTTPS_INSPECTION_ONLY_MBEDTLS@$(MBEDTLS_SRC:.c=.o)
240 MBEDTLS_HDRS = @FEATURE_HTTPS_INSPECTION_ONLY_MBEDTLS@$(MBEDTLS_SRC:.c=.h)
242 OPENSSL_SRC = @FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL@openssl.c
243 OPENSSL_OBJS = @FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL@$(OPENSSL_SRC:.c=.o)
244 OPENSSL_HDRS = @FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL@$(OPENSSL_SRC:.c=.h)
246 PCRS_SRC = @STATIC_PCRS_ONLY@pcrs.c
247 PCRS_OBJS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
248 PCRS_HDRS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
250 PCRE_SRC = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
251 PCRE_OBJS = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
252 PCRE_HDRS = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
254 # No REGEX (maybe because dynamically linked pcreposix):
256 @STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
258 REGEX_OBJS = $(REGEX_SRC:.c=.@OBJEXT@)
259 REGEX_HDRS = $(REGEX_SRC:.c=.h)
261 # Dependencies introduced by #include "project.h".
262 PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
264 # Socket libraries for platforms that need them explicitly defined
265 SOCKET_LIB = @SOCKET_LIB@
267 # PThreads library, if needed.
268 PTHREAD_LIB = @PTHREAD_ONLY@@PTHREAD_LIB@
270 SRCS = $(C_SRC) $(CLIENT_TAG_SRC) $(FUZZ_SRC) $(W32_SRC) $(PCRS_SRC) $(PCRE_SRC) $(REGEX_SRC) $(SSL_SRC) $(MBEDTLS_SRC) $(OPENSSL_SRC)
271 OBJS = $(C_OBJS) $(CLIENT_TAG_OBJS) $(FUZZ_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS) $(SSL_OBJS) $(MBEDTLS_OBJS) $(OPENSSL_OBJS)
272 HDRS = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS) $(SSL_HDRS) $(MBEDTLS_HDRS) $(OPENSSL_HDRS)
273 LIBS = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
276 #############################################################################
278 #############################################################################
280 # The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
281 # The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
283 # The flag "-pthread" is required if using Pthreads under Linux (and
284 # possibly other OSs).
285 SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
287 # Add your flags here
290 CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
291 @STATIC_PCRE_ONLY@ -Ipcre
293 LDFLAGS = @LDFLAGS@ $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
296 #############################################################################
299 # There should NOT be any targets above this line.
300 #############################################################################
301 all: $(PROGRAM) default.action
304 #############################################################################
306 #############################################################################
307 .PHONY: all inifiles \
308 win-dist tarball-dist dok webserver clean clobber tags \
309 install CONF_DEST LOG_DEST \
310 PID_DEST check_doc install-strip uninstall GROUP_T
312 #############################################################################
313 # Define this explicitly because Solaris is broken!
314 #############################################################################
316 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
319 #############################################################################
320 # Strip master copy comments from default.action:
321 #############################################################################
322 default.action: default.action.master
323 $(GREP) -v '^#MASTER#' default.action.master > $@
324 #############################################################################
326 #############################################################################
328 inifiles: $(W32_INIS)
331 $(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
332 -e 's!\logfile logfile!logfile privoxy.log!' \
333 -e 's!#Win32-only: !!' \
336 # LF to CRLF in default.action
337 $(DOSFILTER) <default.action >default.action.txt && mv default.action.txt default.action
338 # LF to CRLF in default.filter
339 $(DOSFILTER) <default.filter >default.filter.txt && mv default.filter.txt default.filter
342 $(DOSFILTER) < $< > $@
344 #############################################################################
346 #############################################################################
348 @if [ -d CVS ]; then \
349 $(ECHO) "***************************************************"; \
351 $(ECHO) "*** WARNING ***"; \
353 $(ECHO) "*** The presence of a CVS subdirectory suggests ***"; \
354 $(ECHO) "*** that you are trying to build a distribution ***"; \
355 $(ECHO) "*** package based on a checked out, not an ***"; \
356 $(ECHO) "*** exported copy of the source tree. Please ***"; \
357 $(ECHO) "*** see \"Releasing a new version\" in the ***"; \
358 $(ECHO) "*** developer manual. ***"; \
360 $(ECHO) "***************************************************"; \
361 $(ECHO) "Type \"yes i am sure\" if you are sure that you"; \
362 $(ECHO) -n "really want to proceed: "; \
364 if [ "$$answer" != "yes i am sure" ]; then exit 1; fi \
368 #############################################################################
369 # create tar.gz from CVS:
370 # This make-target is usually called through 'create-archive'. If you
371 # run 'make create-snapshot' without setting SNAPVERSION, you'll get a
372 # tar.gz with the current date in the name.
373 # The main usage is to run it as follows (Red Hat example):
374 # make SNAPVERSION=1.6x create-snapshot
375 # This creates a tar.gz.
376 #############################################################################
378 @tag=`cvs -d $(CVSROOT) status Makefile | awk ' /Sticky Tag/ { print $$3 } '` 2> /dev/null; \
379 [ x"$$tag" = x"(none)" ] && tag=HEAD; \
380 echo "*** Creating package from $$tag!"; \
381 TMPDIR=$(shell mktemp -d /tmp/$(PROGRAM).XXXXXX); \
382 cd $$TMPDIR ; cvs -Q -d $(CVSROOT) export -r $$tag current || echo "Um... export aborted."; \
383 cd $$TMPDIR/current; \
384 $(TAR) --exclude ".cvsignore" --exclude "CVS" \
385 -czf /tmp/$(PROGRAM)-$(VERSION).tar.gz .; \
387 @echo "Resulting file is /tmp/$(PROGRAM)-$(VERSION).tar.gz"
390 #############################################################################
391 # looks at the version of Makefile and exports a corresponding source-tree
392 # example: if the Makefile has the sticky tag v_2_9_13, you'll get
393 # privoxy-*-2.4.13.tar.gz.
394 #############################################################################
396 make SNAPVERSION=$(SNAPVERSION) create-snapshot
398 #############################################################################
399 # generic distribution
400 #############################################################################
403 @$(ECHO) "You have run autoconf && autoheader && ./configure right?"
406 $(STRIP_PROG) $(PROGRAM)
407 $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
409 (cd .. && $(TAR) --exclude "PACKAGERS" -cvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$(PROGRAM))
411 for foo in $(CONFIG_FILES); do \
412 (cd .. && $(TAR) --exclude "PACKAGERS" -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
415 for foo in $(DOC_FILES); do \
416 (cd .. && $(TAR) --exclude "PACKAGERS" -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
419 (cd .. && $(TAR) -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/tools)
420 # and zip the archive
421 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
422 $(GZIP_PROG) ../$(GEN_DIST_TAR_NAME)
423 @$(ECHO) Distribution with binary created.
425 # anonymously ncftps the package to sourceforge
427 ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../$(GEN_DIST_TAR_NAME).gz
428 @$(ECHO) -------------------------------------------------------
430 @$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
431 @$(ECHO) ... and release the files.
432 @$(ECHO) -------------------------------------------------------
436 $(RM) ../$(GEN_DIST_TAR_NAME)*
438 #############################################################################
439 # Tarball distribution: No CVS dirs, dotfiles, debian build dir,
440 # (FIXME:) only parts of the static / generated docs mix in doc/webserver
441 #############################################################################
443 tarball-dist: dist-check clean clobber
444 $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
446 for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
447 -o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
448 -name "PACKAGERS" -o -path "*.git/*" \) | sort`; do \
449 files="$$files privoxy-$(VERSION)-$(CODE_STATUS)/$$i"; \
451 cd .. && $(TAR) -cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar $$files ; \
453 # and zip the archive
454 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
455 $(GZIP_PROG) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
456 @$(ECHO) Tarball distribution created.
458 # Create a mtree spec file that can be used to get a reproducible tar ball
460 $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
461 $(ECHO) "#mtree 2.0" > $(MTREE_SPEC_FILE)
462 for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
463 -o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
464 -name "PACKAGERS" -o -path "*.git/*" -o -name "*.spec" \) | env -i sort`; do \
465 $(ECHO) "privoxy-$(VERSION)-$(CODE_STATUS)/$$i time=$(SOURCE_DATE_EPOCH) type=file uname=privoxy gname=privoxy mode=0555"; \
466 done >> $(MTREE_SPEC_FILE)
467 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
469 # Create a reproducible tarball.
470 # Requires a tar implementation with mtree support.
471 reproducible-tarball-dist: dist-check clean clobber mtree-spec
472 $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
474 $(TAR) cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar -C .. @privoxy-$(VERSION)-$(CODE_STATUS)/$(MTREE_SPEC_FILE)
475 $(GZIP_PROG) -n privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
476 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS) $(MTREE_SPEC_FILE)
477 @$(ECHO) Reproducible tarball distribution created.
479 # anonymously ncftps the tarball to sourceforge
481 ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
482 @$(ECHO) -------------------------------------------------------
484 @$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
485 @$(ECHO) ... and release the files.
486 @$(ECHO) -------------------------------------------------------
489 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
491 #############################################################################
495 # converts doc/source/*.sgml into html and man pages
497 #############################################################################
501 $(RM) doc/webserver/developer-manual/*.html
502 $(RM) -r doc/source/developer-manual
503 mkdir -p doc/source/developer-manual
504 cd doc/source/developer-manual && $(DB) ../developer-manual.sgml && cd .. && cp developer-manual/*.html ../webserver/developer-manual/
508 $(RM) doc/webserver/user-manual/*.html
509 $(RM) -r doc/source/user-manual/
510 mkdir -p doc/source/user-manual
511 cd doc/source/user-manual && $(DB) -iuser-man ../user-manual.sgml && cd .. && cp user-manual/*.html ../webserver/user-manual/
512 # FIXME: temp fix so same stylesheet gets in more than one place so it works
513 # for all doc set-ups, including the 'user manual' config option in local
514 # system where it MUST be in same directory as html.
515 $(PERL) -pi.bak -e 's/<\/head/\n<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"p_doc.css\">\n<\/head/i' doc/webserver/user-manual/*html && \
516 rm doc/webserver/user-manual/*html.bak
520 $(RM) doc/webserver/faq/*.html
521 $(RM) -r doc/source/faq
522 mkdir -p doc/source/faq
523 cd doc/source/faq && $(DB) ../faq.sgml && cd .. && cp faq/*.html ../webserver/faq/
525 # man page, one variation. Try to use the next target, just 'make man'.
527 $(RM) doc/man/* doc/webserver/man-page/*.html
528 echo MAN2HTML is $(MAN2HTML)
529 @if [ $(MAN2HTML) != "false" ]; then \
530 $(ECHO) "<html><head><title>Privoxy 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; \
531 man ./$(MAN_PAGE) | $(MAN2HTML) -bare >> doc/webserver/man-page/privoxy-man-page.html; \
532 $(ECHO) "</body></html>" >> doc/webserver/man-page/privoxy-man-page.html; \
534 $(MAKE) groff2html; \
537 # Build man page from sgml. This requires the SGMLSpm perl module.
538 # See CPAN, or your favorite perl repository. This is the preferred
539 # target for man page generation!
541 mkdir -p doc/source/temp && cd doc/source/temp && $(RM) * ;\
542 $(NSGMLS) ../privoxy-man-page.sgml | sgmlspl ../../../utils/docbook2man/docbook2man-spec.pl &&\
543 perl -pi.bak -e 's/ <URL:.*>//; s/\[ /\[/g' $(MAN_PAGE) ;\
544 perl -pi.bak -e "s/\[ /\[/g;s/á/\\\\['a]/g;s/é/\\\\['e]/g" $(MAN_PAGE); \
545 perl -pi.bak -e "s/ö/\\\\[:o]/g" $(MAN_PAGE); \
546 perl -pi.bak -e 's/([ {])-([a-z])/$$1\\-$$2/g' $(MAN_PAGE); \
547 perl -pi.bak -e 's/ --([a-z])/ \\-\\-$$1/g' $(MAN_PAGE); \
548 perl -pi.bak -e 's/\\fB--/\\fB\\-\\-/g' $(MAN_PAGE); \
549 $(DB) ../privoxy-man-page.sgml && $(MV) -f $(MAN_PAGE) ../../../$(MAN_PAGE)
551 # For those with man2html ala RH7s.
553 mkdir -p doc/webserver/man-page
554 @if [ $(MAN2HTML) != "false" ]; then \
555 $(MAN2HTML) $(MAN_PAGE) |grep -v "^Content-type" > tmp.html; \
556 $(PERL) -pi.bak -e 's/<A .*Contents<\/A>//; s/<A .*man2html<\/A>/man2html/' tmp.html; \
557 $(PERL) -pi.bak -e 's/(<\/HEAD>)/<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"..\/p_doc.css\"><\/HEAD>/' tmp.html; \
558 $(PERL) -pi.bak -e 's/(<A.*),(">)/$$1$$2/g' tmp.html; \
559 $(PERL) -pi.bak -e 's,\.">,">,g' tmp.html; \
560 $(PERL) -pi.bak -e "s/\['a\]/\á/g;s/\['e\]/\é/g" tmp.html; \
561 $(SED) -e 's/
\a//g' tmp.html > doc/webserver/man-page/privoxy-man-page.html && $(RM) tmp.*; \
563 $(MAKE) groff2html; \
566 # Otherwise we get plain groff conversion.
568 $(G2H_CMD) ./$(MAN_PAGE) | $(SED) -e 's@</head>@<link REL="STYLESHEET" TYPE="text/css" HREF="../p_doc.css"></head>@' > doc/webserver/man-page/privoxy-man-page.html
571 # readme page and INSTALL file
572 dok-readme: dok-release
573 cd doc/source && $(DB_TXT)-notoc -V nochunks readme.sgml > tmp.html &&\
574 $(W3M_DUMP) tmp.html > ../../README ;\
575 $(DB_TXT)-notoc -V nochunks install.sgml > tmp.html &&\
576 $(W3M_DUMP) tmp.html > ../../INSTALL ;\
579 # index.sgml is used to create both the Home Page, and a local index
580 # for documentation, etc.
582 # index.html for webserver:
584 cd doc/source/webserver && $(DB)-notoc -ip-homepage -V nochunks index.sgml > ../../webserver/index.html
585 $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
586 s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps users to protect their privacy.\"><\/HEAD/;\
589 s@(<SUB)@<p style="text-align: center">\1@; s@(</SUB)@\1></p@;\
590 s@(Privoxy is a non-caching)@<img src="images/privoxy.png" align="right">\n\1@;' \
591 doc/webserver/index.html && $(RM) doc/webserver/*.bak
593 # privoxy-index.html for local documentation:
595 cd doc/source/webserver && $(DB)-notoc -ip-index -V nochunks index.sgml > ../../webserver/privoxy-index.html
596 $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
597 s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps users to protect their privacy.\"><\/HEAD/;\
600 doc/webserver/privoxy-index.html && $(RM) doc/webserver/*.bak
602 # Main documentation target.
603 dok: dok-release dok-devel dok-user dok-faq dok-readme dok-webserver dok-authors dok-index
604 @$(ECHO) Documentation created.
608 cd doc/source && $(DB_TXT) -V nochunks authors.sgml > tmp.html && \
609 $(W3M_DUMP_UTF8) tmp.html > ../../AUTHORS && $(RM) tmp.html
611 # Set doc entities for VERSION and CODE_STATUS in sgml docs. Toggle content
612 # exceptions accordingly. This needs to go before any doc building (doh).
614 @$(ECHO) Setting doc version and status to $(VERSION), $(CODE_STATUS)
615 @$(PERL) -pi.bak -e 's/<!entity +p-version.*>/<!entity p-version "$(VERSION)">/;\
616 s/<!entity +p-status.*>/<!entity p-status "$(CODE_STATUS)">/' \
617 doc/source/*sgml doc/source/*/*sgml
618 $(RM) -r doc/source/*bak doc/source/*/*bak
619 @if [ $(CODE_STATUS) = "stable" ]; then \
620 $(ECHO) Setting docs to stable $(VERSION); \
621 $(PERL) -pi.bak -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "INCLUDE">/;\
622 s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "IGNORE">/' \
623 doc/source/*sgml doc/source/*/*sgml; \
625 $(ECHO) Setting docs to not stable $(VERSION); \
626 $(PERL) -pi.bak -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "IGNORE">/; \
627 s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "INCLUDE">/' \
628 doc/source/*sgml doc/source/*/*sgml; \
630 $(RM) -r doc/source/*bak doc/source/*/*bak;
632 # The main Privoxy config file, generated from sgml sources.
633 # NOTE: This will require some hand editing.
634 config-file: dok-release generate-config-file
636 $(RM) config.bak config.html
637 @$(ECHO) "****************************************************"
638 @$(ECHO) "The config file has been optimistically updated"
639 @$(ECHO) "Now -- you may need to hand edit the results!"
640 @$(ECHO) "In particular, check the Debug levels, the"
641 @$(ECHO) "permit-access, forward & socks examples and the"
642 @$(ECHO) "various user-manual examples, which all"
643 @$(ECHO) "might have gotten hammered."
644 @$(ECHO) "****************************************************"
646 generate-config-file:
647 cd doc/source && $(DB_TXT)-notoc -iconfig-file -V nochunks config.sgml > ../../config.html
648 $(W3M_DUMP) -cols 67 config.html > config
649 $(PERL) -i.bak utils/prepare-configfile.pl config
651 #############################################################################
655 # moves documentation to webserver
657 #############################################################################
659 @sf_name=$(SOURCE_FORGE_NAME); \
660 [ -n "$${sf_name}" ] || read -p "Enter SourceForge username: " sf_name || exit 1; \
661 echo "Opening shell for $${sf_name} ..."; \
662 ssh -t $${sf_name},ijbswa@shell.sourceforge.net create
664 webserver: clean-editor-files
665 @$(ECHO) -------------------------------------------------------
666 @$(ECHO) You will need to "create" a SF shell first:
667 @$(ECHO) ssh -t SF-USER-ID,ijbswa@shell.sourceforge.net create
668 @$(ECHO) Please make sure your documentation files are up to date.
669 @$(ECHO) Note that this command updates the home page and copys
670 @$(ECHO) all stuff to the webserver, it will not remove obsolete documents.
671 @$(ECHO) Note that a botched upload can result in the documentation
672 @$(ECHO) on the website becoming unreachable! Also the CSS files
673 @$(ECHO) currently seem to end up at the wrong place.
674 @$(ECHO) -------------------------------------------------------
676 @$(ECHO) Replacing the user-manual symlink
677 @$(SSH) shell.sourceforge.net "cd $(WWW_ROOT)/htdocs && rm user-manual \
678 && mkdir -p $(VERSION)/user-manual && ln -s $(VERSION)/user-manual user-manual"
680 @$(ECHO) Uploading html
682 upload=`find . -type f -a -not \( -path "*/CVS*" -o -path "*/results*" \)`; \
683 $(TAR) cf - $$upload | $(SSH) shell.sourceforge.net 'cd $(WWW_ROOT)/htdocs/; tar xvm 2>&1 | grep -v timestamp'
686 @$(ECHO) Updating the actions on the webserver ...
687 @$(RSYNC) doc/webserver/actions/*.php shell.sourceforge.net:$(WWW_ROOT)/htdocs/actions
690 @$(ECHO) "Updating the home page (index.html) only (be careful in case of version changes) ..."
691 @$(RSYNC) doc/webserver/index.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/
694 @$(ECHO) Updating the FAQ on the webserver ...
695 @$(RSYNC) doc/webserver/faq/*.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/faq
698 @$(ECHO) "Updating the sponsor page (index.html) only ..."
699 @$(RSYNC) doc/webserver/sponsors/index.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/sponsors/
702 @$(ECHO) Updating the user manual on the webserver (do not use in case of version changes) ...
703 @$(RSYNC) doc/webserver/user-manual/*.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/user-manual/
705 #############################################################################
707 # Try to clean up the generated HTML files.
709 # The files are such a mess that some of them require two tidy runs in a
710 # row as the first one aborts prematurely. The vanilla tidy output renders
711 # poorly because it contains a bit too much whitespace, so we additionally
712 # run the files through perl to fix this again.
714 #############################################################################
716 for html_file in `find doc/webserver -name "*.html"`; do \
717 $(ECHO) "------ begin processing $$html_file" >&2 ; \
718 $(TIDY) $$html_file || $(TIDY) $$html_file; \
719 $(PERL) -i'' -e 's@^\s*<br>\s*$$@@; s@ +$$@@;' -n -p $$html_file; \
723 #############################################################################
724 # Source file dependencies
725 #############################################################################
727 actions.@OBJEXT@: actions.c actions.h config.h $(PROJECT_H_DEPS) errlog.h filters.h jcc.h list.h loaders.h miscutil.h actionlist.h ssplit.h
728 cgi.@OBJEXT@: cgi.c cgi.h config.h $(PROJECT_H_DEPS) cgiedit.h cgisimple.h jbsockets.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
729 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 actionlist.h actions.h errlog.h miscutil.h
730 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 urlmatch.h
731 deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
732 encode.@OBJEXT@: encode.c encode.h config.h
733 errlog.@OBJEXT@: errlog.c errlog.h config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
734 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 urlmatch.h @WIN_ONLY@win32.h
735 gateway.@OBJEXT@: gateway.c gateway.h config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
736 jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
737 jcc.@OBJEXT@: jcc.c jcc.h config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h loadcfg.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h w32svrapi.h cgi.h
738 list.@OBJEXT@: list.c list.h config.h $(PROJECT_H_DEPS) list.h miscutil.h
739 loadcfg.@OBJEXT@: loadcfg.c loadcfg.h config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h jcc.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h
740 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
741 miscutil.@OBJEXT@: miscutil.c miscutil.h config.h
742 parsers.@OBJEXT@: parsers.c parsers.h config.h $(PROJECT_H_DEPS) errlog.h filters.h jbsockets.h jcc.h loadcfg.h loaders.h miscutil.h ssplit.h
743 ssplit.@OBJEXT@: ssplit.c ssplit.h config.h miscutil.h
744 urlmatch.@OBJEXT@: urlmatch.c urlmatch.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
745 client-tags.@OBJEXT@: client-tags.c client-tags.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
746 fuzz.@OBJEXT@: fuzz.c config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
747 ssl.@OBJEXT@: ssl.c ssl.h ssl_common.h config.h $(PROJECT_H_DEPS) encode.h errlog.h jcc.h miscutil.h
748 openssl.@OBJEXT@: openssl.c ssl.h ssl_common.h config.h $(PROJECT_H_DEPS) encode.h errlog.h jcc.h miscutil.h
749 ssl_common.@OBJEXT@: ssl_common.c ssl.h ssl_common.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h
752 pcrs.@OBJEXT@: pcrs.c pcrs.h config.h @STATIC_PCRE_ONLY@pcre/pcre.h
755 pcre/get.@OBJEXT@: pcre/get.c pcre/config.h pcre/internal.h pcre/pcre.h
756 pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
757 pcre/pcre.@OBJEXT@: pcre/pcre.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c
758 pcre/pcreposix.@OBJEXT@: pcre/pcreposix.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
759 pcre/study.@OBJEXT@: pcre/study.c pcre/config.h pcre/internal.h pcre/pcre.h
761 # An auxiliary program makes the PCRE default character table source
763 pcre/chartables.c: pcre/dftables@EXEEXT@
764 pcre/dftables@EXEEXT@ >pcre/chartables.c
766 pcre/dftables@EXEEXT@: pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
767 $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
770 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
771 w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
772 win32.@OBJEXT@: win32.c config.h jcc.h loadcfg.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h win32.h w32svrapi.h
774 w32.res: w32.rc w32res.h icons/radar-01.ico icons/radar-02.ico icons/radar-03.ico icons/radar-04.ico icons/radar-05.ico icons/radar-06.ico icons/radar-07.ico icons/radar-08.ico icons/idle.ico icons/privoxy.ico config.h
775 windres -F pe-i386 -D__MINGW32__=0.2 -O coff -i $< -o $@
777 $(PROGRAM): $(OBJS) $(W32_FILES)
778 $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
781 $(RM) a.out $(OBJS) $(W32_FILES) $(W32_INIS) $(PROGRAM) default.action \
782 config.base config.tmp \
783 `find . \( -name TAGS -o -name tags \) -a -not -path "./.git/*"` \
784 `find . -name "*.orig" -a -not -name rc.privoxy.orig -a -not -path "./.git/*"`
787 $(RM) `find . -name "*~"`
788 $(RM) `find . -name "#*#"` # Emacs backup files
789 $(RM) `find . -name ".\#*"`
791 clobber: clean-editor-files
792 $(RM) GNUmakefile configure config.h.in config.h config.cache config.status config.log logfile \
793 privoxy.log core *.tar.gz *.tar privoxy-cl.spec doc/source/ldp.dsl
794 $(RM) -r autom4te.cache
797 # FIXME: What is all this?
799 $(RM) cscope.* *.pdb *.lib *.exp
803 tags: $(SRCS) $(HDRS)
804 etags $(SRCS) $(HDRS)
806 CONF_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(CONF_BASE)" = "$(prefix)/etc" ];then \
807 $(ECHO) "$(CONF_BASE)/privoxy";\
809 $(ECHO) "$(CONF_BASE)";\
812 LOG_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(LOGS_DEST)" = "$(prefix)/var/log/privoxy" ];then \
813 $(ECHO) "/var/log/privoxy" ;\
815 $(ECHO) "$(LOGS_DEST)";\
818 PID_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(PIDS_DEST)" = "$(prefix)/var/run" ];then \
819 $(ECHO) "/var/run" ;\
821 $(ECHO) "$(PIDS_DEST)";\
824 check_doc:=$(shell if [ ! -d "$(SHARE_DEST)/doc" ] && [ "$(prefix)" = "/usr/local" ] && [ -d "$(prefix)/doc" ];then \
830 # If USER is specified but no GROUP, assume there is a GROUP of same name.
831 GROUP_T:=$(shell if [ x$(GROUP) = x ] && [ x$(USER) != x ];then \
838 $(MAKE) install STRIP=-s
840 # FIXME: Test USER and GROUP on Slack to make sure this works as
843 # FIXME: id handling needs help, probably via configure, since 'id -u' is not
844 # universally reliable (eg Solaris). Group handling could be better.
845 # Perhaps the whole user/group validation should be done here, and simplified.
846 PROGRAM_V = Privoxy $(VERSION) $(CODE_STATUS)
847 install: CONF_DEST LOG_DEST PID_DEST check_doc GROUP_T
848 @# Quick test for valid USER.
849 @if [ -n "$(USER)" ]; then \
850 $(ID) $(USER) >/dev/null || exit 1;\
852 @# Test for valid group. FIXME. USER does not have to belong to GROUP
853 @# for file ownership purposes.
854 # if [ -n "$(GROUP_T)" ] && [ -n "$(USER)" ] && ! $(GROUPS) $(USER) | $(GREP) "\<$(GROUP_T)\>" >/dev/null; then \
855 # $(ECHO) Group $(GROUP_T) for User $(USER) is invalid && exit 1 ;\
858 @$(ECHO) "Creating directories, and preparing $(PROGRAM_V) installation"
859 $(CHMOD) $(DIR_MODE) $(MKDIR)
860 @$(MKDIR) $(DESTDIR)$(SBIN_DEST) $(DESTDIR)$(prefix) $(DESTDIR)$(CONF_DEST) \
861 $(DESTDIR)$(CONF_DEST)/templates $(DESTDIR)$(SHARE_DEST) \
862 $(DESTDIR)$(LOG_DEST) $(DESTDIR)$(PID_DEST)
863 @# Install the executable binary, strip if invoked as install-strip
864 @test -n "$(STRIP)" &&\
865 $(ECHO) Installing $(PROGRAM) stripped executable to $(SBIN_DEST) ||\
866 $(ECHO) Installing $(PROGRAM) executable to $(DESTDIR)$(SBIN_DEST)
867 $(INSTALL) $(INSTALL_P) $(STRIP) $(PROGRAM) $(DESTDIR)$(SBIN_DEST)
869 @# Install the DOCS and man page. install-sh only does one file at a time.
870 @# FIXME: only handles jpegs.
871 -@if [ $(check_doc) = 0 ]; then \
874 DOC=$(prefix)/doc/privoxy ;\
876 $(MKDIR) $(DESTDIR)$$DOC $(DESTDIR)$$DOC/user-manual $(DESTDIR)$$DOC/faq $(DESTDIR)$$DOC/developer-manual \
877 $(DESTDIR)$$DOC/man-page $(DESTDIR)$(MAN_DEST) ;\
878 if [ -d "$(DOK_WEB)" ]; then \
879 $(ECHO) Installing FAQ, Manual, and other docs to $(DESTDIR)$$DOC;\
880 for i in user-manual developer-manual faq; do \
881 for ii in $(DOK_WEB)/$$i/*html; do \
882 $(INSTALL) $(INSTALL_T) $$ii $(DESTDIR)$$DOC/$$i;\
885 for i in $(DOK_WEB)/user-manual/*jpg; do \
886 $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$$DOC/user-manual;\
888 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/man-page/*html $(DESTDIR)$$DOC/man-page;\
889 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/privoxy-index.html $(DESTDIR)$$DOC/index.html;\
890 $(INSTALL) $(INSTALL_T) AUTHORS $(DESTDIR)$$DOC;\
891 $(INSTALL) $(INSTALL_T) LICENSE $(DESTDIR)$$DOC;\
892 $(INSTALL) $(INSTALL_T) LICENSE.GPLv3 $(DESTDIR)$$DOC;\
893 $(INSTALL) $(INSTALL_T) README $(DESTDIR)$$DOC;\
894 $(INSTALL) $(INSTALL_T) ChangeLog $(DESTDIR)$$DOC;\
895 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $(DESTDIR)$$DOC;\
896 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $(DESTDIR)$$DOC/user-manual;\
898 @# Not all platforms support gzipped man pages.
899 @$(ECHO) Installing man page to $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)
900 -$(INSTALL) $(INSTALL_T) $(MAN_PAGE) $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)
902 @# Change the config file default directories according to the configured ones
903 @$(ECHO) Rewriting config for this installation
904 @if [ -f config.base ] ; then \
905 $(CAT) config >config~ ;\
906 $(MV) config.base config ;\
908 $(SED) 's+^confdir \.+confdir $(CONF_DEST)+' config | \
909 $(SED) 's+^logdir \.+logdir $(LOG_DEST)+' >config.tmp
910 -@if [ $(check_doc) = 0 ]; then \
911 $(SED) 's+^#\?user-manual .*+user-manual $(DOC_DEST)/user-manual/+' config.tmp >config.updated ;\
913 $(SED) 's+^#\?user-manual .*+user-manual $(prefix)/doc/privoxy/user-manual/+' config.tmp >config.updated ;\
915 $(MV) config config.base
916 $(MV) config.updated config
918 @# Install the config support files. Test for root install, and abort
919 @# if there is no privoxy user, and no other user was enabled during
920 @# configure. Later, install init script if appropriate.
921 @$(ECHO) Installing templates to $(DESTDIR)$(CONF_DEST)/templates
922 @for i in `find templates -type f`; do \
923 $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$(CONF_DEST)/templates ;\
926 @# FIXME: group/user validation is overly convoluted.
927 @# If superuser install ... we require a minimum of group ownership
928 @# of those files the daemon writes to, to be non-root owned.
929 @if [ "`$(ID) |sed 's/(.*//' |sed 's/.*=//'`" = "0" ] ;then\
930 if [ x$(USER) = x ] || [ $(USER) = root ]; then \
931 if [ x$(GROUP) = x ] || [ $(GROUP) = root ]; then \
932 if [ "`$(ID) privoxy`" ] && \
933 $(GROUPS) privoxy | $(SED) 's/^.*://' |$(GREP) "\<privoxy\>" >/dev/null; then \
934 $(ECHO) "Warning: Setting group owner to privoxy";\
937 $(ECHO) "******************************************************************" ;\
938 $(ECHO) " WARNING! WARNING! installing config files as root!" ;\
939 $(ECHO) " It is strongly recommended to run $(PROGRAM) as a non-root user," ;\
940 $(ECHO) " and to install the config files as that user and/or group!" ;\
941 $(ECHO) " Please read INSTALL, and create a privoxy user and group!" ;\
942 $(ECHO) "*******************************************************************" ;\
948 INSTALL_CONF="$(INSTALL_R) -g $$GROUP_T " ;\
950 $(ECHO) "Superuser install, installing config files as $(USER):$(GROUP_T)" ;\
951 INSTALL_CONF="$(INSTALL_R) -o $(USER) -g $(GROUP_T)" ;\
952 GROUP_T=$(GROUP_T) ;\
955 if [ ! "`id $(USER)`" = "`id`" ] ;then \
956 $(ECHO) "** WARNING ** current install user different from configured user!!" ;\
957 $(ECHO) "Edit may fail." ;\
959 INSTALL_CONF="$(INSTALL_R)" ;\
961 $(ECHO) Installing configuration files to $(DESTDIR)$(CONF_DEST);\
962 for i in $(CONFIGS); do \
963 if [ "$$i" = "default.action" ] || [ "$$i" = "default.filter" ] ; then \
964 $(RM) $(DESTDIR)$(CONF_DEST)/$$i ;\
965 $(ECHO) Installing fresh $$i;\
966 $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST) || exit 1;\
967 elif [ -s "$(CONF_DEST)/$$i" ]; then \
968 $(ECHO) Installing $$i as $$i.new ;\
969 $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST)/$$i.new || exit 1;\
972 $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST) || exit 1;\
975 if [ -n "$$NEW" ]; then \
976 $(CHMOD) $(RWD_MODE) $(DESTDIR)$(CONF_DEST)/*.new || exit 1 ;\
977 $(ECHO) "Warning: Older config files are preserved. Check new versions for changes!" ;\
979 [ ! -f $(DESTDIR)$(LOG_DEST)/logfile ] && $(ECHO) Creating logfiles in $(DESTDIR)$(LOG_DEST) || \
980 $(ECHO) Checking logfiles in $(DESTDIR)$(LOG_DEST) ;\
981 $(TOUCH) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\
982 if [ x$$USER != x ]; then \
983 $(CHOWN) $$USER $(DESTDIR)$(LOG_DEST)/logfile || \
984 $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\
986 if [ x$$GROUP_T != x ]; then \
987 $(CHGRP) $$GROUP_T $(DESTDIR)$(LOG_DEST)/logfile || \
988 $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\
990 $(CHMOD) $(RWD_MODE) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\
991 if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \
992 if [ -f /etc/slackware-version ] && [ -d /etc/rc.d/ ] && [ -w /etc/rc.d/ ] ; then \
993 $(SED) 's+%PROGRAM%+$(PROGRAM)+' slackware/rc.privoxy.orig | \
994 $(SED) 's+%SBIN_DEST%+$(SBIN_DEST)+' | \
995 $(SED) 's+%CONF_DEST%+$(CONF_DEST)+' | \
996 $(SED) 's+%USER%+$(USER)+' | \
997 $(SED) 's+%GROUP%+$(GROUP_T)+' >slackware/rc.privoxy ;\
998 $(INSTALL) $(INSTALL_P) slackware/rc.privoxy $(DESTDIR)/etc/rc.d/ ;\
999 $(ECHO) "Installing for Slackware." ;\
1000 $(ECHO) "Dont forget to add the rc.privoxy to rc.local if you want it started at every boot" ;\
1001 elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \
1002 $(ECHO) "Installing generic init script to $(DESTDIR)/etc/init.d/privoxy" ;\
1003 $(ECHO) "Please check that the PATHs are correct, and edit if needed." ;\
1004 $(INSTALL) $(INSTALL_P) privoxy-generic.init $(DESTDIR)/etc/init.d/privoxy ;\
1007 $(ECHO) "No init script installed, install it manually if needed" ;\
1009 $(RM) config.base config.tmp
1011 @$(ECHO) "$(PROGRAM_V) installation succeeded!"
1012 @$(ECHO) "The Privoxy configuration files have been installed in $(DESTDIR)$(CONF_DEST)"
1014 # rmdir is used as a precaution since it will not remove non-empty
1015 # directories. RH init script creates lock file and pid file.
1016 uninstall: CONF_DEST LOG_DEST PID_DEST check_doc
1017 @$(ECHO) Starting Privoxy uninstallation
1018 @# KILL privoxy if running
1019 @# XXX: the chkconfig line may need a DESTDIR prefix.
1020 -@test -f $(DESTDIR)$(PID_DEST)/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\
1021 $(KILL) `$(CAT) $(DESTDIR)$(PID_DEST)/privoxy.pid` || :
1022 -@test -f $(DESTDIR)/var/run/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\
1023 $(KILL) `$(CAT) $(DESTDIR)/var/run/privoxy.pid ` || :
1026 @$(ECHO) Removing $(PROGRAM) binary
1027 $(RM) $(DESTDIR)$(SBIN_DEST)/$(PROGRAM) $(SBIN_DEST)/$(PROGRAM)~
1029 @# config files and dir, and maybe old install backups
1030 -@if [ -d $(DESTDIR)$(CONF_DEST) ]; then \
1031 $(ECHO) Saving $(PROGRAM) config files to $(DESTDIR)/tmp/$(PROGRAM)-save ;\
1032 $(MKDIR) $(DESTDIR)/tmp/$(PROGRAM)-save ;\
1033 cd $(DESTDIR)$(CONF_DEST) ;\
1034 for i in $(DESTDIR)$(CONFIGS); do \
1035 [ -f $$i ] && $(CP) $$i $(DESTDIR)/tmp/$(PROGRAM)-save ;\
1038 @$(ECHO) Removing $(PROGRAM) config files
1039 -@for i in $(DESTDIR)$(CONFIGS); do \
1040 test -f $(CONF_DEST)/$$i && $(ECHO) Removing $$i ;\
1041 $(RM) $(DESTDIR)$(CONF_DEST)/$$i $(DESTDIR)$(CONF_DEST)/$$i~ $(DESTDIR)$(CONF_DEST)/$$i.new ;\
1043 -@test -d $(DESTDIR)$(CONF_DEST)/templates && $(RM) -r $(DESTDIR)$(CONF_DEST)/templates &&\
1044 $(ECHO) "Removing $(DESTDIR)$(CONF_DEST)/templates/*"
1046 @# man page and docs
1047 @$(ECHO) Removing $(PROGRAM) docs
1048 -$(RM) $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)*
1049 -$(RM) -r $(DESTDIR)$(DOC_DEST) || $(RM) -r $(DESTDIR)$(prefix)/doc/privoxy
1052 @$(ECHO) Removing $(PROGRAM) logs
1053 -$(RM) $(DESTDIR)$(LOG_DEST)/logfile $(DESTDIR)$(PID_DEST)/privoxy.pid
1055 @# Final clean up of unused directories. Special handling of CONF and LOG
1057 @$(ECHO) Removing $(PROGRAM) directories
1058 @for i in $(DESTDIR)$(LOG_DEST) $(DESTDIR)$(CONF_DEST); do \
1059 if test -d $$i; then \
1060 $(ECHO) Removing $$i ;\
1061 $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\
1064 @if [ ! "$(prefix)" = "/usr/local" ] ;then \
1065 for i in $(DESTDIR)$(MAN_DEST) $(DESTDIR)$(MAN_DIR) $(DESTDIR)$(SHARE_DEST)/doc \
1066 $(DESTDIR)$(SHARE_DEST) $(DESTDIR)$(SBIN_DEST); do \
1067 if test -d $$i; then \
1068 $(ECHO) Removing $$i ;\
1069 $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\
1072 if test $(LOG_DEST) != /var/log/privoxy && test -d $(DESTDIR)$(prefix)/var/log; then \
1073 $(ECHO) Removing $(DESTDIR)$(prefix)/var/log ;\
1074 $(RMDIR) $(DESTDIR)$(prefix)/var/log || $(ECHO) "$(DESTDIR)$(prefix)/var/log is not empty, not removed";\
1076 if test $(PID_DEST) != /var/run && test -d $(DESTDIR)$(prefix)/var/run; then \
1077 $(ECHO) Removing $(DESTDIR)$(prefix)/var/run ;\
1078 $(RMDIR) $(DESTDIR)$(prefix)/var/run || $(ECHO) "$(DESTDIR)$(prefix)/var/run is not empty, not removed";\
1080 if test $(prefix)/var != /var && test -d $(DESTDIR)$(prefix)/var; then \
1081 $(ECHO) Removing $(DESTDIR)$(prefix)/var ;\
1082 $(RMDIR) $(DESTDIR)$(prefix)/var || $(ECHO) "$(DESTDIR)$(prefix)/var is not empty, not removed" ;\
1084 if test $(prefix) != / && test $(prefix) != /usr && test -d $(DESTDIR)$(prefix); then \
1085 $(ECHO) Removing $(DESTDIR)$(prefix) ;\
1086 $(ECHO) Removing installation directory $(DESTDIR)$(prefix) ;\
1087 $(RMDIR) $(DESTDIR)$(prefix) || $(ECHO) "$(DESTDIR)$(prefix) is not empty, not removed" ;\
1092 @if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \
1093 $(ECHO) Removing $(PROGRAM) init script ;\
1094 if [ -f $(DESTDIR)/etc/slackware-version ] && \
1095 [ -d $(DESTDIR)/etc/rc.d/ ] && [ -w $(DESTDIR)/etc/rc.d/ ] ; then \
1096 $(RM) $(DESTDIR)/etc/rc.d/rc.privoxy ;\
1097 elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \
1098 $(RM) $(DESTDIR)/etc/init.d/privoxy ;\
1100 $(ECHO) "Unable to remove privoxy init script, not installed or permission denied" ;\
1103 @$(ECHO) Privoxy uninstalled, bye
1106 @perl -e 'print pack "C*", (31,139,8,8,153,63,226,60,2,3,99,111,102,102,101,' \
1107 -e '101,0,109,143,205,13,192,32,8,133,239,78,241,110,234,1,28,160,171,' \
1108 -e '152,208,53,26,117,247,22,165,73,137,125,9,1,62,126,2,128,169,5,243,' \
1109 -e '143,13,139,49,164,65,100,149,152,102,73,141,88,73,178,116,205,100,' \
1110 -e '69,253,36,102,81,49,83,236,19,225,171,131,214,172,163,73,4,168,123,' \
1111 -e '115,71,126,247,122,94,128,178,227,95,154,12,86,215,122,197,249,146,' \
1112 -e '187,54,220,125,193,51,228,11,1,0,0);' | zcat