kalasag.org

kalasag.org

Git

This blob has been accessed 2 times via Git panel.

  1. # Makefile for Kalasag
  2. #
  3. # STEALTH MODE: Only works on Linux systems right now.
  4. #
  5. # The snprintf included with the package is for use with NEXTSTEP only,
  6. # (Thanks Timothy <tjl@luomat.org>) although it may work elsewhere.
  7. # We've not tried it under any other OS to date. It shouldn't be needed
  8. # by any modern OS.
  9. #
  10. # Others have used the snprintf from:
  11. #
  12. # http://www.ijs.si/software/snprintf/
  13. #
  14. # We've not tried this yet but others have had good success. Our only
  15. # piece of advice for those running an OS without built in snprintf()
  16. # is to upgrade. :)
  17. #
  18. #
  19. # Generic compiler (usually linked to gcc on most platforms)
  20. CC = cc
  21.  
  22. # GNU..
  23. #CC = gcc
  24.  
  25. # Base flags (portable across all platforms)
  26. BASE_CFLAGS = -O3 -Wall -Wextra -pipe -flto
  27.  
  28. # Linux hardening flags (GCC/Linux specific)
  29. LINUX_CFLAGS = -funroll-loops -fomit-frame-pointer $(BASE_CFLAGS) \
  30.     -D_FORTIFY_SOURCE=2 -fpie -Wl,-pie -fstack-clash-protection \
  31.     -fstack-protector-strong -fcf-protection \
  32.     -Werror=format-security -Werror=implicit-function-declaration \
  33.     -Wl,-z,defs -Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack
  34.  
  35. # BSD/macOS hardening flags (compatible with clang and BSD linkers)
  36. BSD_CFLAGS = $(BASE_CFLAGS) -fPIE -Wl,-pie -fstack-protector-strong
  37.  
  38. # Debug mode for kalasag
  39. #BASE_CFLAGS = -Wall -g -DNODAEMON -DDEBUG
  40. #BASE_CFLAGS = -Wall -g -DNODAEMON
  41. #BASE_CFLAGS = -Wall -g -DDEBUG
  42.  
  43. # Profiler mode for kalasag
  44. #BASE_CFLAGS = -pg -O -Wall -DNODAEMON
  45. #LIBS = /usr/lib/libefence.a
  46.  
  47. INSTALLDIR = /opt
  48. CHILDDIR=/kalasag
  49.  
  50. .PHONY: all clean install uninstall
  51.  
  52. all:
  53.                 @echo "Usage: make <systype>"
  54.                 @echo "<systype> is one of: linux, linux-x86_64, debian-linux, bsd, solaris, hpux, hpux-gcc,"
  55.                 @echo "freebsd, osx, openbsd, netbsd, bsdi, aix, osf, irix, generic"
  56.                 @echo ""
  57.                 @echo "This code requires snprintf()/vsnprintf() system calls"
  58.                 @echo "to work. If you run a modern OS it should work on"
  59.                 @echo "your system with 'make generic'. If you get it to"
  60.                 @echo "work on an unlisted OS please write us with the"
  61.                 @echo "changes."
  62.                 @echo ""
  63.                 @echo "Install: make install"
  64.                 @echo ""
  65.                 @echo "NOTE: This will install the package in this"
  66.                 @echo "      directory: $(INSTALLDIR)"
  67.                 @echo ""
  68.                 @echo "Edit the makefile if you wish to change these paths."
  69.                 @echo "Any existing files will be overwritten."
  70.                 @echo ""
  71.  
  72. clean:         
  73.                 /bin/rm -f ./kalasag *.o
  74.  
  75. uninstall:     
  76.                 @for svc in kalasag-tcp kalasag-udp; do \
  77.                     if [ -f /usr/lib/systemd/system/$$svc.service ]; then \
  78.                         systemctl stop $$svc.service; \
  79.                         systemctl disable $$svc.service; \
  80.                         rm -f /usr/lib/systemd/system/$$svc.service; \
  81.                     fi; \
  82.                 done
  83.                 @systemctl daemon-reload 2>/dev/null || true
  84.                 @if [ -d $(INSTALLDIR)$(CHILDDIR) ]; then rm -rf $(INSTALLDIR)$(CHILDDIR)/*; fi
  85.  
  86. install:
  87.                 @if [ ! -f ./kalasag ]; then \
  88.                     echo "Error: ./kalasag not found. Build first (e.g. make linux)"; \
  89.                     exit 1; \
  90.                 fi
  91.                 @if [ ! -d $(INSTALLDIR)$(CHILDDIR) ]; then mkdir -p $(INSTALLDIR)$(CHILDDIR); fi
  92.                 @chmod 700 $(INSTALLDIR)$(CHILDDIR)
  93.                 @cp ./kalasag.conf $(INSTALLDIR)$(CHILDDIR)
  94.                 @cp ./kalasag.ignore $(INSTALLDIR)$(CHILDDIR)
  95.                 @cp ./kalasag $(INSTALLDIR)$(CHILDDIR)
  96.                 @if [ -d /usr/lib/systemd/system ]; then \
  97.                     cp ./kalasag-tcp.service /usr/lib/systemd/system/; \
  98.                     cp ./kalasag-udp.service /usr/lib/systemd/system/; \
  99.                     systemctl daemon-reload; \
  100.                     systemctl enable kalasag-tcp.service; \
  101.                     systemctl enable kalasag-udp.service; \
  102.                 fi
  103.                 @chmod 600 $(INSTALLDIR)$(CHILDDIR)/kalasag.ignore
  104.                 @chmod 600 $(INSTALLDIR)$(CHILDDIR)/kalasag.conf
  105.                 @chmod 700 $(INSTALLDIR)$(CHILDDIR)/kalasag
  106.                 @echo ""
  107.                 @echo 'Issue "systemctl start kalasag-tcp kalasag-udp" after editing $(INSTALLDIR)$(CHILDDIR)/kalasag.conf.'
  108.                 @echo ""
  109.  
  110. linux:         
  111.                 SYSTYPE=linux
  112.                 @echo "Making $(SYSTYPE)"
  113.                 $(CC) $(LINUX_CFLAGS) -DLINUX -DSUPPORT_STEALTH -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c $(LIBS)
  114.  
  115. linux-x86_64:          
  116.                 SYSTYPE=linux
  117.                 @echo "Making $(SYSTYPE)"
  118.                 $(CC) $(LINUX_CFLAGS) -m64 -DLINUX -DSUPPORT_STEALTH -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c $(LIBS)
  119.  
  120. debian-linux:          
  121.                 SYSTYPE=debian-linux
  122.                 @echo "Making $(SYSTYPE)"
  123.                 $(CC) $(LINUX_CFLAGS) -DLINUX -DSUPPORT_STEALTH -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c $(LIBS)
  124.  
  125.  
  126. bsd:           
  127.                 SYSTYPE=bsd
  128.                 @echo "Making $(SYSTYPE)"
  129.                 $(CC) $(BSD_CFLAGS) -DBSD44 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  130.  
  131.  
  132. openbsd:               
  133.                 SYSTYPE=openbsd
  134.                 @echo "Making $(SYSTYPE)"
  135.                 $(CC) $(BSD_CFLAGS) -DBSD44 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  136.  
  137.  
  138. freebsd:               
  139.                 SYSTYPE=freebsd
  140.                 @echo "Making $(SYSTYPE)"
  141.                 $(CC) $(BSD_CFLAGS) -DBSD44 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  142.  
  143. osx:           
  144.                 SYSTYPE=osx
  145.                 @echo "Making $(SYSTYPE)"
  146.                 $(CC) $(BSD_CFLAGS) -DBSD44 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  147.  
  148.  
  149. netbsd:        
  150.                 SYSTYPE=netbsd
  151.                 @echo "Making $(SYSTYPE)"
  152.                 $(CC) $(BSD_CFLAGS) -DBSD44 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  153.  
  154.  
  155. bsdi:          
  156.                 SYSTYPE=bsdi
  157.                 @echo "Making $(SYSTYPE)"
  158.                 $(CC) $(BSD_CFLAGS) -DBSD44 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  159.  
  160.  
  161. generic:               
  162.                 SYSTYPE=generic
  163.                 @echo "Making $(SYSTYPE)"
  164.                 $(CC) $(BASE_CFLAGS) -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  165.  
  166.  
  167. hpux:          
  168.                 SYSTYPE=hpux
  169.                 @echo "Making $(SYSTYPE)"
  170.                 $(CC) -Ae -DHPUX -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  171.  
  172.  
  173. hpux-gcc:
  174.                 SYSTYPE=hpux-gcc
  175.                 @echo "Making $(SYSTYPE)"
  176.                 $(CC) $(BASE_CFLAGS) -DHPUX -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  177.  
  178.  
  179. solaris:               
  180.                 SYSTYPE=solaris
  181.                 @echo "Making $(SYSTYPE)"
  182.                 $(CC) -lnsl -lsocket -lresolv -lc -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  183.  
  184.  
  185. aix:           
  186.                 SYSTYPE=aix
  187.                 @echo "Making $(SYSTYPE)"
  188.                 $(CC) $(BASE_CFLAGS) -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  189.  
  190.  
  191. osf:
  192.                 SYSTYPE=osf
  193.                 @echo "Making $(SYSTYPE)"
  194.                 $(CC) $(BASE_CFLAGS) -taso -ldb -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  195.  
  196.  
  197. irix:
  198.                 SYSTYPE=irix
  199.                 @echo "Making $(SYSTYPE)"
  200.                 $(CC) $(BASE_CFLAGS) -O -n32 -mips3 -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  201.  
  202.  
  203. # NeXTSTEP Users. NeXT used to work, but we changed the log function and
  204. # it now uses vsnprintf() to format strings. This means that this
  205. # version does not work under NeXTSTEP until we can find a workable
  206. # vsnprintf() call to put in the program. Sorry. If you have some good
  207. # vsnprintf() code to use under NeXT please send it to us and we'll
  208. # include it on the next update.
  209. #next:         
  210. #               SYSTYPE=next
  211. #               @echo "Making $(SYSTYPE)"
  212. #               $(CC) $(CFLAGS) -DNEXT -DHAS_NO_SNPRINTF -posix -o ./kalasag ./kalasag.c ./kalasag_io.c ./kalasag_util.c
  213.  
filedropkalasag.git-8eed43a.tar.bz2 new
21.31 KB
2 downloads
filedropkalasag.git-8eed43a.zip
26.47 KB
1 download
filedropkalasag.git-83beb57.tar.bz2
21.32 KB
2 downloads
filedropkalasag.git-83beb57.zip
26.49 KB
1 download
filedropkalasag.git-89d9746.tar.bz2
21.25 KB
3 downloads
filedropkalasag.git-89d9746.zip
26.41 KB
2 downloads
filedropkalasag.git-a1e8b2b.tar.bz2
21.14 KB
2 downloads
filedropkalasag.git-a1e8b2b.zip
26.30 KB
1 download
filedropkalasag.git-8c3a288.tar.bz2
21.20 KB
2 downloads
filedropkalasag.git-8c3a288.zip
26.46 KB
1 download
filedropkalasag.git-1c9f013.tar.bz2
20.95 KB
131 downloads
filedropkalasag.git-1c9f013.zip
25.81 KB
76 downloads
filedropkalasag.git-3ca3612.tar.bz2
20.80 KB
34 downloads
filedropkalasag.git-3ca3612.zip
25.66 KB
19 downloads
filedropkalasag.git-2ffeaa6.tar.bz2
20.80 KB
36 downloads
filedropkalasag.git-2ffeaa6.zip
25.65 KB
90 downloads
filedropkalasag.git-2834a11.tar.bz2
20.84 KB
139 downloads
filedropkalasag.git-2834a11.zip
25.72 KB
18 downloads
filedropkalasag.git-afd7b31.tar.bz2
20.84 KB
119 downloads
filedropkalasag.git-afd7b31.zip
25.71 KB
98 downloads
filedropkalasag.git-97c89e1.tar.bz2
20.82 KB
116 downloads
filedropkalasag.git-97c89e1.zip
25.68 KB
96 downloads
filedropkalasag.git-1141d13.tar.bz2
20.65 KB
122 downloads
filedropkalasag.git-1141d13.zip
25.37 KB
82 downloads
filedropkalasag.git-ee3c17b.tar.bz2
20.65 KB
113 downloads
filedropkalasag.git-ee3c17b.zip
25.34 KB
24 downloads
filedropkalasag.git-4032c54.tar.bz2
20.63 KB
32 downloads
filedropkalasag.git-4032c54.zip
25.13 KB
87 downloads
filedropkalasag.git-e51a2a6.tar.bz2
20.65 KB
108 downloads
filedropkalasag.git-e51a2a6.zip
25.13 KB
19 downloads
filedropkalasag.git-599c93a.tar.bz2
20.63 KB
104 downloads
filedropkalasag.git-599c93a.zip
25.11 KB
1,612 downloads
filedropkalasag.git-acdc640.tar.bz2
20.63 KB
105 downloads
filedropkalasag.git-acdc640.zip
25.10 KB
14 downloads