Makefile.unix 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #
  2. # 3 proxy Makefile for GCC/Unix
  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 LDFLAGS to compile with ODBC
  8. # library support. Add -DSAFESQL for poorely written ODBC library / drivers.
  9. BUILDDIR = ../bin/
  10. CC = gcc
  11. # you may need -L/usr/pkg/lib for older NetBSD versions
  12. CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
  13. COUT = -o
  14. LN = $(CC)
  15. LDFLAGS = -O2 -fno-strict-aliasing -pthread
  16. # -lpthreads may be reuqired on some platforms instead of -pthreads
  17. # -ldl or -lld may be required for some platforms
  18. DCFLAGS = -fPIC
  19. DLFLAGS = -shared
  20. DLSUFFICS = .ld.so
  21. LIBS =
  22. LIBSPREFIX = -l
  23. LIBSSUFFIX =
  24. LNOUT = -o
  25. EXESUFFICS =
  26. OBJSUFFICS = .o
  27. DEFINEOPTION = -D
  28. COMPFILES = *~
  29. REMOVECOMMAND = rm -f
  30. AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
  31. TYPECOMMAND = cat
  32. COMPATLIBS =
  33. MAKEFILE = Makefile.unix
  34. PLUGINS = StringsPlugin TrafficPlugin PCREPlugin PamAuth TransparentPlugin
  35. include Makefile.inc
  36. allplugins:
  37. @list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
  38. DESTDIR =
  39. prefix =
  40. exec_prefix = $(prefix)
  41. man_prefix = /usr/share
  42. chroot_prefix = /usr/local
  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 = scripts/3proxy.cfg.chroot
  55. INSTALL_CFG_OBJS = scripts/3proxy.cfg \
  56. scripts/add3proxyuser.sh
  57. INSTALL_CFG_OBJS2 = counters bandlimiters
  58. INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
  59. INSTALL_SYSTEMD_SCRIPT = scripts/3proxy.service
  60. CHROOTDIR = $(DESTDIR)$(chroot_prefix)/3proxy
  61. CHROOTREL = ../..$(chroot_prefix)/3proxy
  62. MANDIR1 = $(DESTDIR)$(man_prefix)/man/man1
  63. MANDIR3 = $(DESTDIR)$(man_prefix)/man/man3
  64. MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
  65. BINDIR = $(DESTDIR)$(exec_prefix)/bin
  66. ETCDIR = $(DESTDIR)/etc/3proxy
  67. INITDDIR = $(DESTDIR)/etc/init.d
  68. RUNBASE = $(DESTDIR)/var/run
  69. RUNDIR = $(RUNBASE)/3proxy
  70. LOGBASE = $(DESTDIR)/var/log
  71. LOGDIR = $(LOGBASE)/3proxy
  72. INSTALL_CFG_DEST = $(ETCDIR)/conf
  73. SYSTEMDDIR = $(DESTDIR)/usr/lib/systemd/system/
  74. install-bin:
  75. $(INSTALL_BIN) -d $(BINDIR)
  76. $(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)
  77. $(INSTALL_BIN) -s bin/*.ld.so $(CHROOTDIR)/libexec
  78. chmod -R a-w $(CHROOTDIR)/libexec
  79. install-etc-dir:
  80. $(INSTALL_BIN) -d $(ETCDIR)
  81. install-chroot-dir:
  82. $(INSTALL_BIN) -d $(CHROOTDIR)
  83. $(INSTALL_BIN) -d $(CHROOTDIR)/conf
  84. $(INSTALL_BIN) -d $(CHROOTDIR)/logs
  85. $(INSTALL_BIN) -d $(CHROOTDIR)/count
  86. $(INSTALL_BIN) -d $(CHROOTDIR)/libexec
  87. chmod -R o-rwx $(CHROOTDIR)
  88. install-etc-default-config:
  89. if [ ! -d $(INSTALL_CFG_DEST) ]; then \
  90. ln -s $(CHROOTREL)/conf $(INSTALL_CFG_DEST); \
  91. $(INSTALL_BIN) $(INSTALL_CFG) $(ETCDIR)/3proxy.cfg; \
  92. $(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
  93. fi
  94. install-etc: install-etc-dir install-etc-default-config
  95. for file in $(INSTALL_CFG_OBJS2); \
  96. do \
  97. touch $(INSTALL_CFG_DEST)/$$file; chmod 0600 $(INSTALL_CFG_DEST)/$$file; \
  98. done;
  99. install-man:
  100. $(INSTALL_BIN) -d $(MANDIR3)
  101. $(INSTALL_BIN) -d $(MANDIR8)
  102. $(INSTALL_DATA) man/*.3 $(MANDIR3)
  103. $(INSTALL_DATA) man/*.8 $(MANDIR8)
  104. install-init:
  105. $(INSTALL_BIN) -d $(INITDDIR)
  106. $(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy
  107. $(INSTALL_BIN) -d $(SYSTEMDDIR)
  108. $(INSTALL_DATA) $(INSTALL_SYSTEMD_SCRIPT) $(SYSTEMDDIR)
  109. install-run:
  110. $(INSTALL_BIN) -d $(RUNDIR)
  111. install-log:
  112. $(INSTALL_BIN) -d $(LOGBASE)
  113. @if [ ! -d $(LOGDIR) ]; then \
  114. ln -s $(CHROOTREL)/logs $(LOGDIR);\
  115. fi
  116. install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init
  117. @if [ "$(DESTDIR)" = "" ]; then \
  118. sh scripts/postinst; \
  119. fi