Makefile.Linux 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -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 = -fpic
  15. LDFLAGS = -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. INSTALL = /usr/bin/install
  44. INSTALL_BIN = $(INSTALL) -m 755
  45. INSTALL_DATA = $(INSTALL) -m 644
  46. INSTALL_OBJS = bin/3proxy \
  47. bin/ftppr \
  48. bin/mycrypt \
  49. bin/pop3p \
  50. bin/proxy \
  51. bin/socks \
  52. bin/tcppm \
  53. bin/udppm
  54. INSTALL_CFG_OBJS = scripts/3proxy.cfg \
  55. scripts/add3proxyuser.sh
  56. INSTALL_CFG_DEST =
  57. INSTALL_CFG_OBJS2 = counters bandlimiters
  58. INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
  59. MANDIR1 = $(DESTDIR)$(man_prefix)/man/man1
  60. MANDIR3 = $(DESTDIR)$(man_prefix)/man/man3
  61. MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
  62. BINDIR = $(DESTDIR)$(exec_prefix)/bin
  63. ETCDIR = $(DESTDIR)$(prefix)/etc/3proxy
  64. INITDDIR = $(DESTDIR)$(prefix)/etc/init.d
  65. RUNDIR = $(DESTDIR)$(prefix)/var/run/3proxy
  66. LOGDIR = $(DESTDIR)$(prefix)/var/log/3proxy
  67. INSTALL_CFG_DEST = $(ETCDIR)
  68. install-bin:
  69. $(INSTALL_BIN) -d $(BINDIR)
  70. $(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)
  71. install-etc-dir:
  72. $(INSTALL_BIN) -d $(ETCDIR)
  73. install-etc-default-config:
  74. if [ ! -f $(ETCDIR)/$(INSTALL_CFG_DEST) ]; then \
  75. $(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
  76. fi
  77. install-etc: install-etc-dir install-etc-default-config
  78. for file in $(INSTALL_CFG_OBJS2); \
  79. do \
  80. touch $(ETCDIR)/$$file; chmod 0600 $(ETCDIR)/$$file; \
  81. done;
  82. install-man:
  83. $(INSTALL_BIN) -d $(MANDIR3)
  84. $(INSTALL_BIN) -d $(MANDIR8)
  85. $(INSTALL_DATA) man/*.3 $(MANDIR3)
  86. $(INSTALL_DATA) man/*.8 $(MANDIR8)
  87. install-init:
  88. if [ -f $(INITDIR) ]; then \
  89. $(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy; \
  90. fi
  91. if [ -f /usr/sbin/update-rc.d ]; then \
  92. /usr/sbin/update-rc.d 3proxy defaults; \
  93. /usr/sbin/update-rc.d 3proxy enable; \
  94. fi
  95. install-run:
  96. $(INSTALL_BIN) -d $(RUNDIR)
  97. install-log:
  98. $(INSTALL_BIN) -d $(LOGDIR)
  99. install: install-bin install-etc install-man install-log install-run install-init
  100. @if [ ! -f $(INSTALL_CFG_DEST)/passwd ]; then \
  101. touch $(ETCDIR)/passwd; chmod 0600 $(ETCDIR)/passwd; \
  102. stty -echo ;\
  103. echo "" ;\
  104. read -p "Proxy admin password: " password && $(INSTALL_CFG_DEST)/add3proxyuser.sh admin $password ;\
  105. stty echo ;\
  106. fi
  107. @echo ""
  108. @echo 3proxy installed.
  109. @echo use
  110. @echo " "$(INSTALL_CFG_DEST)/add3proxyuser.sh
  111. @echo to add users
  112. @if [ -f /usr/sbin/service ]; then \
  113. /usr/sbin/service 3proxy stop ;\
  114. /usr/sbin/service 3proxy start ;\
  115. fi