Makefile.Linux 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #
  2. # 3 proxy Makefile for GCC/Linux/Cygwin
  3. #
  4. # You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
  5. # libraries
  6. #
  7. # remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
  8. # library support. Add -DSAFESQL for poorely written ODBC library / drivers.
  9. BUILDDIR = ../bin/
  10. CC = gcc
  11. 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
  12. COUT = -o
  13. LN = gcc
  14. DCFLAGS =
  15. LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread
  16. DLFLAGS = -shared
  17. DLSUFFICS = .ld.so
  18. # -lpthreads may be reuqired on some platforms instead of -pthreads
  19. LIBSPREFIX = -l
  20. LIBSSUFFIX =
  21. LNOUT = -o
  22. EXESUFFICS =
  23. OBJSUFFICS = .o
  24. DEFINEOPTION = -D
  25. COMPFILES = *~
  26. REMOVECOMMAND = rm -f
  27. TYPECOMMAND = cat
  28. COMPATLIBS =
  29. MAKEFILE = Makefile.Linux
  30. # PamAuth requires libpam, you may require pam-devel package to be installed
  31. # SSLPlugin requires -lcrypto -lssl
  32. #LIBS = -lcrypto -lssl -ldl
  33. LIBS = -ldl
  34. #PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
  35. PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin
  36. include Makefile.inc
  37. allplugins:
  38. @list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
  39. DESTDIR =
  40. prefix =
  41. exec_prefix = $(prefix)
  42. man_prefix = /usr/share
  43. chroot_prefix = /usr/local
  44. INSTALL = /usr/bin/install
  45. INSTALL_BIN = $(INSTALL) -m 755
  46. INSTALL_DATA = $(INSTALL) -m 644
  47. INSTALL_OBJS = bin/3proxy \
  48. bin/ftppr \
  49. bin/mycrypt \
  50. bin/pop3p \
  51. bin/proxy \
  52. bin/socks \
  53. bin/tcppm \
  54. bin/udppm
  55. INSTALL_CFG = scripts/3proxy.cfg.chroot
  56. INSTALL_CFG_OBJS = scripts/3proxy.cfg \
  57. scripts/add3proxyuser.sh
  58. INSTALL_CFG_OBJS2 = counters bandlimiters
  59. INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
  60. INSTALL_SYSTEMD_SCRIPT = scripts/3proxy.service
  61. CHROOTDIR = $(DESTDIR)$(chroot_prefix)/3proxy
  62. CHROOTREL = ../..$(chroot_prefix)/3proxy
  63. MANDIR1 = $(DESTDIR)$(man_prefix)/man/man1
  64. MANDIR3 = $(DESTDIR)$(man_prefix)/man/man3
  65. MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
  66. BINDIR = $(DESTDIR)$(exec_prefix)/bin
  67. ETCDIR = $(DESTDIR)/etc/3proxy
  68. INITDDIR = $(DESTDIR)/etc/init.d
  69. RUNBASE = $(DESTDIR)/var/run
  70. RUNDIR = $(RUNBASE)/3proxy
  71. LOGBASE = $(DESTDIR)/var/log
  72. LOGDIR = $(LOGBASE)/3proxy
  73. INSTALL_CFG_DEST = $(ETCDIR)/conf
  74. SYSTEMDDIR = $(DESTDIR)/usr/lib/systemd/system/
  75. install-bin:
  76. $(INSTALL_BIN) -d $(BINDIR)
  77. $(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)
  78. $(INSTALL_BIN) -s bin/*.ld.so $(CHROOTDIR)/libexec
  79. chmod -R a-w $(CHROOTDIR)/libexec
  80. install-etc-dir:
  81. $(INSTALL_BIN) -d $(ETCDIR)
  82. install-chroot-dir:
  83. $(INSTALL_BIN) -d $(CHROOTDIR)
  84. $(INSTALL_BIN) -d $(CHROOTDIR)/conf
  85. $(INSTALL_BIN) -d $(CHROOTDIR)/logs
  86. $(INSTALL_BIN) -d $(CHROOTDIR)/count
  87. $(INSTALL_BIN) -d $(CHROOTDIR)/libexec
  88. chmod -R o-rwx $(CHROOTDIR)
  89. install-etc-default-config:
  90. if [ ! -d $(INSTALL_CFG_DEST) ]; then \
  91. ln -s $(CHROOTREL)/conf $(INSTALL_CFG_DEST); \
  92. $(INSTALL_BIN) $(INSTALL_CFG) $(ETCDIR)/3proxy.cfg; \
  93. $(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
  94. fi
  95. install-etc: install-etc-dir install-etc-default-config
  96. for file in $(INSTALL_CFG_OBJS2); \
  97. do \
  98. touch $(INSTALL_CFG_DEST)/$$file; chmod 0600 $(INSTALL_CFG_DEST)/$$file; \
  99. done;
  100. install-man:
  101. $(INSTALL_BIN) -d $(MANDIR3)
  102. $(INSTALL_BIN) -d $(MANDIR8)
  103. $(INSTALL_DATA) man/*.3 $(MANDIR3)
  104. $(INSTALL_DATA) man/*.8 $(MANDIR8)
  105. install-init:
  106. $(INSTALL_BIN) -d $(INITDDIR)
  107. $(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy
  108. $(INSTALL_BIN) -d $(SYSTEMDDIR)
  109. $(INSTALL_DATA) $(INSTALL_SYSTEMD_SCRIPT) $(SYSTEMDDIR)
  110. install-run:
  111. $(INSTALL_BIN) -d $(RUNDIR)
  112. install-log:
  113. $(INSTALL_BIN) -d $(LOGBASE)
  114. @if [ ! -d $(LOGDIR) ]; then \
  115. ln -s $(CHROOTREL)/logs $(LOGDIR);\
  116. fi
  117. install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init
  118. @if [ "$(DESTDIR)" = "" ]; then \
  119. sh scripts/postinst; \
  120. fi