3proxy/Makefile.Linux

144 lines
4.1 KiB
Makefile
Raw Normal View History

2014-04-08 17:03:21 +08:00
#
# 3 proxy Makefile for GCC/Linux/Cygwin
#
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
# libraries
#
2016-09-20 04:37:04 +08:00
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
2014-04-08 17:03:21 +08:00
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
2018-04-22 03:34:18 +08:00
BUILDDIR = ../bin/
2014-04-08 17:03:21 +08:00
CC = gcc
2020-08-07 16:20:29 +08:00
CFLAGS = -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
2014-04-08 17:03:21 +08:00
COUT = -o
2020-11-20 19:19:47 +08:00
LN = $(CC)
2020-08-07 16:20:29 +08:00
DCFLAGS =
LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread
2014-04-08 17:03:21 +08:00
DLFLAGS = -shared
DLSUFFICS = .ld.so
# -lpthreads may be reuqired on some platforms instead of -pthreads
LIBSPREFIX = -l
LIBSSUFFIX =
2014-04-08 17:03:21 +08:00
LNOUT = -o
EXESUFFICS =
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *~
REMOVECOMMAND = rm -f
2020-11-29 19:00:19 +08:00
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
2014-04-08 17:03:21 +08:00
TYPECOMMAND = cat
COMPATLIBS =
MAKEFILE = Makefile.Linux
# PamAuth requires libpam, you may require pam-devel package to be installed
# SSLPlugin requires -lcrypto -lssl
#LIBS = -lcrypto -lssl -ldl
LIBS = -ldl
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin
2014-04-08 17:03:21 +08:00
include Makefile.inc
allplugins:
@list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
DESTDIR =
prefix =
2014-04-08 17:03:21 +08:00
exec_prefix = $(prefix)
man_prefix = /usr/share
chroot_prefix = /usr/local
2014-04-08 17:03:21 +08:00
INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_OBJS = bin/3proxy \
bin/ftppr \
bin/mycrypt \
bin/pop3p \
bin/proxy \
bin/socks \
bin/tcppm \
bin/udppm
2014-04-08 17:03:21 +08:00
INSTALL_CFG = scripts/3proxy.cfg.chroot
2014-04-08 17:03:21 +08:00
INSTALL_CFG_OBJS = scripts/3proxy.cfg \
scripts/add3proxyuser.sh
INSTALL_CFG_OBJS2 = counters bandlimiters
INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
INSTALL_SYSTEMD_SCRIPT = scripts/3proxy.service
2014-04-08 17:03:21 +08:00
CHROOTDIR = $(DESTDIR)$(chroot_prefix)/3proxy
CHROOTREL = ../..$(chroot_prefix)/3proxy
2014-04-08 17:03:21 +08:00
MANDIR1 = $(DESTDIR)$(man_prefix)/man/man1
MANDIR3 = $(DESTDIR)$(man_prefix)/man/man3
MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
BINDIR = $(DESTDIR)$(exec_prefix)/bin
ETCDIR = $(DESTDIR)/etc/3proxy
INITDDIR = $(DESTDIR)/etc/init.d
RUNBASE = $(DESTDIR)/var/run
2019-02-21 22:44:11 +08:00
RUNDIR = $(RUNBASE)/3proxy
LOGBASE = $(DESTDIR)/var/log
2019-02-21 22:44:11 +08:00
LOGDIR = $(LOGBASE)/3proxy
INSTALL_CFG_DEST = $(ETCDIR)/conf
SYSTEMDDIR = $(DESTDIR)/usr/lib/systemd/system/
2014-04-08 17:03:21 +08:00
install-bin:
$(INSTALL_BIN) -d $(BINDIR)
$(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)
$(INSTALL_BIN) -s bin/*.ld.so $(CHROOTDIR)/libexec
chmod -R a-w $(CHROOTDIR)/libexec
2014-04-08 17:03:21 +08:00
install-etc-dir:
$(INSTALL_BIN) -d $(ETCDIR)
install-chroot-dir:
$(INSTALL_BIN) -d $(CHROOTDIR)
$(INSTALL_BIN) -d $(CHROOTDIR)/conf
$(INSTALL_BIN) -d $(CHROOTDIR)/logs
$(INSTALL_BIN) -d $(CHROOTDIR)/count
$(INSTALL_BIN) -d $(CHROOTDIR)/libexec
chmod -R o-rwx $(CHROOTDIR)
2014-04-08 17:03:21 +08:00
install-etc-default-config:
if [ ! -d $(INSTALL_CFG_DEST) ]; then \
ln -s $(CHROOTREL)/conf $(INSTALL_CFG_DEST); \
$(INSTALL_BIN) $(INSTALL_CFG) $(ETCDIR)/3proxy.cfg; \
$(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
2014-04-08 17:03:21 +08:00
fi
install-etc: install-etc-dir install-etc-default-config
2014-04-08 17:03:21 +08:00
for file in $(INSTALL_CFG_OBJS2); \
do \
touch $(INSTALL_CFG_DEST)/$$file; chmod 0600 $(INSTALL_CFG_DEST)/$$file; \
2014-04-08 17:03:21 +08:00
done;
install-man:
$(INSTALL_BIN) -d $(MANDIR3)
$(INSTALL_BIN) -d $(MANDIR8)
$(INSTALL_DATA) man/*.3 $(MANDIR3)
$(INSTALL_DATA) man/*.8 $(MANDIR8)
install-init:
$(INSTALL_BIN) -d $(INITDDIR)
$(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy
$(INSTALL_BIN) -d $(SYSTEMDDIR)
$(INSTALL_DATA) $(INSTALL_SYSTEMD_SCRIPT) $(SYSTEMDDIR)
install-run:
$(INSTALL_BIN) -d $(RUNDIR)
install-log:
$(INSTALL_BIN) -d $(LOGBASE)
@if [ ! -d $(LOGDIR) ]; then \
ln -s $(CHROOTREL)/logs $(LOGDIR);\
fi
2014-04-08 17:03:21 +08:00
install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init
@if [ "$(DESTDIR)" = "" ]; then \
sh scripts/debian/preinst; \
sh scripts/debian/postinst; \
2019-02-21 22:44:11 +08:00
fi