# Note: GNUmakefile is built automatically from GNUmakefile.in
#
# $Id: GNUmakefile.in,v 1.250 2016/05/08 12:46:05 fabiankeil Exp $
#
# Written by and Copyright (C) 2001-2016 members of the
# Privoxy team. https://www.privoxy.org/
#
# Based on the Internet Junkbuster originally written
# by and Copyright (C) 1997 Anonymous Coders and
# Junkbusters Corporation. http://www.junkbusters.com
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# The GNU General Public License should be included with
# this file. If not, you can view it at
# http://www.gnu.org/copyleft/gpl.html
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#############################################################################
# Set make command correctly
#############################################################################
@SET_MAKE@
#############################################################################
# Version number (for RPM)
#############################################################################
VERSION_MAJOR = @VERSION_MAJOR@
VERSION_MINOR = @VERSION_MINOR@
VERSION_POINT = @VERSION_POINT@
CODE_STATUS = @CODE_STATUS@
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
SNAPVERSION = $(VERSION)-$(shell date "+%Y%m%d")
#############################################################################
# "make install" directories and variables
#############################################################################
#User Group paras
USER = @USER@
GROUP = @GROUP@
datarootdir = @datarootdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
CONF_BASE = @sysconfdir@
SBIN_DEST = @sbindir@
MAN_DIR = @mandir@
MAN_DEST = $(MAN_DIR)/man1
MAN_PAGE = privoxy.1
SHARE_DEST = @datadir@
DOC_DEST = $(SHARE_DEST)/doc/privoxy
VAR_DEST = @localstatedir@
LOGS_DEST = $(VAR_DEST)/log/privoxy
PIDS_DEST = $(VAR_DEST)/run
# if $prefix = /usr/local then the default CONFDEST change from
# CONF_DEST = $(CONF_BASE) to CONF_DEST = $(CONF_BASE)/privoxy
# by the target rule CONF_DEST
#
# also if the $prefix is /usr/local and there is no
# $(SHARE_DEST)/doc, it checks for $prefix/doc and installs there
# instead in this situation
#
# finally if $prefix=/usr/local and VAR_DEST=$prefix/var it
# changes this to /var for storing the logs and pidfile
# used in source dir only, the install goes to $share_dest/doc/privoxy
DOK_WEB = doc/webserver/
# Install usage should be compatible with install-sh.
INSTALL = @INSTALL@
# Binaries
BIN_MODE = 0755
# Support files, docs, etc.
RA_MODE = 0644
# Directory
DIR_MODE = 0755
# Files daemon writes to.
RWD_MODE = 0660
INSTALL_P = -m $(BIN_MODE)
INSTALL_T = -m $(RA_MODE)
INSTALL_D = -m $(DIR_MODE) -d
INSTALL_R = -m $(RWD_MODE)
# install options for superuser install
#INSTALL_S = -g @GROUP@ -o @USER@
#############################################################################
# Build tools
#############################################################################
PROGRAM = privoxy@EXEEXT@
CC = @CC@
ECHO = echo
GZIP_PROG = gzip
# id -u is not universal. FIXME: need to set from configure. Breaks on
# Solaris.
#ID = id -u
ID = id
LD = @CC@
RM = rm -f
CP = cp -f
RMDIR = rmdir
MKDIR = ./mkinstalldirs
STRIP_PROG = strip
SED = sed
GREP = grep
CAT = cat
MV = mv
TAR = tar
LN = ln
TOUCH = touch
KILL = kill
CHMOD = chmod
CHOWN = chown
CHGRP = chgrp
GROUPS = groups
W3M_DUMP = env -u LANG LC_ALL=C @W3M@ -dump
W3M_DUMP_UTF8 = @W3M@ -dump
JADECAT = @JADECAT@
JADEBIN = @JADEBIN@
DB = $(JADEBIN) $(JADECAT) -ihtml -t sgml -D.. -d ldp.dsl\#html
DB2HTML = @DB2HTML@
MAN2HTML = @MAN2HTML@
G2H_CMD = groff -mandoc -Thtml
TARGET_OS = @host@
PERL = perl
DOC_DIR = doc/source
DOC_TMP = $(DOC_DIR)/tmp
DOC_STATUS = @DOC_STATUS@
TIDY = tidy -modify -indent -wrap 78 --tidy-mark no
RSYNC = rsync -av -c
# Program to do LF->CRLF
DOSFILTER = $(PERL) -p -e 's/\n/\r\n/'
CVSROOT = :pserver:anonymous@ijbswa.cvs.sourceforge.net:/cvsroot/ijbswa
#TMPDIR := $(shell mktemp -d /tmp/$(PROGRAM).XXXXXX)
# If your SF user name differs from your local one,
# change this to "ssh -l sf-username"
SSH = ssh
WWW_ROOT = /home/project-web/ijbswa
# SourceForge login name used by the 'sf-shell' target (optional)
SOURCE_FORGE_NAME = ''
#############################################################################
# Setup for make distribution for now.
#############################################################################
TAR_ARCH = /tmp/privoxy-$(VERSION).tar.gz
GEN_DIST_TAR_NAME = privoxy-$(TARGET_OS)-$(VERSION)-$(CODE_STATUS).tar
#############################################################################
# We include these files in our distributions
#############################################################################
CONFIGS = config trust default.action match-all.action \
user.action default.filter user.filter \
regression-tests.action
# take care that no CVS .cvsignore or other crappy files
# are included here
# and escape every '#' in the find. doh.
CONFIG_FILES = $(CONFIGS) \
`find templates/ -type f | grep -v "CVS" | grep -v "\.\#" | grep -v ".*~" | grep -v ".cvsignore" | grep -v "TAGS" | sort`
DOC_FILES = AUTHORS LICENSE README ChangeLog INSTALL \
`find doc/webserver/ -name "*.html" | grep -v "\(webserver\|team\)\/index\.html" | sort` \
`find doc/webserver/ -name "*.css" | sort` \
$(MAN_PAGE)
#############################################################################
# Filenames and libraries
#############################################################################
C_SRC = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
errlog.c filters.c gateway.c jbsockets.c jcc.c \
list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
urlmatch.c
C_OBJS = $(C_SRC:.c=.@OBJEXT@)
C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
CLIENT_TAG_SRC = @FEATURE_CLIENT_TAGS_ONLY@client-tags.c
CLIENT_TAG_OBJS = @FEATURE_CLIENT_TAGS_ONLY@client-tags.@OBJEXT@
W32_SRC = @WIN_ONLY@w32log.c w32taskbar.c win32.c w32svrapi.c
W32_FILES = @WIN_ONLY@w32.res
W32_OBJS = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
W32_HDRS = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h w32svrapi.h
W32_LIB = @WIN_ONLY@-lwsock32 -lcomctl32
W32_INIS = @WIN_ONLY@config.txt trust.txt
PCRS_SRC = @STATIC_PCRS_ONLY@pcrs.c
PCRS_OBJS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
PCRS_HDRS = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
PCRE_SRC = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
PCRE_OBJS = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
PCRE_HDRS = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
# No REGEX (maybe because dynamically linked pcreposix):
REGEX_SRC =
@STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
REGEX_OBJS = $(REGEX_SRC:.c=.@OBJEXT@)
REGEX_HDRS = $(REGEX_SRC:.c=.h)
# Dependencies introduced by #include "project.h".
PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
# Socket libraries for platforms that need them explicitly defined
SOCKET_LIB = @SOCKET_LIB@
# PThreads library, if needed.
PTHREAD_LIB = @PTHREAD_ONLY@@PTHREAD_LIB@
SRCS = $(C_SRC) $(CLIENT_TAG_SRC) $(W32_SRC) $(PCRS_SRC) $(PCRE_SRC) $(REGEX_SRC)
OBJS = $(C_OBJS) $(CLIENT_TAG_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS)
HDRS = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS)
LIBS = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
#############################################################################
# Compiler switches
#############################################################################
# The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
# The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
# Win32 GUI build.
# The flag "-pthread" is required if using Pthreads under Linux (and
# possibly other OSs).
SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
# Add your flags here
OTHER_CFLAGS =
CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
@STATIC_PCRE_ONLY@ -Ipcre
LDFLAGS = @LDFLAGS@ $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
#############################################################################
# Build section.
#
# There should NOT be any targets above this line.
#############################################################################
all: $(PROGRAM) default.action
#############################################################################
# Phony targets
#############################################################################
.PHONY: all inifiles \
win-dist tarball-dist dok webserver clean clobber tags \
install CONF_DEST LOG_DEST \
PID_DEST check_doc install-strip uninstall GROUP_T
#############################################################################
# Define this explicitly because Solaris is broken!
#############################################################################
%.o: %.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
#############################################################################
# Strip master copy comments from default.action:
#############################################################################
default.action: default.action.master
$(GREP) -v '^#MASTER#' default.action.master > $@
#############################################################################
# Win32 config files
#############################################################################
inifiles: $(W32_INIS)
config.txt: config
$(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
-e 's!\logfile logfile!logfile privoxy.log!' \
-e 's!#Win32-only: !!' \
< $< | \
$(DOSFILTER) > $@
# LF to CRLF in default.action
$(DOSFILTER) default.action.txt && mv default.action.txt default.action
# LF to CRLF in default.filter
$(DOSFILTER) default.filter.txt && mv default.filter.txt default.filter
trust.txt: trust
$(DOSFILTER) < $< > $@
#############################################################################
# Pre-dist check:
#############################################################################
dist-check:
@if [ -d CVS ]; then \
$(ECHO) "***************************************************"; \
$(ECHO) "*** ***"; \
$(ECHO) "*** WARNING ***"; \
$(ECHO) "*** ***"; \
$(ECHO) "*** The presence of a CVS subdirectory suggests ***"; \
$(ECHO) "*** that you are trying to build a distribution ***"; \
$(ECHO) "*** package based on a checked out, not an ***"; \
$(ECHO) "*** exported copy of the source tree. Please ***"; \
$(ECHO) "*** see \"Releasing a new version\" in the ***"; \
$(ECHO) "*** developer manual. ***"; \
$(ECHO) "*** ***"; \
$(ECHO) "***************************************************"; \
$(ECHO) "Type \"yes i am sure\" if you are sure that you"; \
$(ECHO) -n "really want to proceed: "; \
read answer; \
if [ "$$answer" != "yes i am sure" ]; then exit 1; fi \
fi;
#############################################################################
# create tar.gz from CVS:
# This make-target is usually called through 'create-archive'. If you
# run 'make create-snapshot' without setting SNAPVERSION, you'll get a
# tar.gz with the current date in the name.
# The main usage is to run it as follows (Red Hat example):
# make SNAPVERSION=1.6x create-snapshot
# This creates a tar.gz.
#############################################################################
create-snapshot:
@tag=`cvs -d $(CVSROOT) status Makefile | awk ' /Sticky Tag/ { print $$3 } '` 2> /dev/null; \
[ x"$$tag" = x"(none)" ] && tag=HEAD; \
echo "*** Creating package from $$tag!"; \
TMPDIR=$(shell mktemp -d /tmp/$(PROGRAM).XXXXXX); \
cd $$TMPDIR ; cvs -Q -d $(CVSROOT) export -r $$tag current || echo "Um... export aborted."; \
cd $$TMPDIR/current; \
$(TAR) --exclude ".cvsignore" --exclude "CVS" \
-czf /tmp/$(PROGRAM)-$(VERSION).tar.gz .; \
$(RM) -rf $$TMPDIR
@echo "Resulting file is /tmp/$(PROGRAM)-$(VERSION).tar.gz"
#############################################################################
# looks at the version of Makefile and exports a corresponding source-tree
# example: if the Makefile has the sticky tag v_2_9_13, you'll get
# privoxy-*-2.4.13.tar.gz.
#############################################################################
create-archive:
make SNAPVERSION=$(SNAPVERSION) create-snapshot
#############################################################################
# generic distribution
#############################################################################
gen-dist: dist-check
@$(ECHO) ""
@$(ECHO) "You have run autoconf && autoheader && ./configure right?"
@$(ECHO) ""
$(MAKE) $(PROGRAM)
$(STRIP_PROG) $(PROGRAM)
$(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
# add program
(cd .. && $(TAR) --exclude "PACKAGERS" -cvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$(PROGRAM))
# add config files
for foo in $(CONFIG_FILES); do \
(cd .. && $(TAR) --exclude "PACKAGERS" -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
done;
# add documentation
for foo in $(DOC_FILES); do \
(cd .. && $(TAR) --exclude "PACKAGERS" -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/$$foo;) \
done;
# add tools
(cd .. && $(TAR) -uvhf $(GEN_DIST_TAR_NAME) privoxy-$(VERSION)-$(CODE_STATUS)/tools)
# and zip the archive
$(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
$(GZIP_PROG) ../$(GEN_DIST_TAR_NAME)
@$(ECHO) Distribution with binary created.
# anonymously ncftps the package to sourceforge
gen-upload:
ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../$(GEN_DIST_TAR_NAME).gz
@$(ECHO) -------------------------------------------------------
@$(ECHO) Now goto
@$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
@$(ECHO) ... and release the files.
@$(ECHO) -------------------------------------------------------
# use with care
gen-clean:
$(RM) ../$(GEN_DIST_TAR_NAME)*
#############################################################################
# Tarball distribution: No CVS dirs, dotfiles, debian build dir,
# (FIXME:) only parts of the static / generated docs mix in doc/webserver
#############################################################################
tarball-dist: dist-check clean clobber
$(LN) -s `pwd` ../privoxy-$(VERSION)-$(CODE_STATUS)
for i in `find . -type f -a -not \( -path "*/CVS*" -o -name ".*" \
-o -path "*/debian/*" -o -path "*/actions/*" -o -name "*.php" -o \
-name "PACKAGERS" -o -path "*.git/*" \) | sort`; do \
files="$$files privoxy-$(VERSION)-$(CODE_STATUS)/$$i"; \
done && \
cd .. && $(TAR) -cvhf privoxy-$(VERSION)-$(CODE_STATUS)-src.tar $$files ; \
# and zip the archive
$(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)
$(GZIP_PROG) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar
@$(ECHO) Tarball distribution created.
# anonymously ncftps the tarball to sourceforge
tarball-upload:
ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
@$(ECHO) -------------------------------------------------------
@$(ECHO) Now goto
@$(ECHO) https://sourceforge.net/project/admin/editpackages.php?group_id=11118
@$(ECHO) ... and release the files.
@$(ECHO) -------------------------------------------------------
tarball-clean:
$(RM) ../privoxy-$(VERSION)-$(CODE_STATUS)-src.tar.gz
#############################################################################
#
# Documentation
#
# converts doc/source/*.sgml into html and man pages
#
#############################################################################
# developer manual
dok-devel:
$(RM) doc/webserver/developer-manual/*.html
$(RM) -r doc/source/developer-manual
mkdir -p doc/source/developer-manual
cd doc/source/developer-manual && $(DB) ../developer-manual.sgml && cd .. && cp developer-manual/*.html ../webserver/developer-manual/
# user manual
dok-user:
$(RM) doc/webserver/user-manual/*.html
$(RM) -r doc/source/user-manual/
mkdir -p doc/source/user-manual
cd doc/source/user-manual && $(DB) -iuser-man ../user-manual.sgml && cd .. && cp user-manual/*.html ../webserver/user-manual/
# FIXME: temp fix so same stylesheet gets in more than one place so it works
# for all doc set-ups, including the 'user manual' config option in local
# system where it MUST be in same directory as html.
$(PERL) -pi.bak -e 's/<\/head/\n\n<\/head/i' doc/webserver/user-manual/*html
# faq
dok-faq:
$(RM) doc/webserver/faq/*.html
$(RM) -r doc/source/faq
mkdir -p doc/source/faq
cd doc/source/faq && $(DB) ../faq.sgml && cd .. && cp faq/*.html ../webserver/faq/
# man page, one variation. Try to use the next target, just 'make man'.
dok-man:
$(RM) doc/man/* doc/webserver/man-page/*.html
echo MAN2HTML is $(MAN2HTML)
@if [ $(MAN2HTML) != "false" ]; then \
$(ECHO) "Privoxy Man page