GNUmakefile.in 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. # Note: GNUmakefile is built automatically from GNUmakefile.in
  2. #
  3. # Written by and Copyright (C) 2001-2018 members of the
  4. # Privoxy team. https://www.privoxy.org/
  5. #
  6. # Based on the Internet Junkbuster originally written
  7. # by and Copyright (C) 1997 Anonymous Coders and
  8. # Junkbusters Corporation. http://www.junkbusters.com
  9. #
  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.
  15. #
  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.
  21. #
  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.
  27. #
  28. #############################################################################
  29. # Set make command correctly
  30. #############################################################################
  31. @SET_MAKE@
  32. #############################################################################
  33. # Version number (for RPM)
  34. #############################################################################
  35. VERSION_MAJOR = @VERSION_MAJOR@
  36. VERSION_MINOR = @VERSION_MINOR@
  37. VERSION_POINT = @VERSION_POINT@
  38. CODE_STATUS = @CODE_STATUS@
  39. VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
  40. SNAPVERSION = $(VERSION)-$(shell date "+%Y%m%d")
  41. SOURCE_DATE_EPOCH ?= @SOURCE_DATE_EPOCH@
  42. MTREE_SPEC_FILE = privoxy-$(VERSION)-$(CODE_STATUS).spec
  43. #############################################################################
  44. # "make install" directories and variables
  45. #############################################################################
  46. #User Group paras
  47. USER = @USER@
  48. GROUP = @GROUP@
  49. datarootdir = @datarootdir@
  50. prefix = @prefix@
  51. exec_prefix = @exec_prefix@
  52. CONF_BASE = @sysconfdir@
  53. SBIN_DEST = @sbindir@
  54. MAN_DIR = @mandir@
  55. MAN_DEST = $(MAN_DIR)/man1
  56. MAN_PAGE = privoxy.1
  57. SHARE_DEST = @datadir@
  58. DOC_DEST = $(SHARE_DEST)/doc/privoxy
  59. VAR_DEST = @localstatedir@
  60. LOGS_DEST = $(VAR_DEST)/log/privoxy
  61. PIDS_DEST = $(VAR_DEST)/run
  62. # if $prefix = /usr/local then the default CONFDEST change from
  63. # CONF_DEST = $(CONF_BASE) to CONF_DEST = $(CONF_BASE)/privoxy
  64. # by the target rule CONF_DEST
  65. #
  66. # also if the $prefix is /usr/local and there is no
  67. # $(SHARE_DEST)/doc, it checks for $prefix/doc and installs there
  68. # instead in this situation
  69. #
  70. # finally if $prefix=/usr/local and VAR_DEST=$prefix/var it
  71. # changes this to /var for storing the logs and pidfile
  72. # used in source dir only, the install goes to $share_dest/doc/privoxy
  73. DOK_WEB = doc/webserver/
  74. # Install usage should be compatible with install-sh.
  75. INSTALL = @INSTALL@
  76. # Binaries
  77. BIN_MODE = 0755
  78. # Support files, docs, etc.
  79. RA_MODE = 0644
  80. # Directory
  81. DIR_MODE = 0755
  82. # Files daemon writes to.
  83. RWD_MODE = 0660
  84. INSTALL_P = -m $(BIN_MODE)
  85. INSTALL_T = -m $(RA_MODE)
  86. INSTALL_D = -m $(DIR_MODE) -d
  87. INSTALL_R = -m $(RWD_MODE)
  88. # install options for superuser install
  89. #INSTALL_S = -g @GROUP@ -o @USER@
  90. #############################################################################
  91. # Build tools
  92. #############################################################################
  93. PROGRAM = privoxy@EXEEXT@
  94. CC = @CC@
  95. ECHO = echo
  96. GZIP_PROG = gzip
  97. # id -u is not universal. FIXME: need to set from configure. Breaks on
  98. # Solaris.
  99. #ID = id -u
  100. ID = id
  101. LD = @CC@
  102. RM = rm -f
  103. CP = cp -f
  104. RMDIR = rmdir
  105. MKDIR = ./mkinstalldirs
  106. STRIP_PROG = strip
  107. SED = sed
  108. GREP = grep
  109. CAT = cat
  110. MV = mv
  111. TAR = tar
  112. LN = ln
  113. TOUCH = touch
  114. KILL = kill
  115. CHMOD = chmod
  116. CHOWN = chown
  117. CHGRP = chgrp
  118. GROUPS = groups
  119. W3M_DUMP = @W3M@ -I ISO-8859 -O ASCII -dump
  120. W3M_DUMP_UTF8 = @W3M@ -I ISO-8859 -O UTF-8 -dump
  121. # docbook output is ISO-8859 (which is a superset of ascii)
  122. JADECAT = @JADECAT@
  123. JADEBIN = @JADEBIN@
  124. NSGMLS = @NSGMLS@
  125. DB = $(JADEBIN) $(JADECAT) -ihtml -t sgml -D.. -d ldp.dsl\#html
  126. DB_TXT = $(JADEBIN) $(JADECAT) -ihtml -t sgml -D.. -d ldp.dsl\#print
  127. # -d dsssl_spec
  128. # This specifies that dsssl_spec is the system identifier of the DSSSL specification to be used.
  129. # ldp.dsl#html : keep '&char;' strings as is
  130. # ldp.dsl#print : convert '&char;' strings to ISO-8859 equivalent
  131. # NOTE: '-d ldp.dsl\#whatever' _MUST_ be last and _MUST NOT_ have
  132. # a trailing space so that '$(DB)-notoc' or '$(DB_TXT)-notoc'
  133. # pulls in the correct dsl stylesheet
  134. DB2HTML = @DB2HTML@
  135. MAN2HTML = @MAN2HTML@
  136. G2H_CMD = groff -mandoc -Thtml
  137. TARGET_OS = @host@
  138. PERL = perl
  139. DOC_DIR = doc/source
  140. DOC_TMP = $(DOC_DIR)/tmp
  141. DOC_STATUS = @DOC_STATUS@
  142. TIDY = tidy -latin1 -q -modify -indent -wrap 120 --tidy-mark no --preserve-entities yes \
  143. --mute MISSING_ATTRIBUTE --mute TRIM_EMPTY_ELEMENT
  144. # -latin1
  145. # use ISO-8859-1 for both input and output
  146. # docbook output is ISO-8859 and tidy assumes UTF-8
  147. # -q
  148. # suppress nonessential output
  149. # -modify
  150. # modify the original input file
  151. # --mute MISSING_ATTRIBUTE
  152. # don't show <img> lacks "alt" attribute
  153. # or <table> lacks "summary" attribute
  154. # --mute TRIM_EMPTY_ELEMENT
  155. # don't show trimming empty <p>
  156. #
  157. RSYNC = rsync -av -c --chmod=D755,F644
  158. # Program to do LF->CRLF
  159. DOSFILTER = $(PERL) -p -e 's/\n/\r\n/'
  160. CVSROOT = :pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa
  161. #TMPDIR := $(shell mktemp -d /tmp/$(PROGRAM).XXXXXX)
  162. # If your SF user name differs from your local one,
  163. # change this to "ssh -l sf-username"
  164. SSH = ssh
  165. WWW_ROOT = /home/project-web/ijbswa
  166. # SourceForge login name used by the 'sf-shell' target (optional)
  167. SOURCE_FORGE_NAME = ''
  168. #############################################################################
  169. # Setup for make distribution for now.
  170. #############################################################################
  171. TAR_ARCH = /tmp/privoxy-$(VERSION).tar.gz
  172. GEN_DIST_TAR_NAME = privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS).tar
  173. #############################################################################
  174. # We include these files in our distributions
  175. #############################################################################
  176. CONFIGS = config trust default.action match-all.action \
  177. user.action default.filter user.filter \
  178. regression-tests.action
  179. # take care that no CVS .cvsignore or other crappy files
  180. # are included here
  181. # and escape every '#' in the find. doh.
  182. CONFIG_FILES = $(CONFIGS) \
  183. `find templates/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS" | sort`
  184. DOC_FILES = AUTHORS LICENSE LICENSE.GPLv3 README ChangeLog INSTALL \
  185. `find doc/webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html" | sort` \
  186. `find doc/webserver/ -name "*.css" | sort` \
  187. $(MAN_PAGE)
  188. #############################################################################
  189. # Filenames and libraries
  190. #############################################################################
  191. C_SRC = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
  192. errlog.c filters.c gateway.c jbsockets.c jcc.c \
  193. list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
  194. urlmatch.c
  195. C_OBJS = $(C_SRC:.c=.@OBJEXT@)
  196. C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
  197. CLIENT_TAG_SRC = @FEATURE_CLIENT_TAGS_ONLY@client-tags.c
  198. CLIENT_TAG_OBJS = @FEATURE_CLIENT_TAGS_ONLY@client-tags.@OBJEXT@
  199. FUZZ_SRC = @FUZZ_ONLY@fuzz.c
  200. FUZZ_OBJS = @FUZZ_ONLY@fuzz.@OBJEXT@
  201. W32_SRC = @WIN_ONLY@w32log.c w32taskbar.c win32.c w32svrapi.c
  202. W32_FILES = @WIN_ONLY@w32.res
  203. W32_OBJS = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
  204. W32_HDRS = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h w32svrapi.h
  205. W32_LIB = @WIN_ONLY@-lwsock32 -lcomctl32
  206. W32_INIS = @WIN_ONLY@config.txt trust.txt
  207. SSL_SRC = @FEATURE_HTTPS_INSPECTION_ONLY@ssl_common.c
  208. SSL_OBJS = @FEATURE_HTTPS_INSPECTION_ONLY@$(SSL_SRC:.c=.o)
  209. SSL_HDRS = @FEATURE_HTTPS_INSPECTION_ONLY@$(SSL_SRC:.c=.h) project.h
  210. MBEDTLS_SRC = @FEATURE_HTTPS_INSPECTION_ONLY_MBEDTLS@ssl.c
  211. MBEDTLS_OBJS = @FEATURE_HTTPS_INSPECTION_ONLY_MBEDTLS@$(MBEDTLS_SRC:.c=.o)
  212. MBEDTLS_HDRS = @FEATURE_HTTPS_INSPECTION_ONLY_MBEDTLS@$(MBEDTLS_SRC:.c=.h)
  213. OPENSSL_SRC = @FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL@openssl.c
  214. OPENSSL_OBJS = @FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL@$(OPENSSL_SRC:.c=.o)
  215. OPENSSL_HDRS = @FEATURE_HTTPS_INSPECTION_ONLY_OPENSSL@$(OPENSSL_SRC:.c=.h)
  216. PCRS_SRC = @STATIC_PCRS_ONLY@pcrs.c
  217. PCRS_OBJS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
  218. PCRS_HDRS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
  219. PCRE_SRC = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
  220. PCRE_OBJS = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
  221. PCRE_HDRS = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
  222. # No REGEX (maybe because dynamically linked pcreposix):
  223. REGEX_SRC =
  224. @STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
  225. REGEX_OBJS = $(REGEX_SRC:.c=.@OBJEXT@)
  226. REGEX_HDRS = $(REGEX_SRC:.c=.h)
  227. # Dependencies introduced by #include "project.h".
  228. PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
  229. # Socket libraries for platforms that need them explicitly defined
  230. SOCKET_LIB = @SOCKET_LIB@
  231. # PThreads library, if needed.
  232. PTHREAD_LIB = @PTHREAD_ONLY@@PTHREAD_LIB@
  233. SRCS = $(C_SRC) $(CLIENT_TAG_SRC) $(FUZZ_SRC) $(W32_SRC) $(PCRS_SRC) $(PCRE_SRC) $(REGEX_SRC) $(SSL_SRC) $(MBEDTLS_SRC) $(OPENSSL_SRC)
  234. OBJS = $(C_OBJS) $(CLIENT_TAG_OBJS) $(FUZZ_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS) $(SSL_OBJS) $(MBEDTLS_OBJS) $(OPENSSL_OBJS)
  235. HDRS = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS) $(SSL_HDRS) $(MBEDTLS_HDRS) $(OPENSSL_HDRS)
  236. LIBS = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
  237. #############################################################################
  238. # Compiler switches
  239. #############################################################################
  240. # The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
  241. # The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
  242. # Win32 GUI build.
  243. # The flag "-pthread" is required if using Pthreads under Linux (and
  244. # possibly other OSs).
  245. SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
  246. # Add your flags here
  247. OTHER_CFLAGS =
  248. CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
  249. @STATIC_PCRE_ONLY@ -Ipcre
  250. LDFLAGS = @LDFLAGS@ $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
  251. #############################################################################
  252. # Build section.
  253. #
  254. # There should NOT be any targets above this line.
  255. #############################################################################
  256. all: $(PROGRAM) default.action
  257. #############################################################################
  258. # Phony targets
  259. #############################################################################
  260. .PHONY: all inifiles \
  261. win-dist tarball-dist dok webserver clean clobber tags \
  262. install CONF_DEST LOG_DEST \
  263. PID_DEST check_doc install-strip uninstall GROUP_T
  264. #############################################################################
  265. # Define this explicitly because Solaris is broken!
  266. #############################################################################
  267. %.o: %.c
  268. $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
  269. #############################################################################
  270. # Strip master copy comments from default.action:
  271. #############################################################################
  272. default.action: default.action.master
  273. $(GREP) -v '^#MASTER#' default.action.master > $@
  274. #############################################################################
  275. # Win32 config files
  276. #############################################################################
  277. inifiles: $(W32_INIS)
  278. config.txt: config
  279. $(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
  280. -e 's!\logfile logfile!logfile privoxy.log!' \
  281. -e 's!#Win32-only: !!' \
  282. < $< | \
  283. $(DOSFILTER) > $@
  284. # LF to CRLF in default.action
  285. $(DOSFILTER) <default.action >default.action.txt && mv default.action.txt default.action
  286. # LF to CRLF in default.filter
  287. $(DOSFILTER) <default.filter >default.filter.txt && mv default.filter.txt default.filter
  288. trust.txt: trust
  289. $(DOSFILTER) < $< > $@
  290. #############################################################################
  291. # Pre-dist check:
  292. #############################################################################
  293. dist-check:
  294. @if [ -d CVS ]; then \
  295. $(ECHO) "***************************************************"; \
  296. $(ECHO) "*** ***"; \
  297. $(ECHO) "*** WARNING ***"; \
  298. $(ECHO) "*** ***"; \
  299. $(ECHO) "*** The presence of a CVS subdirectory suggests ***"; \
  300. $(ECHO) "*** that you are trying to build a distribution ***"; \
  301. $(ECHO) "*** package based on a checked out, not an ***"; \
  302. $(ECHO) "*** exported copy of the source tree. Please ***"; \
  303. $(ECHO) "*** see \"Releasing a new version\" in the ***"; \
  304. $(ECHO) "*** developer manual. ***"; \
  305. $(ECHO) "*** ***"; \
  306. $(ECHO) "***************************************************"; \
  307. $(ECHO) "Type \"yes i am sure\" if you are sure that you"; \
  308. $(ECHO) -n "really want to proceed: "; \
  309. read answer; \
  310. if [ "$$answer" != "yes i am sure" ]; then exit 1; fi \
  311. fi;
  312. #############################################################################
  313. # create tar.gz from CVS:
  314. # This make-target is usually called through 'create-archive'. If you
  315. # run 'make create-snapshot' without setting SNAPVERSION, you'll get a
  316. # tar.gz with the current date in the name.
  317. # The main usage is to run it as follows (Red Hat example):
  318. # make SNAPVERSION=1.6x create-snapshot
  319. # This creates a tar.gz.
  320. #############################################################################
  321. create-snapshot:
  322. @tag=`cvs -d $(CVSROOT) status Makefile | awk ' /Sticky Tag/ { print $$3 } '` 2> /dev/null; \
  323. [ x"$$tag" = x"(none)" ] && tag=HEAD; \
  324. echo "*** Creating package from $$tag!"; \
  325. TMPDIR=$(shell mktemp -d /tmp/$(PROGRAM).XXXXXX); \
  326. cd $$TMPDIR ; cvs -Q -d $(CVSROOT) export -r $$tag current || echo "Um... export aborted."; \
  327. cd $$TMPDIR/current; \
  328. $(TAR) --exclude ".cvsignore" --exclude "CVS" \
  329. -czf /tmp/$(PROGRAM)-$(VERSION).tar.gz .; \
  330. $(RM) -rf $$TMPDIR
  331. @echo "Resulting file is /tmp/$(PROGRAM)-$(VERSION).tar.gz"
  332. #############################################################################
  333. # looks at the version of Makefile and exports a corresponding source-tree
  334. # example: if the Makefile has the sticky tag v_2_9_13, you'll get
  335. # privoxy-*-2.4.13.tar.gz.
  336. #############################################################################
  337. create-archive:
  338. make SNAPVERSION=$(SNAPVERSION) create-snapshot
  339. #############################################################################
  340. # generic distribution
  341. #############################################################################
  342. gen-dist: dist-check
  343. @$(ECHO) ""
  344. @$(ECHO) "You have run autoconf && autoheader && ./configure right?"
  345. @$(ECHO) ""
  346. $(MAKE) $(PROGRAM)
  347. $(STRIP_PROG) $(PROGRAM)
  348. $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
  349. # add program
  350. (cd .. && $(TAR) --exclude "PACKAGERS" -cvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$(PROGRAM))
  351. # add config files
  352. for foo in $(CONFIG_FILES); do \
  353. (cd .. && $(TAR) --exclude "PACKAGERS" -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
  354. done;
  355. # add documentation
  356. for foo in $(DOC_FILES); do \
  357. (cd .. && $(TAR) --exclude "PACKAGERS" -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
  358. done;
  359. # add tools
  360. (cd .. && $(TAR) -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/tools)
  361. # and zip the archive
  362. $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
  363. $(GZIP_PROG) ../$(GEN_DIST_TAR_NAME)
  364. @$(ECHO) Distribution with binary created.
  365. # anonymously ncftps the package to sourceforge
  366. gen-upload:
  367. ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../$(GEN_DIST_TAR_NAME).gz
  368. @$(ECHO) -------------------------------------------------------
  369. @$(ECHO) Now goto
  370. @$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
  371. @$(ECHO) ... and release the files.
  372. @$(ECHO) -------------------------------------------------------
  373. # use with care
  374. gen-clean:
  375. $(RM) ../$(GEN_DIST_TAR_NAME)*
  376. #############################################################################
  377. # Tarball distribution: No CVS dirs, dotfiles, debian build dir,
  378. # (FIXME:) only parts of the static / generated docs mix in doc/webserver
  379. #############################################################################
  380. tarball-dist: dist-check clean clobber
  381. $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
  382. for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
  383. -o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
  384. -name "PACKAGERS" -o -path "*.git/*" \) | sort`; do \
  385. files="$$files privoxy-$(VERSION)-$(CODE_STATUS)/$$i"; \
  386. done && \
  387. cd .. && $(TAR) -cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar $$files ; \
  388. # and zip the archive
  389. $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
  390. $(GZIP_PROG) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
  391. @$(ECHO) Tarball distribution created.
  392. # Create a mtree spec file that can be used to get a reproducible tar ball
  393. mtree-spec:
  394. $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
  395. $(ECHO) "#mtree 2.0" > $(MTREE_SPEC_FILE)
  396. for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
  397. -o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
  398. -name "PACKAGERS" -o -path "*.git/*" -o -name "*.spec" \) | env -i sort`; do \
  399. $(ECHO) "privoxy-$(VERSION)-$(CODE_STATUS)/$$i time=$(SOURCE_DATE_EPOCH) type=file uname=privoxy gname=privoxy mode=0555"; \
  400. done >> $(MTREE_SPEC_FILE)
  401. $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
  402. # Create a reproducible tarball.
  403. # Requires a tar implementation with mtree support.
  404. reproducible-tarball-dist: dist-check clean clobber mtree-spec
  405. $(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
  406. $(TAR) cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar -C .. @privoxy-$(VERSION)-$(CODE_STATUS)/$(MTREE_SPEC_FILE)
  407. $(GZIP_PROG) -n privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
  408. $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS) $(MTREE_SPEC_FILE)
  409. @$(ECHO) Reproducible tarball distribution created.
  410. # anonymously ncftps the tarball to sourceforge
  411. tarball-upload:
  412. ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
  413. @$(ECHO) -------------------------------------------------------
  414. @$(ECHO) Now goto
  415. @$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
  416. @$(ECHO) ... and release the files.
  417. @$(ECHO) -------------------------------------------------------
  418. tarball-clean:
  419. $(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
  420. #############################################################################
  421. #
  422. # Documentation
  423. #
  424. # converts doc/source/*.sgml into html and man pages
  425. #
  426. #############################################################################
  427. # developer manual
  428. dok-devel:
  429. $(RM) doc/webserver/developer-manual/*.html
  430. $(RM) -r doc/source/developer-manual
  431. mkdir -p doc/source/developer-manual
  432. cd doc/source/developer-manual && $(DB) ../developer-manual.sgml && cd .. && cp developer-manual/*.html ../webserver/developer-manual/
  433. # user manual
  434. dok-user:
  435. $(RM) doc/webserver/user-manual/*.html
  436. $(RM) -r doc/source/user-manual/
  437. mkdir -p doc/source/user-manual
  438. cd doc/source/user-manual && $(DB) -iuser-man ../user-manual.sgml && cd .. && cp user-manual/*.html ../webserver/user-manual/
  439. # FIXME: temp fix so same stylesheet gets in more than one place so it works
  440. # for all doc set-ups, including the 'user manual' config option in local
  441. # system where it MUST be in same directory as html.
  442. $(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 && \
  443. rm doc/webserver/user-manual/*html.bak
  444. # faq
  445. dok-faq:
  446. $(RM) doc/webserver/faq/*.html
  447. $(RM) -r doc/source/faq
  448. mkdir -p doc/source/faq
  449. cd doc/source/faq && $(DB) ../faq.sgml && cd .. && cp faq/*.html ../webserver/faq/
  450. # man page, one variation. Try to use the next target, just 'make man'.
  451. dok-man:
  452. $(RM) doc/man/* doc/webserver/man-page/*.html
  453. echo MAN2HTML is $(MAN2HTML)
  454. @if [ $(MAN2HTML) != "false" ]; then \
  455. $(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; \
  456. man ./$(MAN_PAGE) | $(MAN2HTML) -bare >> doc/webserver/man-page/privoxy-man-page.html; \
  457. $(ECHO) "</body></html>" >> doc/webserver/man-page/privoxy-man-page.html; \
  458. else \
  459. $(MAKE) groff2html; \
  460. fi;
  461. # Build man page from sgml. This requires the SGMLSpm perl module.
  462. # See CPAN, or your favorite perl repository. This is the preferred
  463. # target for man page generation!
  464. man: dok-release
  465. mkdir -p doc/source/temp && cd doc/source/temp && $(RM) * ;\
  466. $(NSGMLS) ../privoxy-man-page.sgml | sgmlspl ../../../utils/docbook2man/docbook2man-spec.pl &&\
  467. perl -pi.bak -e 's/ <URL:.*>//; s/\[ /\[/g' $(MAN_PAGE) ;\
  468. perl -pi.bak -e "s/\[ /\[/g;s/á/\\\\['a]/g;s/é/\\\\['e]/g" $(MAN_PAGE); \
  469. perl -pi.bak -e "s/ö/\\\\[:o]/g" $(MAN_PAGE); \
  470. perl -pi.bak -e 's/([ {])-([a-z])/$$1\\-$$2/g' $(MAN_PAGE); \
  471. perl -pi.bak -e 's/ --([a-z])/ \\-\\-$$1/g' $(MAN_PAGE); \
  472. perl -pi.bak -e 's/\\fB--/\\fB\\-\\-/g' $(MAN_PAGE); \
  473. $(DB) ../privoxy-man-page.sgml && $(MV) -f $(MAN_PAGE) ../../../$(MAN_PAGE)
  474. # For those with man2html ala RH7s.
  475. man2html:
  476. mkdir -p doc/webserver/man-page
  477. @if [ $(MAN2HTML) != "false" ]; then \
  478. $(MAN2HTML) $(MAN_PAGE) |grep -v "^Content-type" > tmp.html; \
  479. $(PERL) -pi.bak -e 's/<A .*Contents<\/A>//; s/<A .*man2html<\/A>/man2html/' tmp.html; \
  480. $(PERL) -pi.bak -e 's/(<\/HEAD>)/<LINK REL=\"STYLESHEET\" TYPE=\"text\/css\" HREF=\"..\/p_doc.css\"><\/HEAD>/' tmp.html; \
  481. $(PERL) -pi.bak -e 's/(<A.*),(">)/$$1$$2/g' tmp.html; \
  482. $(PERL) -pi.bak -e 's,\.">,">,g' tmp.html; \
  483. $(PERL) -pi.bak -e "s/\['a\]/\&aacute;/g;s/\['e\]/\&eacute;/g" tmp.html; \
  484. $(SED) -e 's///g' tmp.html > doc/webserver/man-page/privoxy-man-page.html && $(RM) tmp.*; \
  485. else \
  486. $(MAKE) groff2html; \
  487. fi;
  488. # Otherwise we get plain groff conversion.
  489. groff2html:
  490. $(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
  491. # readme page and INSTALL file
  492. dok-readme: dok-release
  493. cd doc/source && $(DB_TXT)-notoc -V nochunks readme.sgml > tmp.html &&\
  494. $(W3M_DUMP) tmp.html > ../../README ;\
  495. $(DB_TXT)-notoc -V nochunks install.sgml > tmp.html &&\
  496. $(W3M_DUMP) tmp.html > ../../INSTALL ;\
  497. $(RM) tmp.*
  498. # index.sgml is used to create both the Home Page, and a local index
  499. # for documentation, etc.
  500. #
  501. # index.html for webserver:
  502. dok-webserver:
  503. cd doc/source/webserver && $(DB)-notoc -ip-homepage -V nochunks index.sgml > ../../webserver/index.html
  504. $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
  505. s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps users to protect their privacy.\"><\/HEAD/;\
  506. s/\.\d\. //;\
  507. s/__copy/&copy;/;\
  508. s@(<SUB)@<p style="text-align: center">\1@; s@(</SUB)@\1></p@' \
  509. doc/webserver/index.html && $(RM) doc/webserver/*.bak
  510. # privoxy-index.html for local documentation:
  511. dok-index:
  512. cd doc/source/webserver && $(DB)-notoc -ip-index -V nochunks index.sgml > ../../webserver/privoxy-index.html
  513. $(PERL) -pi.bak -e 's/..\/p_doc.css/p_doc.css/;\
  514. s/<\/HEAD/\n<meta name=\"description\" content=\"Privoxy helps users to protect their privacy.\"><\/HEAD/;\
  515. s/\.\d\. //;\
  516. s/__copy/&copy;/' \
  517. doc/webserver/privoxy-index.html && $(RM) doc/webserver/*.bak
  518. # Main documentation target.
  519. dok: dok-release dok-devel dok-user dok-faq dok-readme dok-webserver dok-authors dok-index
  520. @$(ECHO) Documentation created.
  521. ## Make AUTHORS file
  522. dok-authors:
  523. cd doc/source && $(DB_TXT) -V nochunks authors.sgml > tmp.html && \
  524. $(W3M_DUMP_UTF8) tmp.html > ../../AUTHORS && $(RM) tmp.html
  525. # Set doc entities for VERSION and CODE_STATUS in sgml docs. Toggle content
  526. # exceptions accordingly. This needs to go before any doc building (doh).
  527. dok-release:
  528. @$(ECHO) Setting doc version and status to $(VERSION), $(CODE_STATUS)
  529. @$(PERL) -pi.bak -e 's/<!entity +p-version.*>/<!entity p-version "$(VERSION)">/;\
  530. s/<!entity +p-status.*>/<!entity p-status "$(CODE_STATUS)">/' \
  531. doc/source/*sgml doc/source/*/*sgml
  532. $(RM) -r doc/source/*bak doc/source/*/*bak
  533. @if [ $(CODE_STATUS) = "stable" ]; then \
  534. $(ECHO) Setting docs to stable $(VERSION); \
  535. $(PERL) -pi.bak -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "INCLUDE">/;\
  536. s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "IGNORE">/' \
  537. doc/source/*sgml doc/source/*/*sgml; \
  538. else \
  539. $(ECHO) Setting docs to not stable $(VERSION); \
  540. $(PERL) -pi.bak -e 's/<!entity +% +p-stable.*>/<!entity % p-stable "IGNORE">/; \
  541. s/<!entity +% +p-not-stable.*>/<!entity % p-not-stable "INCLUDE">/' \
  542. doc/source/*sgml doc/source/*/*sgml; \
  543. fi;
  544. $(RM) -r doc/source/*bak doc/source/*/*bak;
  545. # The main Privoxy config file, generated from sgml sources.
  546. # NOTE: This will require some hand editing.
  547. config-file: dok-release generate-config-file
  548. $(RM) config.bak config.html
  549. @$(ECHO) "****************************************************"
  550. @$(ECHO) "The config file has been optimistically updated"
  551. @$(ECHO) "Now -- you may need to hand edit the results!"
  552. @$(ECHO) "In particular, check the Debug levels, the"
  553. @$(ECHO) "permit-access, forward & socks examples and the"
  554. @$(ECHO) "various user-manual examples, which all"
  555. @$(ECHO) "might have gotten hammered."
  556. @$(ECHO) "****************************************************"
  557. generate-config-file:
  558. cd doc/source && $(DB_TXT)-notoc -iconfig-file -V nochunks config.sgml > ../../config.html
  559. $(W3M_DUMP) -cols 67 config.html > config
  560. $(PERL) -i.bak utils/prepare-configfile.pl config
  561. #############################################################################
  562. #
  563. # Webserver
  564. #
  565. # moves documentation to webserver
  566. #
  567. #############################################################################
  568. sf-shell:
  569. @sf_name=$(SOURCE_FORGE_NAME); \
  570. [ -n "$${sf_name}" ] || read -p "Enter SourceForge username: " sf_name || exit 1; \
  571. echo "Opening shell for $${sf_name} ..."; \
  572. ssh -t $${sf_name},ijbswa@shell.sourceforge.net create
  573. webserver: clean-editor-files
  574. @$(ECHO) -------------------------------------------------------
  575. @$(ECHO) You will need to "create" a SF shell first:
  576. @$(ECHO) ssh -t SF-USER-ID,ijbswa@shell.sourceforge.net create
  577. @$(ECHO) Please make sure your documentation files are up to date.
  578. @$(ECHO) Note that this command updates the home page and copys
  579. @$(ECHO) all stuff to the webserver, it will not remove obsolete documents.
  580. @$(ECHO) Note that a botched upload can result in the documentation
  581. @$(ECHO) on the website becoming unreachable! Also the CSS files
  582. @$(ECHO) currently seem to end up at the wrong place.
  583. @$(ECHO) -------------------------------------------------------
  584. @$(ECHO) Replacing the user-manual symlink
  585. @$(SSH) shell.sourceforge.net "cd $(WWW_ROOT)/htdocs && rm user-manual \
  586. && mkdir -p $(VERSION)/user-manual && ln -s $(VERSION)/user-manual user-manual"
  587. @$(ECHO) Uploading html
  588. @cd doc/webserver; \
  589. upload=`find . -type f -a -not \( -path "*/CVS*" -o -path "*/results*" \)`; \
  590. $(TAR) cf - $$upload | $(SSH) shell.sourceforge.net 'cd $(WWW_ROOT)/htdocs/; tar xvm 2>&1 | grep -v timestamp'
  591. web-actions:
  592. @$(ECHO) Updating the actions on the webserver ...
  593. @$(RSYNC) doc/webserver/actions/*.php shell.sourceforge.net:$(WWW_ROOT)/htdocs/actions
  594. web-homepage:
  595. @$(ECHO) "Updating the home page (index.html) only (be careful in case of version changes) ..."
  596. @$(RSYNC) doc/webserver/index.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/
  597. web-faq:
  598. @$(ECHO) Updating the FAQ on the webserver ...
  599. @$(RSYNC) doc/webserver/faq/*.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/faq
  600. web-sponsors:
  601. @$(ECHO) "Updating the sponsor page (index.html) only ..."
  602. @$(RSYNC) doc/webserver/sponsors/index.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/sponsors/
  603. web-user-manual:
  604. @$(ECHO) Updating the user manual on the webserver (do not use in case of version changes) ...
  605. @$(RSYNC) doc/webserver/user-manual/*.html shell.sourceforge.net:$(WWW_ROOT)/htdocs/user-manual/
  606. #############################################################################
  607. #
  608. # Try to clean up the generated HTML files.
  609. #
  610. # The files are such a mess that some of them require two tidy runs in a
  611. # row as the first one aborts prematurely. The vanilla tidy output renders
  612. # poorly because it contains a bit too much whitespace, so we additionally
  613. # run the files through perl to fix this again.
  614. #
  615. #############################################################################
  616. dok-tidy:
  617. for html_file in `find doc/webserver -name "*.html"`; do \
  618. $(ECHO) "------ begin processing $$html_file" >&2 ; \
  619. $(TIDY) $$html_file || $(TIDY) $$html_file; \
  620. $(PERL) -i'' -e 's@^\s*<br>\s*$$@@; s@ +$$@@;' -n -p $$html_file; \
  621. done
  622. #############################################################################
  623. # Source file dependencies
  624. #############################################################################
  625. 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
  626. 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
  627. 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
  628. 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
  629. deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
  630. encode.@OBJEXT@: encode.c encode.h config.h
  631. errlog.@OBJEXT@: errlog.c errlog.h config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
  632. 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
  633. gateway.@OBJEXT@: gateway.c gateway.h config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
  634. jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
  635. 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
  636. list.@OBJEXT@: list.c list.h config.h $(PROJECT_H_DEPS) list.h miscutil.h
  637. 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
  638. 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
  639. miscutil.@OBJEXT@: miscutil.c miscutil.h config.h
  640. 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
  641. ssplit.@OBJEXT@: ssplit.c ssplit.h config.h miscutil.h
  642. urlmatch.@OBJEXT@: urlmatch.c urlmatch.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
  643. client-tags.@OBJEXT@: client-tags.c client-tags.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
  644. fuzz.@OBJEXT@: fuzz.c config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
  645. ssl.@OBJEXT@: ssl.c ssl.h ssl_common.h config.h $(PROJECT_H_DEPS) encode.h errlog.h jcc.h miscutil.h
  646. openssl.@OBJEXT@: openssl.c ssl.h ssl_common.h config.h $(PROJECT_H_DEPS) encode.h errlog.h jcc.h miscutil.h
  647. ssl_common.@OBJEXT@: ssl_common.c ssl.h ssl_common.h config.h $(PROJECT_H_DEPS) errlog.h miscutil.h
  648. # GNU regex
  649. gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
  650. # PCRS
  651. pcrs.@OBJEXT@: pcrs.c pcrs.h config.h @STATIC_PCRE_ONLY@pcre/pcre.h
  652. # PCRE
  653. pcre/get.@OBJEXT@: pcre/get.c pcre/config.h pcre/internal.h pcre/pcre.h
  654. pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
  655. pcre/pcre.@OBJEXT@: pcre/pcre.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c
  656. pcre/pcreposix.@OBJEXT@: pcre/pcreposix.c pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
  657. pcre/study.@OBJEXT@: pcre/study.c pcre/config.h pcre/internal.h pcre/pcre.h
  658. # An auxiliary program makes the PCRE default character table source
  659. pcre/chartables.c: pcre/dftables@EXEEXT@
  660. pcre/dftables@EXEEXT@ >pcre/chartables.c
  661. pcre/dftables@EXEEXT@: pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
  662. $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
  663. # Win32
  664. 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
  665. w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
  666. 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
  667. 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
  668. windres -F pe-i386 -D__MINGW32__=0.2 -O coff -i $< -o $@
  669. $(PROGRAM): $(OBJS) $(W32_FILES)
  670. $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
  671. clean:
  672. $(RM) a.out $(OBJS) $(W32_FILES) $(W32_INIS) $(PROGRAM) default.action \
  673. config.base config.tmp \
  674. `find . \( -name TAGS -o -name tags \) -a -not -path "./.git/*"` \
  675. `find . -name "*.orig" -a -not -name rc.privoxy.orig -a -not -path "./.git/*"`
  676. clean-editor-files:
  677. $(RM) `find . -name "*~"`
  678. $(RM) `find . -name "#*#"` # Emacs backup files
  679. $(RM) `find . -name ".\#*"`
  680. clobber: clean-editor-files
  681. $(RM) GNUmakefile configure config.h.in config.h config.cache config.status config.log logfile \
  682. privoxy.log core *.tar.gz *.tar privoxy-cl.spec doc/source/ldp.dsl config.new
  683. $(RM) -r autom4te.cache
  684. #
  685. # FIXME: What is all this?
  686. #
  687. $(RM) cscope.* *.pdb *.lib *.exp
  688. distclean: clobber
  689. tags: $(SRCS) $(HDRS)
  690. etags $(SRCS) $(HDRS)
  691. CONF_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(CONF_BASE)" = "$(prefix)/etc" ];then \
  692. $(ECHO) "$(CONF_BASE)/privoxy";\
  693. else\
  694. $(ECHO) "$(CONF_BASE)";\
  695. fi)
  696. LOG_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(LOGS_DEST)" = "$(prefix)/var/log/privoxy" ];then \
  697. $(ECHO) "/var/log/privoxy" ;\
  698. else\
  699. $(ECHO) "$(LOGS_DEST)";\
  700. fi)
  701. PID_DEST:=$(shell if [ "$(prefix)" = "/usr/local" ] && [ "$(PIDS_DEST)" = "$(prefix)/var/run" ];then \
  702. $(ECHO) "/var/run" ;\
  703. else\
  704. $(ECHO) "$(PIDS_DEST)";\
  705. fi)
  706. check_doc:=$(shell if [ ! -d "$(SHARE_DEST)/doc" ] && [ "$(prefix)" = "/usr/local" ] && [ -d "$(prefix)/doc" ];then \
  707. $(ECHO) "1";\
  708. else\
  709. $(ECHO) "0";\
  710. fi)
  711. # If USER is specified but no GROUP, assume there is a GROUP of same name.
  712. GROUP_T:=$(shell if [ x$(GROUP) = x ] && [ x$(USER) != x ];then \
  713. $(ECHO) "$(USER)" ;\
  714. else\
  715. $(ECHO) "$(GROUP)";\
  716. fi)
  717. install-strip:
  718. $(MAKE) install STRIP=-s
  719. # FIXME: Test USER and GROUP on Slack to make sure this works as
  720. # intended.
  721. #
  722. # FIXME: id handling needs help, probably via configure, since 'id -u' is not
  723. # universally reliable (eg Solaris). Group handling could be better.
  724. # Perhaps the whole user/group validation should be done here, and simplified.
  725. PROGRAM_V = Privoxy $(VERSION) $(CODE_STATUS)
  726. install: CONF_DEST LOG_DEST PID_DEST check_doc GROUP_T
  727. @# Quick test for valid USER.
  728. @if [ -n "$(USER)" ]; then \
  729. $(ID) $(USER) >/dev/null || exit 1;\
  730. fi
  731. @# Test for valid group. FIXME. USER does not have to belong to GROUP
  732. @# for file ownership purposes.
  733. # if [ -n "$(GROUP_T)" ] && [ -n "$(USER)" ] && ! $(GROUPS) $(USER) | $(GREP) "\<$(GROUP_T)\>" >/dev/null; then \
  734. # $(ECHO) Group $(GROUP_T) for User $(USER) is invalid && exit 1 ;\
  735. # fi
  736. @$(ECHO) "Creating directories, and preparing $(PROGRAM_V) installation"
  737. $(CHMOD) $(DIR_MODE) $(MKDIR)
  738. @$(MKDIR) $(DESTDIR)$(SBIN_DEST) $(DESTDIR)$(prefix) $(DESTDIR)$(CONF_DEST) \
  739. $(DESTDIR)$(CONF_DEST)/templates $(DESTDIR)$(SHARE_DEST) \
  740. $(DESTDIR)$(LOG_DEST) $(DESTDIR)$(PID_DEST)
  741. @# Install the executable binary, strip if invoked as install-strip
  742. @test -n "$(STRIP)" &&\
  743. $(ECHO) Installing $(PROGRAM) stripped executable to $(SBIN_DEST) ||\
  744. $(ECHO) Installing $(PROGRAM) executable to $(DESTDIR)$(SBIN_DEST)
  745. $(INSTALL) $(INSTALL_P) $(STRIP) $(PROGRAM) $(DESTDIR)$(SBIN_DEST)
  746. @# Install the DOCS and man page. install-sh only does one file at a time.
  747. @# FIXME: only handles jpegs.
  748. -@if [ $(check_doc) = 0 ]; then \
  749. DOC=$(DOC_DEST) ;\
  750. else \
  751. DOC=$(prefix)/doc/privoxy ;\
  752. fi;\
  753. $(MKDIR) $(DESTDIR)$$DOC $(DESTDIR)$$DOC/user-manual $(DESTDIR)$$DOC/faq $(DESTDIR)$$DOC/developer-manual \
  754. $(DESTDIR)$$DOC/man-page $(DESTDIR)$$DOC/images $(DESTDIR)$(MAN_DEST) ;\
  755. if [ -d "$(DOK_WEB)" ]; then \
  756. $(ECHO) Installing FAQ, Manual, and other docs to $(DESTDIR)$$DOC;\
  757. for i in user-manual developer-manual faq; do \
  758. for ii in $(DOK_WEB)/$$i/*html; do \
  759. $(INSTALL) $(INSTALL_T) $$ii $(DESTDIR)$$DOC/$$i;\
  760. done ;\
  761. done ;\
  762. for i in $(DOK_WEB)/user-manual/*jpg; do \
  763. $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$$DOC/user-manual;\
  764. done ;\
  765. $(INSTALL) $(INSTALL_T) $(DOK_WEB)/man-page/*html $(DESTDIR)$$DOC/man-page;\
  766. $(INSTALL) $(INSTALL_T) $(DOK_WEB)/privoxy-index.html $(DESTDIR)$$DOC/index.html;\
  767. $(INSTALL) $(INSTALL_T) AUTHORS $(DESTDIR)$$DOC;\
  768. $(INSTALL) $(INSTALL_T) LICENSE $(DESTDIR)$$DOC;\
  769. $(INSTALL) $(INSTALL_T) LICENSE.GPLv3 $(DESTDIR)$$DOC;\
  770. $(INSTALL) $(INSTALL_T) README $(DESTDIR)$$DOC;\
  771. $(INSTALL) $(INSTALL_T) ChangeLog $(DESTDIR)$$DOC;\
  772. $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $(DESTDIR)$$DOC;\
  773. $(INSTALL) $(INSTALL_T) $(DOK_WEB)/p_doc.css $(DESTDIR)$$DOC/user-manual;\
  774. fi
  775. @# Not all platforms support gzipped man pages.
  776. @$(ECHO) Installing man page to $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)
  777. -$(INSTALL) $(INSTALL_T) $(MAN_PAGE) $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)
  778. @# Change the config file default directories according to the configured ones
  779. @$(ECHO) Rewriting config for this installation
  780. @if [ -f config.base ] ; then \
  781. $(CAT) config >config~ ;\
  782. $(MV) config.base config ;\
  783. fi
  784. $(SED) 's+^confdir \.+confdir $(CONF_DEST)+' config | \
  785. $(SED) 's+^logdir \.+logdir $(LOG_DEST)+' >config.tmp
  786. -@if [ $(check_doc) = 0 ]; then \
  787. $(SED) 's+^#\?user-manual .*+user-manual $(DOC_DEST)/user-manual/+' config.tmp >config.updated ;\
  788. else \
  789. $(SED) 's+^#\?user-manual .*+user-manual $(prefix)/doc/privoxy/user-manual/+' config.tmp >config.updated ;\
  790. fi;\
  791. $(MV) config config.base
  792. $(MV) config.updated config
  793. @# Install the config support files. Test for root install, and abort
  794. @# if there is no privoxy user, and no other user was enabled during
  795. @# configure. Later, install init script if appropriate.
  796. @$(ECHO) Installing templates to $(DESTDIR)$(CONF_DEST)/templates
  797. @for i in `find templates -type f`; do \
  798. $(INSTALL) $(INSTALL_T) $$i $(DESTDIR)$(CONF_DEST)/templates ;\
  799. done
  800. @# FIXME: group/user validation is overly convoluted.
  801. @# If superuser install ... we require a minimum of group ownership
  802. @# of those files the daemon writes to, to be non-root owned.
  803. @if [ "`$(ID) |sed 's/(.*//' |sed 's/.*=//'`" = "0" ] ;then\
  804. if [ x$(USER) = x ] || [ $(USER) = root ]; then \
  805. if [ x$(GROUP) = x ] || [ $(GROUP) = root ]; then \
  806. if [ "`$(ID) privoxy`" ] && \
  807. $(GROUPS) privoxy | $(SED) 's/^.*://' |$(GREP) "\<privoxy\>" >/dev/null; then \
  808. $(ECHO) "Warning: Setting group owner to privoxy";\
  809. GROUP_T=privoxy ;\
  810. else \
  811. $(ECHO) "******************************************************************" ;\
  812. $(ECHO) " WARNING! WARNING! installing config files as root!" ;\
  813. $(ECHO) " It is strongly recommended to run $(PROGRAM) as a non-root user," ;\
  814. $(ECHO) " and to install the config files as that user and/or group!" ;\
  815. $(ECHO) " Please read INSTALL, and create a privoxy user and group!" ;\
  816. $(ECHO) "*******************************************************************" ;\
  817. exit 1 ;\
  818. fi ;\
  819. else \
  820. GROUP_T=$(GROUP) ;\
  821. fi ;\
  822. INSTALL_CONF="$(INSTALL_R) -g $$GROUP_T " ;\
  823. else \
  824. $(ECHO) "Superuser install, installing config files as $(USER):$(GROUP_T)" ;\
  825. INSTALL_CONF="$(INSTALL_R) -o $(USER) -g $(GROUP_T)" ;\
  826. GROUP_T=$(GROUP_T) ;\
  827. fi ;\
  828. else \
  829. if [ ! "`id $(USER)`" = "`id`" ] ;then \
  830. $(ECHO) "** WARNING ** current install user different from configured user!!" ;\
  831. $(ECHO) "Edit may fail." ;\
  832. fi ;\
  833. INSTALL_CONF="$(INSTALL_R)" ;\
  834. fi ;\
  835. $(ECHO) Installing configuration files to $(DESTDIR)$(CONF_DEST);\
  836. for i in $(CONFIGS); do \
  837. if [ "$$i" = "default.action" ] || [ "$$i" = "default.filter" ] ; then \
  838. $(RM) $(DESTDIR)$(CONF_DEST)/$$i ;\
  839. $(ECHO) Installing fresh $$i;\
  840. $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST) || exit 1;\
  841. elif [ -s "$(CONF_DEST)/$$i" ]; then \
  842. $(ECHO) Installing $$i as $$i.new ;\
  843. $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST)/$$i.new || exit 1;\
  844. NEW=1;\
  845. else \
  846. $(INSTALL) $$INSTALL_CONF $$i $(DESTDIR)$(CONF_DEST) || exit 1;\
  847. fi ;\
  848. done ;\
  849. if [ -n "$$NEW" ]; then \
  850. $(CHMOD) $(RWD_MODE) $(DESTDIR)$(CONF_DEST)/*.new || exit 1 ;\
  851. $(ECHO) "Warning: Older config files are preserved. Check new versions for changes!" ;\
  852. fi ;\
  853. [ ! -f $(DESTDIR)$(LOG_DEST)/logfile ] && $(ECHO) Creating logfiles in $(DESTDIR)$(LOG_DEST) || \
  854. $(ECHO) Checking logfiles in $(DESTDIR)$(LOG_DEST) ;\
  855. $(TOUCH) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\
  856. if [ x$$USER != x ]; then \
  857. $(CHOWN) $$USER $(DESTDIR)$(LOG_DEST)/logfile || \
  858. $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\
  859. fi ;\
  860. if [ x$$GROUP_T != x ]; then \
  861. $(CHGRP) $$GROUP_T $(DESTDIR)$(LOG_DEST)/logfile || \
  862. $(ECHO) "** WARNING ** current install user different from configured user. Logging may fail!!" ;\
  863. fi ;\
  864. $(CHMOD) $(RWD_MODE) $(DESTDIR)$(LOG_DEST)/logfile || exit 1 ;\
  865. if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \
  866. if [ -f /etc/slackware-version ] && [ -d /etc/rc.d/ ] && [ -w /etc/rc.d/ ] ; then \
  867. $(SED) 's+%PROGRAM%+$(PROGRAM)+' slackware/rc.privoxy.orig | \
  868. $(SED) 's+%SBIN_DEST%+$(SBIN_DEST)+' | \
  869. $(SED) 's+%CONF_DEST%+$(CONF_DEST)+' | \
  870. $(SED) 's+%USER%+$(USER)+' | \
  871. $(SED) 's+%GROUP%+$(GROUP_T)+' >slackware/rc.privoxy ;\
  872. $(INSTALL) $(INSTALL_P) slackware/rc.privoxy $(DESTDIR)/etc/rc.d/ ;\
  873. $(ECHO) "Installing for Slackware." ;\
  874. $(ECHO) "Dont forget to add the rc.privoxy to rc.local if you want it started at every boot" ;\
  875. elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \
  876. $(ECHO) "Installing generic init script to $(DESTDIR)/etc/init.d/privoxy" ;\
  877. $(ECHO) "Please check that the PATHs are correct, and edit if needed." ;\
  878. $(INSTALL) $(INSTALL_P) privoxy-generic.init $(DESTDIR)/etc/init.d/privoxy ;\
  879. fi ;\
  880. else \
  881. $(ECHO) "No init script installed, install it manually if needed" ;\
  882. fi
  883. $(RM) config.base config.tmp
  884. @# mmmmm, good.
  885. @$(ECHO) "$(PROGRAM_V) installation succeeded!"
  886. @$(ECHO) "The Privoxy configuration files have been installed in $(DESTDIR)$(CONF_DEST)"
  887. # rmdir is used as a precaution since it will not remove non-empty
  888. # directories. RH init script creates lock file and pid file.
  889. uninstall: CONF_DEST LOG_DEST PID_DEST check_doc
  890. @$(ECHO) Starting Privoxy uninstallation
  891. @# KILL privoxy if running
  892. @# XXX: the chkconfig line may need a DESTDIR prefix.
  893. -@test -f $(DESTDIR)$(PID_DEST)/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\
  894. $(KILL) `$(CAT) $(DESTDIR)$(PID_DEST)/privoxy.pid` || :
  895. -@test -f $(DESTDIR)/var/run/privoxy.pid && $(ECHO) Stopping $(PROGRAM) &&\
  896. $(KILL) `$(CAT) $(DESTDIR)/var/run/privoxy.pid ` || :
  897. @# Program binary
  898. @$(ECHO) Removing $(PROGRAM) binary
  899. $(RM) $(DESTDIR)$(SBIN_DEST)/$(PROGRAM) $(SBIN_DEST)/$(PROGRAM)~
  900. @# config files and dir, and maybe old install backups
  901. -@if [ -d $(DESTDIR)$(CONF_DEST) ]; then \
  902. $(ECHO) Saving $(PROGRAM) config files to $(DESTDIR)/tmp/$(PROGRAM)-save ;\
  903. $(MKDIR) $(DESTDIR)/tmp/$(PROGRAM)-save ;\
  904. cd $(DESTDIR)$(CONF_DEST) ;\
  905. for i in $(DESTDIR)$(CONFIGS); do \
  906. [ -f $$i ] && $(CP) $$i $(DESTDIR)/tmp/$(PROGRAM)-save ;\
  907. done ;\
  908. fi
  909. @$(ECHO) Removing $(PROGRAM) config files
  910. -@for i in $(DESTDIR)$(CONFIGS); do \
  911. test -f $(CONF_DEST)/$$i && $(ECHO) Removing $$i ;\
  912. $(RM) $(DESTDIR)$(CONF_DEST)/$$i $(DESTDIR)$(CONF_DEST)/$$i~ $(DESTDIR)$(CONF_DEST)/$$i.new ;\
  913. done
  914. -@test -d $(DESTDIR)$(CONF_DEST)/templates && $(RM) -r $(DESTDIR)$(CONF_DEST)/templates &&\
  915. $(ECHO) "Removing $(DESTDIR)$(CONF_DEST)/templates/*"
  916. @# man page and docs
  917. @$(ECHO) Removing $(PROGRAM) docs
  918. -$(RM) $(DESTDIR)$(MAN_DEST)/$(MAN_PAGE)*
  919. -$(RM) -r $(DESTDIR)$(DOC_DEST) || $(RM) -r $(DESTDIR)$(prefix)/doc/privoxy
  920. @# Log and pidfile
  921. @$(ECHO) Removing $(PROGRAM) logs
  922. -$(RM) $(DESTDIR)$(LOG_DEST)/logfile $(DESTDIR)$(PID_DEST)/privoxy.pid
  923. @# Final clean up of unused directories. Special handling of CONF and LOG
  924. # destinations.
  925. @$(ECHO) Removing $(PROGRAM) directories
  926. @for i in $(DESTDIR)$(LOG_DEST) $(DESTDIR)$(CONF_DEST); do \
  927. if test -d $$i; then \
  928. $(ECHO) Removing $$i ;\
  929. $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\
  930. fi;\
  931. done
  932. @if [ ! "$(prefix)" = "/usr/local" ] ;then \
  933. for i in $(DESTDIR)$(MAN_DEST) $(DESTDIR)$(MAN_DIR) $(DESTDIR)$(SHARE_DEST)/doc \
  934. $(DESTDIR)$(SHARE_DEST) $(DESTDIR)$(SBIN_DEST); do \
  935. if test -d $$i; then \
  936. $(ECHO) Removing $$i ;\
  937. $(RMDIR) $$i || $(ECHO) "$$i is not empty, not removed" ;\
  938. fi;\
  939. done;\
  940. if test $(LOG_DEST) != /var/log/privoxy && test -d $(DESTDIR)$(prefix)/var/log; then \
  941. $(ECHO) Removing $(DESTDIR)$(prefix)/var/log ;\
  942. $(RMDIR) $(DESTDIR)$(prefix)/var/log || $(ECHO) "$(DESTDIR)$(prefix)/var/log is not empty, not removed";\
  943. fi ;\
  944. if test $(PID_DEST) != /var/run && test -d $(DESTDIR)$(prefix)/var/run; then \
  945. $(ECHO) Removing $(DESTDIR)$(prefix)/var/run ;\
  946. $(RMDIR) $(DESTDIR)$(prefix)/var/run || $(ECHO) "$(DESTDIR)$(prefix)/var/run is not empty, not removed";\
  947. fi ;\
  948. if test $(prefix)/var != /var && test -d $(DESTDIR)$(prefix)/var; then \
  949. $(ECHO) Removing $(DESTDIR)$(prefix)/var ;\
  950. $(RMDIR) $(DESTDIR)$(prefix)/var || $(ECHO) "$(DESTDIR)$(prefix)/var is not empty, not removed" ;\
  951. fi ;\
  952. if test $(prefix) != / && test $(prefix) != /usr && test -d $(DESTDIR)$(prefix); then \
  953. $(ECHO) Removing $(DESTDIR)$(prefix) ;\
  954. $(ECHO) Removing installation directory $(DESTDIR)$(prefix) ;\
  955. $(RMDIR) $(DESTDIR)$(prefix) || $(ECHO) "$(DESTDIR)$(prefix) is not empty, not removed" ;\
  956. fi;\
  957. fi
  958. @# init scripts
  959. @if [ "$(prefix)" = "/usr/local" ] || [ "$(prefix)" = "/usr" ]; then \
  960. $(ECHO) Removing $(PROGRAM) init script ;\
  961. if [ -f $(DESTDIR)/etc/slackware-version ] && \
  962. [ -d $(DESTDIR)/etc/rc.d/ ] && [ -w $(DESTDIR)/etc/rc.d/ ] ; then \
  963. $(RM) $(DESTDIR)/etc/rc.d/rc.privoxy ;\
  964. elif [ -d $(DESTDIR)/etc/init.d ] && [ -w $(DESTDIR)/etc/init.d ] ; then \
  965. $(RM) $(DESTDIR)/etc/init.d/privoxy ;\
  966. else \
  967. $(ECHO) "Unable to remove privoxy init script, not installed or permission denied" ;\
  968. fi ;\
  969. fi
  970. @$(ECHO) Privoxy uninstalled, bye
  971. coffee:
  972. @perl -e 'print pack "C*", (31,139,8,8,153,63,226,60,2,3,99,111,102,102,101,' \
  973. -e '101,0,109,143,205,13,192,32,8,133,239,78,241,110,234,1,28,160,171,' \
  974. -e '152,208,53,26,117,247,22,165,73,137,125,9,1,62,126,2,128,169,5,243,' \
  975. -e '143,13,139,49,164,65,100,149,152,102,73,141,88,73,178,116,205,100,' \
  976. -e '69,253,36,102,81,49,83,236,19,225,171,131,214,172,163,73,4,168,123,' \
  977. -e '115,71,126,247,122,94,128,178,227,95,154,12,86,215,122,197,249,146,' \
  978. -e '187,54,220,125,193,51,228,11,1,0,0);' | zcat