Makefile.Linux 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 = $(CC)
  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. AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
  28. TYPECOMMAND = cat
  29. COMPATLIBS =
  30. MAKEFILE = Makefile.Linux
  31. # PamAuth requires libpam, you may require pam-devel package to be installed
  32. # SSLPlugin requires -lcrypto -lssl
  33. #LIBS = -lcrypto -lssl -ldl
  34. LIBS = -ldl
  35. #PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
  36. PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin
  37. include Makefile.inc
  38. allplugins:
  39. @list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
  40. DESTDIR =
  41. prefix =
  42. exec_prefix = $(prefix)
  43. man_prefix = /usr/share
  44. chroot_prefix = /usr/local
  45. INSTALL = /usr/bin/install
  46. INSTALL_BIN = $(INSTALL) -m 755
  47. INSTALL_DATA = $(INSTALL) -m 644
  48. INSTALL_OBJS = bin/3proxy \
  49. bin/ftppr \
  50. bin/mycrypt \
  51. bin/pop3p \
  52. bin/proxy \
  53. bin/socks \
  54. bin/tcppm \
  55. bin/udppm
  56. INSTALL_CFG = scripts/3proxy.cfg.chroot
  57. INSTALL_CFG_OBJS = scripts/3proxy.cfg \
  58. scripts/add3proxyuser.sh
  59. INSTALL_CFG_OBJS2 = counters bandlimiters
  60. INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
  61. INSTALL_SYSTEMD_SCRIPT = scripts/3proxy.service
  62. CHROOTDIR = $(DESTDIR)$(chroot_prefix)/3proxy
  63. CHROOTREL = ../..$(chroot_prefix)/3proxy
  64. MANDIR1 = $(DESTDIR)$(man_prefix)/man/man1
  65. MANDIR3 = $(DESTDIR)$(man_prefix)/man/man3
  66. MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
  67. BINDIR = $(DESTDIR)$(exec_prefix)/bin
  68. ETCDIR = $(DESTDIR)/etc/3proxy
  69. INITDDIR = $(DESTDIR)/etc/init.d
  70. RUNBASE = $(DESTDIR)/var/run
  71. RUNDIR = $(RUNBASE)/3proxy
  72. LOGBASE = $(DESTDIR)/var/log
  73. LOGDIR = $(LOGBASE)/3proxy
  74. INSTALL_CFG_DEST = $(ETCDIR)/conf
  75. SYSTEMDDIR = $(DESTDIR)/usr/lib/systemd/system/
  76. install-bin:
  77. $(INSTALL_BIN) -d $(BINDIR)
  78. $(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)
  79. $(INSTALL_BIN) -s bin/*.ld.so $(CHROOTDIR)/libexec
  80. chmod -R a-w $(CHROOTDIR)/libexec
  81. install-etc-dir:
  82. $(INSTALL_BIN) -d $(ETCDIR)
  83. install-chroot-dir:
  84. $(INSTALL_BIN) -d $(CHROOTDIR)
  85. $(INSTALL_BIN) -d $(CHROOTDIR)/conf
  86. $(INSTALL_BIN) -d $(CHROOTDIR)/logs
  87. $(INSTALL_BIN) -d $(CHROOTDIR)/count
  88. $(INSTALL_BIN) -d $(CHROOTDIR)/libexec
  89. chmod -R o-rwx $(CHROOTDIR)
  90. install-etc-default-config:
  91. if [ ! -d $(INSTALL_CFG_DEST) ]; then \
  92. ln -s $(CHROOTREL)/conf $(INSTALL_CFG_DEST); \
  93. $(INSTALL_BIN) $(INSTALL_CFG) $(ETCDIR)/3proxy.cfg; \
  94. $(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
  95. fi
  96. install-etc: install-etc-dir install-etc-default-config
  97. for file in $(INSTALL_CFG_OBJS2); \
  98. do \
  99. touch $(INSTALL_CFG_DEST)/$$file; chmod 0600 $(INSTALL_CFG_DEST)/$$file; \
  100. done;
  101. install-man:
  102. $(INSTALL_BIN) -d $(MANDIR3)
  103. $(INSTALL_BIN) -d $(MANDIR8)
  104. $(INSTALL_DATA) man/*.3 $(MANDIR3)
  105. $(INSTALL_DATA) man/*.8 $(MANDIR8)
  106. install-init:
  107. $(INSTALL_BIN) -d $(INITDDIR)
  108. $(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy
  109. $(INSTALL_BIN) -d $(SYSTEMDDIR)
  110. $(INSTALL_DATA) $(INSTALL_SYSTEMD_SCRIPT) $(SYSTEMDDIR)
  111. install-run:
  112. $(INSTALL_BIN) -d $(RUNDIR)
  113. install-log:
  114. $(INSTALL_BIN) -d $(LOGBASE)
  115. @if [ ! -d $(LOGDIR) ]; then \
  116. ln -s $(CHROOTREL)/logs $(LOGDIR);\
  117. fi
  118. install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init
  119. @if [ "$(DESTDIR)" = "" ]; then \
  120. sh scripts/debian/preinst; \
  121. sh scripts/debian/postinst; \
  122. fi