1 # Note: Makefile is built automatically from Makefile.in
3 # $Id: GNUmakefile.in,v 1.222 2013/12/24 13:35:07 fabiankeil Exp $
5 # Written by and Copyright (C) 2001-2013 members of the
6 # Privoxy team. http://www.privoxy.org/
8 # Based on the Internet Junkbuster originally written
9 # by and Copyright (C) 1997 Anonymous Coders and
10 # Junkbusters Corporation. http://www.junkbusters.com
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.
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.
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.
31 #############################################################################
32 # Set make command correctly
33 #############################################################################
36 #############################################################################
37 # Version number (for RPM)
38 #############################################################################
40 VERSION_MAJOR = @VERSION_MAJOR@
41 VERSION_MINOR = @VERSION_MINOR@
42 VERSION_POINT = @VERSION_POINT@
43 CODE_STATUS = @CODE_STATUS@
44 VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
45 SNAPVERSION = $(VERSION)-$(shell date "+%Y%m%d")
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 = env -u LANG LC_ALL=C @W3M@ -dump
134 W3M_DUMP_UTF8 = @W3M@ -dump
137 DB = $(JADEBIN) $(JADECAT) -ihtml -t sgml -D.. -d ldp.dsl\#html
139 MAN2HTML = @MAN2HTML@
140 G2H_CMD = groff -mandoc -Thtml
144 DOC_TMP = $(DOC_DIR)/tmp
145 DOC_STATUS = @DOC_STATUS@
146 TIDY = tidy -modify -indent -wrap 78 --tidy-mark no
148 # Program to do LF->CRLF
150 # The sed version should be the most portable, but it doesn't for for me,
151 # the other two do. FIXME.
153 #DOSFILTER = $(SED) -e $$'s,$$,\r,'
154 #DOSFILTER = gawk -v ORS='\r\n' '{print $0;}'
155 DOSFILTER = $(PERL) -p -e 's/\n/\r\n/'
156 CVSROOT = :pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa
157 #TMPDIR := $(shell mktemp -d /tmp/$(PROGRAM).XXXXXX)
158 # If your SF user name differs from your local one,
159 # change this to "ssh -l sf-username"
161 WWW_ROOT = /home/project-web/ijbswa
162 # SourceForge login name used by the 'sf-shell' target (optional)
163 SOURCE_FORGE_NAME = ''
165 #############################################################################
166 # Setup for make distribution for now.
167 #############################################################################
169 TAR_ARCH = /tmp/privoxy-$(VERSION).tar.gz
171 #############################################################################
172 # We include these files in our distributions
173 #############################################################################
174 CONFIGS = config trust default.action match-all.action user.action default.filter user.filter
175 # take care that no CVS .cvsignore or other crappy files
177 # and escape every '#' in the find. doh.
178 CONFIG_FILES = $(CONFIGS) \
179 `find templates/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS"`
181 DOC_FILES = AUTHORS LICENSE README ChangeLog INSTALL \
182 `find doc/webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html"` \
183 `find doc/webserver/ -name "*.css"` \
186 #############################################################################
187 # Filenames and libraries
188 #############################################################################
190 C_SRC = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
191 errlog.c filters.c gateway.c jbsockets.c jcc.c \
192 list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
195 C_OBJS = $(C_SRC:.c=.@OBJEXT@)
196 C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
198 W32_SRC = @WIN_ONLY@w32log.c w32taskbar.c win32.c w32svrapi.c
199 W32_FILES = @WIN_ONLY@w32.res
200 W32_OBJS = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
201 W32_HDRS = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h w32svrapi.h
202 W32_LIB = @WIN_ONLY@-lwsock32 -lcomctl32
203 W32_INIS = @WIN_ONLY@config.txt trust.txt
205 PCRS_SRC = @STATIC_PCRS_ONLY@pcrs.c
206 PCRS_OBJS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
207 PCRS_HDRS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
209 PCRE_SRC = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
210 PCRE_OBJS = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
211 PCRE_HDRS = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
213 # No REGEX (maybe because dynamically linked pcreposix):
215 @STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
217 REGEX_OBJS = $(REGEX_SRC:.c=.@OBJEXT@)
218 REGEX_HDRS = $(REGEX_SRC:.c=.h)
220 # Dependencies introduced by #include "project.h".
221 PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
223 # Socket libraries for platforms that need them explicitly defined
224 SOCKET_LIB = @SOCKET_LIB@
226 # PThreads library, if needed.
227 PTHREAD_LIB = @PTHREAD_ONLY@@PTHREAD_LIB@
229 SRCS = $(C_SRC) $(W32_SRC) $(PCRS_SRC) $(PCRE_SRC) $(REGEX_SRC)
230 OBJS = $(C_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS)
231 HDRS = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS)
232 LIBS = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
235 #############################################################################
237 #############################################################################
239 # The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
240 # The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
242 # The flag "-pthread" is required if using Pthreads under Linux (and
243 # possibly other OSs).
244 SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
246 # Add your flags here
249 CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
250 @STATIC_PCRE_ONLY@ -Ipcre
252 LDFLAGS = @LDFLAGS@ $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
255 #############################################################################
258 # There should NOT be any targets above this line.
259 #############################################################################
260 all: $(PROGRAM) default.action
263 #############################################################################
265 #############################################################################
266 .PHONY: all inifiles solaris-dist \
267 win-dist tarball-dist dok webserver clean clobber tags \
268 install CONF_DEST LOG_DEST \
269 PID_DEST check_doc install-strip uninstall GROUP_T
271 #############################################################################
272 # Define this explicitly because Solaris is broken!
273 #############################################################################
275 $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
278 #############################################################################
279 # Strip master copy comments from default.action:
280 #############################################################################
281 default.action: default.action.master
282 $(GREP) -v '^#MASTER#' default.action.master > $@
283 #############################################################################
285 #############################################################################
287 inifiles: $(W32_INIS)
290 $(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
291 -e 's!\logfile logfile!logfile privoxy.log!' \
292 -e 's!#Win32-only: !!' \
295 # LF to CRLF in default.action
296 $(DOSFILTER) <default.action >default.action.txt && mv default.action.txt default.action
297 # LF to CRLF in default.filter
298 $(DOSFILTER) <default.filter >default.filter.txt && mv default.filter.txt default.filter
301 $(DOSFILTER) < $< > $@
303 #############################################################################
305 #############################################################################
307 @if [ -d CVS ]; then \
308 $(ECHO) "***************************************************"; \
310 $(ECHO) "*** WARNING ***"; \
312 $(ECHO) "*** The presence of a CVS subdirectory suggests ***"; \
313 $(ECHO) "*** that you are trying to build a distribution ***"; \
314 $(ECHO) "*** package based on a checked out, not an ***"; \
315 $(ECHO) "*** exported copy of the source tree. Please ***"; \
316 $(ECHO) "*** see \"Releasing a new version\" in the ***"; \
317 $(ECHO) "*** developer manual. ***"; \
319 $(ECHO) "***************************************************"; \
320 $(ECHO) "Type \"yes i am sure\" if you are sure that you"; \
321 $(ECHO) -n "really want to proceed: "; \
323 if [ "$$answer" != "yes i am sure" ]; then exit 1; fi \
327 #############################################################################
328 # create tar.gz from CVS:
329 # This make-target is usually called through 'create-archive'. If you
330 # run 'make create-snapshot' without setting SNAPVERSION, you'll get a
331 # tar.gz with the current date in the name and as a releasenumber in the
332 # spec-file. But the main usage is to run it as follows (Red Hat example):
333 # make SNAPVERSION=1.6x create-snapshot
334 # This creates a tar.gz.
335 #############################################################################
337 @tag=`cvs -d $(CVSROOT) status Makefile | awk ' /Sticky Tag/ { print $$3 } '` 2> /dev/null; \
338 [ x"$$tag" = x"(none)" ] && tag=HEAD; \
339 echo "*** Creating package from $$tag!"; \
340 TMPDIR=$(shell mktemp -d /tmp/$(PROGRAM).XXXXXX); \
341 cd $$TMPDIR ; cvs -Q -d $(CVSROOT) export -r $$tag current || echo "Um... export aborted."; \
342 cd $$TMPDIR/current; \
343 $(TAR) --exclude ".cvsignore" --exclude "CVS" \
344 -czf /tmp/$(PROGRAM)-$(VERSION).tar.gz .; \
346 @echo "Resulting file is /tmp/$(PROGRAM)-$(VERSION).tar.gz"
349 #############################################################################
350 # looks at the version of Makefile and exports a corresponding source-tree
351 # example: if the Makefile has the sticky tag v_2_9_13, you'll get
352 # privoxy-*-2.4.13.tar.gz.
353 #############################################################################
355 make SNAPVERSION=$(SNAPVERSION) create-snapshot
357 #############################################################################
358 # generic distribution
359 #############################################################################
362 @$(ECHO) "You have run autoconf && autoheader && ./configure right?"
365 $(STRIP_PROG) $(PROGRAM)
366 $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
368 (cd .. && $(TAR) -cvhf --exclude "PACKAGERS" privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$(PROGRAM))
370 for foo in $(CONFIG_FILES); do \
371 (cd .. && $(TAR) -uvhf --exclude "PACKAGERS" privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
374 for foo in $(DOC_FILES); do \
375 (cd .. && $(TAR) -uvhf --exclude "PACKAGERS" privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
377 # and zip the archive
378 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
379 $(GZIP_PROG) ../privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar
380 @$(ECHO) Distribution with binary created.
382 # anonymously ncftps the package to sourceforge
384 ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar.gz
385 @$(ECHO) -------------------------------------------------------
387 @$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
388 @$(ECHO) ... and release the files.
389 @$(ECHO) -------------------------------------------------------
393 $(RM) privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS)-src.tar*
395 #############################################################################
396 # Tarball distribution: No CVS dirs, dotfiles, debian build dir,
397 # (FIXME:) only parts of the static / generated docs mix in doc/webserver
398 #############################################################################
400 tarball-dist: dist-check clean clobber
401 $(LN) -s current ../privoxy-$(VERSION)-$(CODE_STATUS)
403 for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
404 -o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
405 -name "PACKAGERS" \)`; do \
406 files="$$files privoxy-$(VERSION)-$(CODE_STATUS)/$$i"; \
408 cd .. && $(TAR) -cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar $$files ; \
410 # and zip the archive
411 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
412 $(GZIP_PROG) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
413 @$(ECHO) Tarball distribution created.
415 # anonymously ncftps the tarball to sourceforge
417 ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
418 @$(ECHO) -------------------------------------------------------
420 @$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
421 @$(ECHO) ... and release the files.
422 @$(ECHO) -------------------------------------------------------
425 $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
427 #############################################################################
431 # converts doc/source/*.sgml into html and man pages
433 #############################################################################
437 $(RM) doc/webserver/developer-manual/*.html
438 $(RM) -r doc/source/developer-manual
439 mkdir -p doc/source/developer-manual
440 cd doc/source/developer-manual && $(DB) ../developer-manual.sgml && cd .. && cp developer-manual/*.html ../webserver/developer-manual/
444 $(RM) doc/webserver/user-manual/*.html
445 $(RM) -r doc/source/user-manual/
446 mkdir -p doc/source/user-manual
447 cd doc/source/user-manual && $(DB) -iuser-man ../user-manual.sgml && cd .. && cp user-manual/*.html ../webserver/user-manual/
448 # FIXME: temp fix so same stylesheet gets in more than one place so it works
449 # for all doc set-ups, including the 'user manual' config option in local
450 # system where it MUST be in same directory as html.
451 $(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
455 $(RM) doc/webserver/faq/*.html
456 $(RM) -r doc/source/faq
457 mkdir -p doc/source/faq
458 cd doc/source/faq && $(DB) ../faq.sgml && cd .. && cp faq/*.html ../webserver/faq/
460 # man page, one variation. Try to use the next target, just 'make man'.
462 $(RM) doc/man/* doc/webserver/man-page/*.html
463 echo MAN2HTML is $(MAN2HTML)
464 @if [ $(MAN2HTML) != "false" ]; then \
465 $(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; \
466 man ./$(MAN_PAGE) | $(MAN2HTML) -bare >> doc/webserver/man-page/privoxy-man-page.html; \
467 $(ECHO) "</body></html>" >> doc/webserver/man-page/privoxy-man-page.html; \
469 $(MAKE) groff2html; \
472 # Build man page from sgml. This requires the SGMLSpm perl module.
473 # See CPAN, or your favorite perl repository. This is the preferred
474 # target for man page generation!
476 mkdir -p doc/source/temp && cd doc/source/temp && $(RM) * ;\
477 nsgmls ../privoxy-man-page.sgml | sgmlspl ../../../utils/docbook2man/docbook2man-spec.pl &&\
478 perl -pi.bak -e 's/ <URL:.*>//; s/\[ /\[/g' $(MAN_PAGE) ;\
479 perl -pi.bak -e "s/\[ /\[/g;s/á/\\\\['a]/g;s/é/\\\\['e]/g" $(MAN_PAGE); \
480 perl -pi.bak -e "s/ö/\\\\[:o]/g" $(MAN_PAGE); \
481 perl -pi.bak -e 's/([ {])-([a-z])/$$1\\-$$2/g' $(MAN_PAGE); \
482 perl -pi.bak -e 's/ --([a-z])/ \\-\\-$$1/g' $(MAN_PAGE); \
483 perl -pi.bak -e 's/\\fB--/\\fB\\-\\-/g' $(MAN_PAGE); \
484 $(DB) ../privoxy-man-page.sgml && $(MV) -f $(MAN_PAGE) ../../../$(MAN_PAGE)
486 # For those with man2html ala RH7s.
488 mkdir -p doc/webserver/man-page
489 @if [ $(MAN2HTML) != "false" ]; then \
490 $(MAN2HTML) $(MAN_PAGE) |grep -v "^Content-type" > tmp.html; \
491 $(PERL) -pi.bak -e 's/<A .*Contents<\/A>//; s/<A .*man2html<\/A>/man2html/' tmp.html; \
492 $(PERL) -pi.bak -e 's/(<\/HEAD>)/<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"..\/p_doc.css\"><\/HEAD>/' tmp.html; \
493 $(PERL) -pi.bak -e 's/(<A.*),(">)/$$1$$2/g' tmp.html; \
494 $(PERL) -pi.bak -e 's,\.">,">,g' tmp.html; \
495 $(PERL) -pi.bak -e "s/\['a\]/\á/g;s/\['e\]/\é/g" tmp.html; \
496 $(SED) -e 's/
\a//g' tmp.html > doc/webserver/man-page/privoxy-man-page.html && $(RM) tmp.*; \
498 $(MAKE) groff2html; \
501 # Otherwise we get plain groff conversion.
503 $(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
506 # readme page and INSTALL file
507 dok-readme: dok-release
508 cd doc/source && $(DB)-notoc -V nochunks readme.sgml > tmp.html &&\
509 $(W3M_DUMP) tmp.html > ../../README ;\
510 $(DB)-notoc -V nochunks install.sgml > tmp.html &&\
511 $(W3M_DUMP) tmp.html > ../../INSTALL ;\
514 # index.sgml is used to create both the Home Page, and a local index
515 # for documentation, etc.
517 # index.html for webserver:
519 cd doc/source/webserver && $(DB)-notoc -ip-homepage -V nochunks index.sgml > ../../webserver/index.html
520 $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
521 s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps users to protect their privacy.\"><\/HEAD/;\
524 doc/webserver/index.html && $(RM) doc/webserver/*.bak
526 # privoxy-index.html for local documentation:
528 cd doc/source/webserver && $(DB)-notoc -ip-index -V nochunks index.sgml > ../../webserver/privoxy-index.html
529 $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
530 s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps users to protect their privacy.\"><\/HEAD/;\
533 doc/webserver/privoxy-index.html && $(RM) doc/webserver/*.bak
535 # Main documentation target.
536 dok: dok-release dok-devel dok-user dok-faq dok-readme dok-webserver dok-authors dok-index
537 @$(ECHO) Documentation created.
541 cd doc/source && $(DB) -V nochunks authors.sgml > tmp.html && $(W3M_DUMP_UTF8) \
542 tmp.html > ../../AUTHORS && $(RM) tmp.html
544 # Set doc entities for VERSION and CODE_STATUS in sgml docs. Toggle content
545 # exceptions accordingly. This needs to go before any doc building (doh).
547 @$(ECHO) Setting doc version and status to $(VERSION), $(CODE_STATUS)
548 @$(PERL) -pi.bak -e 's/<!entity +p-version.*>/<!entity p-version "$(VERSION)">/;\
549 s/<!entity +p-status.*>/<!entity p-status "$(CODE_STATUS)">/' \
550 doc/source/*sgml doc/source/*/*sgml
551 $(RM) -r doc/source/*bak doc/source/*/*bak
552 @if [ $(CODE_STATUS) = "stable" ]; then \
553 $(ECHO) Setting docs to stable $(VERSION); \
554 $(PERL) -pi.bak -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "INCLUDE">/;\
555 s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "IGNORE">/' \
556 doc/source/*sgml doc/source/*/*sgml; \
558 $(ECHO) Setting docs to not stable $(VERSION); \
559 $(PERL) -pi.bak -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "IGNORE">/; \
560 s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "INCLUDE">/' \
561 doc/source/*sgml doc/source/*/*sgml; \
563 $(RM) -r doc/source/*bak doc/source/*/*bak;
565 # Create release announcement in text and html, with short and long versions.
566 # This is a standalone target, and must be invoked directly.
567 # announce: dok-release
568 # mkdir -p $(DOC_TMP)
569 # cd $(DOC_TMP) && cp -f ../announce.sgml . && $(DB) -iannounce-big announce.sgml &&\
570 # mv -f index.html announce.html && $(W3M_DUMP) announce.html > announce.txt
571 # cd $(DOC_TMP) && $(DB) announce.sgml &&\
572 # mv -f index.html announce-mini.html && $(W3M_DUMP) announce-mini.html > announce-mini.txt &&\
573 # mv -f *html *txt ../../..
576 # The main Privoxy config file, generated from sgml sources.
577 # NOTE: This will require some hand editing.
578 config-file: dok-release generate-config-file
580 $(RM) config.bak config.html
581 @$(ECHO) "****************************************************"
582 @$(ECHO) "The config file has been optimistically updated"
583 @$(ECHO) "Now -- you may need to hand edit the results!"
584 @$(ECHO) "In particular, check the Debug levels, the"
585 @$(ECHO) "permit-access, forward & socks examples and the"
586 @$(ECHO) "various user-manual examples, which all"
587 @$(ECHO) "might have gotten hammered."
588 @$(ECHO) "****************************************************"
590 generate-config-file:
591 cd doc/source && $(DB)-notoc -iconfig-file -V nochunks config.sgml > ../../config.html
592 $(W3M_DUMP) -cols 67 config.html > config
593 $(PERL) -i.bak utils/prepare-configfile.pl config
595 # config file, alternate version using lynx (perl stuff unfinished). Lynx
596 # does not do so good a job.
598 cd doc/source && $(ECHO) -e ".h2 JUSTIFY\\nJUSTIFY:FALSE" > __tmp.lynx_cfg &&\
599 $(DB)-notoc -iconfig-file -V nochunks config.sgml > __tmp.html &&\
600 lynx -cfg=__tmp.lynx_cfg -width=78 -dump __tmp.html > ../../config.new && $(RM) -r __tmp.*
601 $(PERL) -pi -e 's/^( )//;\
602 s/:$\/:\n/' config.new
604 #############################################################################
608 # moves dokumentation to webserver
610 #############################################################################
612 @sf_name=$(SOURCE_FORGE_NAME); \
613 [ -n "$${sf_name}" ] || read -p "Enter SourceForge username: " sf_name || exit 1; \
614 echo "Opening shell for $${sf_name} ..."; \
615 ssh -t $${sf_name},ijbswa@shell.sourceforge.net create
617 webserver: clean-editor-files
618 @$(ECHO) -------------------------------------------------------
619 @$(ECHO) You will need to "create" a SF shell first:
620 @$(ECHO) ssh -t SF-USER-ID,ijbswa@shell.sourceforge.net create
621 @$(ECHO) Please make sure your documentation files are up to date.
622 @$(ECHO) Note that this command updates the home page and copys
623 @$(ECHO) all stuff to the webserver, it will not remove obsolete documents.
624 @$(ECHO) Note that a botched upload can result in the documentation
625 @$(ECHO) on the website becoming unreachable! Also the CSS files
626 @$(ECHO) currently seem to end up at the wrong place.
627 @$(ECHO) -------------------------------------------------------
629 @$(ECHO) Replacing the user-manual symlink
630 @$(SSH) shell.sourceforge.net "cd $(WWW_ROOT)/htdocs && rm user-manual \
631 && mkdir -p $(VERSION)/user-manual && ln -s $(VERSION)/user-manual user-manual"
633 @$(ECHO) Uploading html
635 upload=`find . -type f -a -not \( -path "*/CVS*" -o -path "*/results*" \)`; \
636 $(TAR) cf - $$upload | $(SSH) shell.sourceforge.net 'cd $(WWW_ROOT)/htdocs/; tar xvm 2>&1 | grep -v timestamp'
638 @$(ECHO) Fixing permissions
639 @$(SSH) shell.sourceforge.net 'chmod -R 775 $(WWW_ROOT)/htdocs 2>/dev/null; true'
640 @$(SSH) shell.sourceforge.net 'find $(WWW_ROOT)/htdocs/ -type f | xargs chmod 664 2>/dev/null; true'
642 web-actions: clean-editor-files
644 @cd doc/webserver/actions; \
645 upload=`find . -type f -a -not \( -path "*/CVS*" -o -path "*/results*" \)`; \
646 $(TAR) cf - $$upload | $(SSH) ijbswa.sourceforge.net 'cd $(WWW_ROOT)/htdocs/actions; tar xvm'
648 @$(ECHO) Fixing permissions
649 @$(SSH) ijbswa.sourceforge.net 'find $(WWW_ROOT)/htdocs/actions/ -type f | xargs chmod 664 2>/dev/null'
650 @$(SSH) ijbswa.sourceforge.net 'chmod 666 $(WWW_ROOT)/htdocs/actions/results/actions-feedback.txt 2>/dev/null'
654 tar --exclude ".cvsignore" --exclude "CVS" --exclude "source" --exclude ".htaccess" \
655 --exclude "obsolete" --exclude "actions" --exclude "*.zip" --exclude "robots.txt"\
656 doc/* INSTALL LICENSE AUTHORS README \
658 $(ECHO) "Uploading doc package ..." ;\
659 scp $(DOC_FILE) ijbswa.sourceforge.net:$(WWW_ROOT)/htdocs/docs/
660 @$(SSH) ijbswa.sourceforge.net 'chmod 775 $(WWW_ROOT)/htdocs/docs/*gz 2>/dev/null; true'
665 $(WGET) http://www.privoxy.org/docs/$(DOC_FILE) ;\
666 $(TAR) -zxvf $(DOC_FILE)
668 #############################################################################
670 # Try to clean up the generated HTML files.
672 # The files are a such a mess that some of them require two tidy runs
673 # in row as the first abort prematurely. The vanilla tidy output renders
674 # poorly as it contains a bit too much white-space, so we additionally run
675 # the files through perl to fix this again.
677 #############################################################################
679 for html_file in `find doc/webserver -name "*.html"`; do \
680 $(TIDY) $$html_file || $(TIDY) $$html_file; \
681 $(PERL) -i'' -e 's@^\s*<br>\s*$$@@; s@ +$$@@;' -n -p $$html_file; \
685 #############################################################################
686 # Source file dependencies
687 #############################################################################
689 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
690 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
691 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
692 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
693 deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
694 encode.@OBJEXT@: encode.c encode.h config.h
695 errlog.@OBJEXT@: errlog.c errlog.h config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
696 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
697 gateway.@OBJEXT@: gateway.c gateway.h config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
698 jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
699 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
700 list.@OBJEXT@: list.c list.h config.h $(PROJECT_H_DEPS) list.h miscutil.h
701 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
702 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
703 miscutil.@OBJEXT@: miscutil.c miscutil.h config.h
704 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
705 ssplit.@OBJEXT@: ssplit.c ssplit.h config.h miscutil.h
706 urlmatch.@OBJEXT@: urlmatch.c urlmatch.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
709 gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
712 pcrs.@OBJEXT@: pcrs.c pcrs.h config.h @STATIC_PCRE_ONLY@pcre/pcre.h
715 pcre/get.@OBJEXT@: pcre/get.c pcre/config.h pcre/internal.h pcre/pcre.h
716 pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
717 pcre/pcre.@OBJEXT@: pcre/pcre.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c
718 pcre/pcreposix.@OBJEXT@: pcre/pcreposix.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
719 pcre/study.@OBJEXT@: pcre/study.c pcre/config.h pcre/internal.h pcre/pcre.h
721 # An auxiliary program makes the PCRE default character table source
723 pcre/chartables.c: pcre/dftables@EXEEXT@
724 pcre/dftables@EXEEXT@ >pcre/chartables.c
726 pcre/dftables@EXEEXT@: pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
727 $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
730 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
731 w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
732 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
734 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
735 windres -D__MINGW32__=0.2 -O coff -i $< -o $@
738 @AMIGAOS_ONLY@OBJS += amiga.o
739 @AMIGAOS_ONLY@ifeq ($(shell $(CC) -dumpmachine), m68k-amigaos)
740 @AMIGAOS_ONLY@CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -W -m68020 -noixemul -fbaserel -msmall-code
741 @AMIGAOS_ONLY@LDFLAGS += -m68020 -noixemul -fbaserel
742 @AMIGAOS_ONLY@LIBS = -lm /gg/lib/libb/libm020/libnix/swapstack.o
744 @AMIGAOS_ONLY@CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -Wextra -D__USE_INLINE__ -D__NO_INTUITION_RJ_MACROS
746 @AMIGAOS_ONLY@amiga.o: amiga.c amiga.h config.h
749 $(PROGRAM): $(OBJS) $(W32_FILES)
750 $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
753 $(RM) a.out $(OBJS) $(W32_FILES) $(W32_INIS) $(PROGRAM) default.action \
754 config.base config.tmp \
755 `find . \( -name TAGS -o -name tags \) -and -not -path "./.git/refs/tags"` \
756 `find . -name "*.orig" -a -not -name rc.privoxy.orig`
759 $(RM) `find . -name "*~"`
760 $(RM) `find . -name "#*#"` # Emacs backup files
761 $(RM) `find . -name ".\#*"`
763 clobber: clean-editor-files
764 $(RM) GNUmakefile configure config.h.in config.h config.cache config.status config.log logfile \
765 privoxy.log core *.tar.gz *.tar privoxy-cl.spec doc/source/ldp.dsl config.new
766 $(RM) -r autom4te.cache
769 # FIXME: What is all this?
771 $(RM) cscope.* *.pdb *.lib *.exp
775 tags: $(SRCS) $(HDRS)
776 etags $(SRCS) $(HDRS)
778 CONF_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(CONF_BASE)" = "$(prefix)/etc" ];then \
779 $(ECHO) "$(CONF_BASE)/privoxy";\
781 $(ECHO) "$(CONF_BASE)";\
784 LOG_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(LOGS_DEST)" = "$(prefix)/var/log/privoxy" ];then \
785 $(ECHO) "/var/log/privoxy" ;\
787 $(ECHO) "$(LOGS_DEST)";\
790 PID_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(PIDS_DEST)" = "$(prefix)/var/run" ];then \
791 $(ECHO) "/var/run" ;\
793 $(ECHO) "$(PIDS_DEST)";\
796 check_doc:=$(shell if [ ! -d "$(SHARE_DEST)/doc" ] && [ "$(prefix)" = "/usr/local" ] && [ -d "$(prefix)/doc" ];then \
802 # If USER is specified but no GROUP, assume there is a GROUP of same name.
803 GROUP_T:=$(shell if [ x$(GROUP) = x ] && [ x$(USER) != x ];then \
810 $(MAKE) install STRIP=-s
812 # FIXME: Test USER and GROUP on Slack to make sure this works as
815 # FIXME: id handling needs help, probably via configure, since 'id -u' is not
816 # universally reliable (eg Solaris). Group handling could be better.
817 # Perhaps the whole user/group validation should be done here, and simplified.
818 PROGRAM_V = Privoxy $(VERSION) $(CODE_STATUS)
819 install: CONF_DEST LOG_DEST PID_DEST check_doc GROUP_T
820 @# Quick test for valid USER.
821 @if [ -n "$(USER)" ]; then \
822 $(ID) $(USER) >/dev/null || exit 1;\
824 @# Test for valid group. FIXME. USER does not have to belong to GROUP
825 @# for file ownership purposes.
826 # if [ -n "$(GROUP_T)" ] && [ -n "$(USER)" ] && ! $(GROUPS) $(USER) | $(GREP) "\<$(GROUP_T)\>" >/dev/null; then \
827 # $(ECHO) Group $(GROUP_T) for User $(USER) is invalid && exit 1 ;\
830 @$(ECHO) "Creating directories, and preparing $(PROGRAM_V) installation"
831 $(CHMOD) $(DIR_MODE) $(MKDIR)
832 @$(MKDIR) $(DESTDIR)$(SBIN_DEST) $(DESTDIR)$(prefix) $(DESTDIR)$(CONF_DEST) \
833 $(DESTDIR)$(CONF_DEST)/templates $(DESTDIR)$(SHARE_DEST) \
834 $(DESTDIR)$(LOG_DEST) $(DESTDIR)$(PID_DEST)
835 @# Install the executable binary, strip if invoked as install-strip
836 @test -n "$(STRIP)" &&\
837 $(ECHO) Installing $(PROGRAM) stripped executable to $(SBIN_DEST) ||\
838 $(ECHO) Installing $(PROGRAM) executable to $(DESTDIR)$(SBIN_DEST)
839 $(INSTALL) $(INSTALL_P) $(STRIP) $(PROGRAM) $(DESTDIR)$(SBIN_DEST)
841 @# Install the DOCS and man page. install-sh only does one file at a time.
842 @# FIXME: only handles jpegs.
843 -@if [ $(check_doc) = 0 ]; then \
846 DOC=$(prefix)/doc/privoxy ;\
848 $(MKDIR) $(DESTDIR)$$DOC $(DESTDIR)$$DOC/user-manual $(DESTDIR)$$DOC/faq $(DESTDIR)$$DOC/developer-manual \
849 $(DESTDIR)$$DOC/man-page $(DESTDIR)$$DOC/images $(DESTDIR)$(MAN_DEST) ;\
850 if [ -d "$(DOK_WEB)" ]; then \
851 $(ECHO) Installing FAQ, Manual, and other docs to $(DESTDIR)$$DOC;\
852 for i in user-manual developer-manual faq; do \
853 for ii in $(DOK_WEB)/$$i/*html; do \
854 $(INSTALL) $(INSTALL_T) $$ii $(DESTDIR)$$DOC/$$i;\
857 for i in $(DOK_WEB)/user-manual/*jpg; do \
858 $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$$DOC/user-manual;\
860 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/man-page/*html $(DESTDIR)$$DOC/man-page;\
861 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/privoxy-index.html $(DESTDIR)$$DOC/index.html;\
862 $(INSTALL) $(INSTALL_T) AUTHORS $(DESTDIR)$$DOC;\
863 $(INSTALL) $(INSTALL_T) LICENSE $(DESTDIR)$$DOC;\
864 $(INSTALL) $(INSTALL_T) README $(DESTDIR)$$DOC;\
865 $(INSTALL) $(INSTALL_T) ChangeLog $(DESTDIR)$$DOC;\
866 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $(DESTDIR)$$DOC;\
867 $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $(DESTDIR)$$DOC/user-manual;\
869 @# Not all platforms support gzipped man pages.
870 @$(ECHO) Installing man page to $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)
871 -$(INSTALL) $(INSTALL_T) $(MAN_PAGE) $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)
873 @# Change the config file default directories according to the configured ones
874 @$(ECHO) Rewriting config for this installation
875 @if [ -f config.base ] ; then \
876 $(CAT) config >config~ ;\
877 $(MV) config.base config ;\
879 $(SED) 's+^confdir \.+confdir $(CONF_DEST)+' config | \
880 $(SED) 's+^logdir \.+logdir $(LOG_DEST)+' >config.tmp
881 -@if [ $(check_doc) = 0 ]; then \
882 $(SED) 's+^#\?user-manual .*+user-manual $(DOC_DEST)/user-manual/+' config.tmp >config.updated ;\
884 $(SED) 's+^#\?user-manual .*+user-manual $(prefix)/doc/privoxy/user-manual/+' config.tmp >config.updated ;\
886 $(MV) config config.base
887 $(MV) config.updated config
889 @# Install the config support files. Test for root install, and abort
890 @# if there is no privoxy user, and no other user was enabled during
891 @# configure. Later, install init script if appropriate.
892 @$(ECHO) Installing templates to $(DESTDIR)$(CONF_DEST)/templates
893 @for i in `find templates -type f`; do \
894 $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$(CONF_DEST)/templates ;\
897 @# FIXME: group/user validation is overly convoluted.
898 @# If superuser install ... we require a minimum of group ownership
899 @# of those files the daemon writes to, to be non-root owned.
900 @if [ "`$(ID) |sed 's/(.*//' |sed 's/.*=//'`" = "0" ] ;then\
901 if [ x$(USER) = x ] || [ $(USER) = root ]; then \
902 if [ x$(GROUP) = x ] || [ $(GROUP) = root ]; then \
903 if [ "`$(ID) privoxy`" ] && \
904 $(GROUPS) privoxy | $(SED) 's/^.*://' |$(GREP) "\<privoxy\>" >/dev/null; then \
905 $(ECHO) "Warning: Setting group owner to privoxy";\
908 $(ECHO) "******************************************************************" ;\
909 $(ECHO) " WARNING! WARNING! installing config files as root!" ;\
910 $(ECHO) " It is strongly recommended to run $(PROGRAM) as a non-root user," ;\
911 $(ECHO) " and to install the config files as that user and/or group!" ;\
912 $(ECHO) " Please read INSTALL, and create a privoxy user and group!" ;\
913 $(ECHO) "*******************************************************************" ;\
919 INSTALL_CONF="$(INSTALL_R) -g $$GROUP_T " ;\
921 $(ECHO) "Superuser install, installing config files as $(USER):$(GROUP_T)" ;\
922 INSTALL_CONF="$(INSTALL_R) -o $(USER) -g $(GROUP_T)" ;\
923 GROUP_T=$(GROUP_T) ;\
926 if [ ! "`id $(USER)`" = "`id`" ] ;then \
927 $(ECHO) "** WARNING ** current install user different from configured user!!" ;\
928 $(ECHO) "Edit may fail." ;\
930 INSTALL_CONF="$(INSTALL_R)" ;\
932 $(ECHO) Installing configuration files to $(DESTDIR)$(CONF_DEST);\
933 for i in $(CONFIGS); do \
934 if [ "$$i" = "default.action" ] || [ "$$i" = "default.filter" ] ; then \
935 $(RM) $(DESTDIR)$(CONF_DEST)/$$i ;\
936 $(ECHO) Installing fresh $$i;\
937 $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST) || exit 1;\
938 elif [ -s "$(CONF_DEST)/$$i" ]; then \
939 $(ECHO) Installing $$i as $$i.new ;\
940 $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST)/$$i.new || exit 1;\
943 $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST) || exit 1;\
946 if [ -n "$$NEW" ]; then \
947 $(CHMOD) $(RWD_MODE) $(DESTDIR)$(CONF_DEST)/*.new || exit 1 ;\
948 $(ECHO) "Warning: Older config files are preserved. Check new versions for changes!" ;\
950 [ ! -f $(DESTDIR)$(LOG_DEST)/logfile ] && $(ECHO) Creating logfiles in $(DESTDIR)$(LOG_DEST) || \
951 $(ECHO) Checking logfiles in $(DESTDIR)$(LOG_DEST) ;\
952 $(TOUCH) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\
953 if [ x$$USER != x ]; then \
954 $(CHOWN) $$USER $(DESTDIR)$(LOG_DEST)/logfile || \
955 $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\
957 if [ x$$GROUP_T != x ]; then \
958 $(CHGRP) $$GROUP_T $(DESTDIR)$(LOG_DEST)/logfile || \
959 $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\
961 $(CHMOD) $(RWD_MODE) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\
962 if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \
963 if [ -f /etc/slackware-version ] && [ -d /etc/rc.d/ ] && [ -w /etc/rc.d/ ] ; then \
964 $(SED) 's+%PROGRAM%+$(PROGRAM)+' slackware/rc.privoxy.orig | \
965 $(SED) 's+%SBIN_DEST%+$(SBIN_DEST)+' | \
966 $(SED) 's+%CONF_DEST%+$(CONF_DEST)+' | \
967 $(SED) 's+%USER%+$(USER)+' | \
968 $(SED) 's+%GROUP%+$(GROUP_T)+' >slackware/rc.privoxy ;\
969 $(INSTALL) $(INSTALL_P) slackware/rc.privoxy $(DESTDIR)/etc/rc.d/ ;\
970 $(ECHO) "Installing for Slackware." ;\
971 $(ECHO) "Dont forget to add the rc.privoxy to rc.local if you want it started at every boot" ;\
972 elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \
973 $(ECHO) "Installing generic init script to $(DESTDIR)/etc/init.d/privoxy" ;\
974 $(ECHO) "Please check that the PATHs are correct, and edit if needed." ;\
975 $(INSTALL) $(INSTALL_P) privoxy-generic.init $(DESTDIR)/etc/init.d/privoxy ;\
978 $(ECHO) "No init script installed, install it manually if needed" ;\
980 $(RM) config.base config.tmp
982 @$(ECHO) "$(PROGRAM_V) installation succeeded!"
983 @$(ECHO) "The Privoxy configuration files have been installed in $(DESTDIR)$(CONF_DEST)"
985 # rmdir is used as a precaution since it will not remove non-empty
986 # directories. RH init script creates lock file and pid file.
987 uninstall: CONF_DEST LOG_DEST PID_DEST check_doc
988 @$(ECHO) Starting Privoxy uninstallation
989 @# KILL privoxy if running
990 @# XXX: the chkconfig line may need a DESTDIR prefix.
991 -@test -f $(DESTDIR)$(PID_DEST)/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\
992 $(KILL) `$(CAT) $(DESTDIR)$(PID_DEST)/privoxy.pid` || :
993 -@test -f $(DESTDIR)/var/run/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\
994 $(KILL) `$(CAT) $(DESTDIR)/var/run/privoxy.pid ` || :
997 @$(ECHO) Removing $(PROGRAM) binary
998 $(RM) $(DESTDIR)$(SBIN_DEST)/$(PROGRAM) $(SBIN_DEST)/$(PROGRAM)~
1000 @# config files and dir, and maybe old install backups
1001 -@if [ -d $(DESTDIR)$(CONF_DEST) ]; then \
1002 $(ECHO) Saving $(PROGRAM) config files to $(DESTDIR)/tmp/$(PROGRAM)-save ;\
1003 $(MKDIR) $(DESTDIR)/tmp/$(PROGRAM)-save ;\
1004 cd $(DESTDIR)$(CONF_DEST) ;\
1005 for i in $(DESTDIR)$(CONFIGS); do \
1006 [ -f $$i ] && $(CP) $$i $(DESTDIR)/tmp/$(PROGRAM)-save ;\
1009 @$(ECHO) Removing $(PROGRAM) config files
1010 -@for i in $(DESTDIR)$(CONFIGS); do \
1011 test -f $(CONF_DEST)/$$i && $(ECHO) Removing $$i ;\
1012 $(RM) $(DESTDIR)$(CONF_DEST)/$$i $(DESTDIR)$(CONF_DEST)/$$i~ $(DESTDIR)$(CONF_DEST)/$$i.new ;\
1014 -@test -d $(DESTDIR)$(CONF_DEST)/templates && $(RM) -r $(DESTDIR)$(CONF_DEST)/templates &&\
1015 $(ECHO) "Removing $(DESTDIR)$(CONF_DEST)/templates/*"
1017 @# man page and docs
1018 @$(ECHO) Removing $(PROGRAM) docs
1019 -$(RM) $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)*
1020 -$(RM) -r $(DESTDIR)$(DOC_DEST) || $(RM) -r $(DESTDIR)$(prefix)/doc/privoxy
1023 @$(ECHO) Removing $(PROGRAM) logs
1024 -$(RM) $(DESTDIR)$(LOG_DEST)/logfile $(DESTDIR)$(PID_DEST)/privoxy.pid
1026 @# Final clean up of unused directories. Special handling of CONF and LOG
1028 @$(ECHO) Removing $(PROGRAM) directories
1029 @for i in $(DESTDIR)$(LOG_DEST) $(DESTDIR)$(CONF_DEST); do \
1030 if test -d $$i; then \
1031 $(ECHO) Removing $$i ;\
1032 $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\
1035 @if [ ! "$(prefix)" = "/usr/local" ] ;then \
1036 for i in $(DESTDIR)$(MAN_DEST) $(DESTDIR)$(MAN_DIR) $(DESTDIR)$(SHARE_DEST)/doc \
1037 $(DESTDIR)$(SHARE_DEST) $(DESTDIR)$(SBIN_DEST); do \
1038 if test -d $$i; then \
1039 $(ECHO) Removing $$i ;\
1040 $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\
1043 if test $(LOG_DEST) != /var/log/privoxy && test -d $(DESTDIR)$(prefix)/var/log; then \
1044 $(ECHO) Removing $(DESTDIR)$(prefix)/var/log ;\
1045 $(RMDIR) $(DESTDIR)$(prefix)/var/log || $(ECHO) "$(DESTDIR)$(prefix)/var/log is not empty, not removed";\
1047 if test $(PID_DEST) != /var/run && test -d $(DESTDIR)$(prefix)/var/run; then \
1048 $(ECHO) Removing $(DESTDIR)$(prefix)/var/run ;\
1049 $(RMDIR) $(DESTDIR)$(prefix)/var/run || $(ECHO) "$(DESTDIR)$(prefix)/var/run is not empty, not removed";\
1051 if test $(prefix)/var != /var && test -d $(DESTDIR)$(prefix)/var; then \
1052 $(ECHO) Removing $(DESTDIR)$(prefix)/var ;\
1053 $(RMDIR) $(DESTDIR)$(prefix)/var || $(ECHO) "$(DESTDIR)$(prefix)/var is not empty, not removed" ;\
1055 if test $(prefix) != / && test $(prefix) != /usr && test -d $(DESTDIR)$(prefix); then \
1056 $(ECHO) Removing $(DESTDIR)$(prefix) ;\
1057 $(ECHO) Removing installation directory $(DESTDIR)$(prefix) ;\
1058 $(RMDIR) $(DESTDIR)$(prefix) || $(ECHO) "$(DESTDIR)$(prefix) is not empty, not removed" ;\
1063 @if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \
1064 $(ECHO) Removing $(PROGRAM) init script ;\
1065 if [ -f $(DESTDIR)/etc/slackware-version ] && \
1066 [ -d $(DESTDIR)/etc/rc.d/ ] && [ -w $(DESTDIR)/etc/rc.d/ ] ; then \
1067 $(RM) $(DESTDIR)/etc/rc.d/rc.privoxy ;\
1068 elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \
1069 $(RM) $(DESTDIR)/etc/init.d/privoxy ;\
1071 $(ECHO) "Unable to remove privoxy init script, not installed or permission denied" ;\
1074 @$(ECHO) Privoxy uninstalled, bye
1077 @perl -e 'print pack "C*", (31,139,8,8,153,63,226,60,2,3,99,111,102,102,101,' \
1078 -e '101,0,109,143,205,13,192,32,8,133,239,78,241,110,234,1,28,160,171,' \
1079 -e '152,208,53,26,117,247,22,165,73,137,125,9,1,62,126,2,128,169,5,243,' \
1080 -e '143,13,139,49,164,65,100,149,152,102,73,141,88,73,178,116,205,100,' \
1081 -e '69,253,36,102,81,49,83,236,19,225,171,131,214,172,163,73,4,168,123,' \
1082 -e '115,71,126,247,122,94,128,178,227,95,154,12,86,215,122,197,249,146,' \
1083 -e '187,54,220,125,193,51,228,11,1,0,0);' | zcat