Makefile.FreeBSD 3.6 KB

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