forked from 3proxy/3proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.Linux
162 lines (140 loc) · 4.65 KB
/
Makefile.Linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#
# 3 proxy Makefile for GCC/Linux/Cygwin
#
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
# libraries
#
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR = ../bin/
CFLAGS = -fno-strict-aliasing -c -pthread -DWITHSPLICE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
COUT = -o
LN = $(CC)
DCFLAGS = -fpic
LDFLAGS = -fno-strict-aliasing
DLFLAGS = -shared
DLSUFFICS = .ld.so
# -lpthreads may be reuqired on some platforms instead of -pthreads
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o
EXESUFFICS =
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *~
REMOVECOMMAND = rm -f
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 = -lcrypto -lssl -ldl -pthread
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin
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 =
exec_prefix = $(prefix)
man_prefix = /usr/share
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
INSTALL_CFG = scripts/3proxy.cfg.chroot
INSTALL_CFG_OBJS = scripts/3proxy.cfg \
scripts/add3proxyuser.sh
INSTALL_CFG_OBJS2 = counters bandlimiters
INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
CHROOTDIR = $(DESTDIR)/usr/local/3proxy
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)$(prefix)/etc/3proxy
INITDDIR = $(DESTDIR)$(prefix)/etc/init.d
RUNBASE = $(DESTDIR)$(prefix)/var/run
RUNDIR = $(RUNBASE)/3proxy
LOGBASE = $(DESTDIR)$(prefix)/var/log
LOGDIR = $(LOGBASE)/3proxy
INSTALL_CFG_DEST = $(ETCDIR)/conf
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
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)
install-etc-default-config:
if [ ! -d $(INSTALL_CFG_DEST) ]; then \
ln -s $(CHROOTDIR)/conf $(INSTALL_CFG_DEST); \
$(INSTALL_BIN) $(INSTALL_CFG) $(ETCDIR)/3proxy.cfg; \
$(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
fi
install-etc: install-etc-dir install-etc-default-config
for file in $(INSTALL_CFG_OBJS2); \
do \
touch $(INSTALL_CFG_DEST)/$$file; chmod 0600 $(INSTALL_CFG_DEST)/$$file; \
done;
install-man:
$(INSTALL_BIN) -d $(MANDIR3)
$(INSTALL_BIN) -d $(MANDIR8)
$(INSTALL_DATA) man/*.3 $(MANDIR3)
$(INSTALL_DATA) man/*.8 $(MANDIR8)
install-init:
if [ -d $(INITDIR) ]; then \
$(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy; \
fi
if [ -f /usr/sbin/update-rc.d ]; then \
/usr/sbin/update-rc.d 3proxy defaults; \
/usr/sbin/update-rc.d 3proxy enable; \
fi
install-run:
$(INSTALL_BIN) -d $(RUNDIR)
install-log:
@if [ -d $(LOGBASE) ] && [ ! -d $(LOGDIR) ]; then \
ln -s $(CHROOTDIR)/logs $(LOGDIR);\
fi
install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init
@getent passwd proxy || useradd -UMr -s /bin/false -c 3proxy proxy
@if [ ! -f $(INSTALL_CFG_DEST)/passwd ]; then \
touch $(INSTALL_CFG_DEST)/passwd;\
fi
@chown -R proxy:proxy $(CHROOTDIR)
@chmod 550 $(CHROOTDIR)/
@chmod 550 $(CHROOTDIR)/conf/
@chmod 440 $(CHROOTDIR)/conf/*
@echo ""
@echo 3proxy installed.
@echo use
@echo " "service 3proxy start
@echo to start proxy
@echo " "service 3proxy stop
@echo to stop proxy
@echo " "$(INSTALL_CFG_DEST)/add3proxyuser.sh
@echo to add users
@echo ""
@echo Default config uses Google\'s DNS.
@echo It\'s recommended to use provider supplied DNS or install local recursor, e.g. pdns-recursor.
@echo Configure preferred DNS in $(INSTALL_CFG_DEST)/3proxy.cfg.
@echo run \'$(INSTALL_CFG_DEST)/add3proxyuser.sh admin password\' to configure \'admin\' user
@if [ -f /usr/sbin/service ]; then \
/usr/sbin/service 3proxy stop ;\
/usr/sbin/service 3proxy start ;\
fi