makefile 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. CC=cc
  2. RM=rm -f
  3. PREFIX=/usr/local
  4. CFLAGS=--std=c99 -pedantic -Wall -Wextra
  5. LDFLAGS = -I include
  6. LDFLAGS += -I tests
  7. LDFLAGS += -I $(PREFIX)/include
  8. LDLIBS=-L$(PREFIX)/lib
  9. BINDIR=$(PREFIX)/bin
  10. MANDIR=$(PREFIX)/share/man/man1
  11. .POSIX: all debug opt
  12. all: duncr
  13. debug: CFLAGS += -O0 -ggdb -save-temps -fsanitize=undefined -fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover
  14. debug: LDFLAGS += -lasan -lubsan
  15. debug: clean duncr
  16. opt: CFLAGS += --pipe -O2 -fpie -march=native -fstack-protector-strong
  17. opt: LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now
  18. opt: clean duncr
  19. duncr: duncr.o
  20. $(CC) $(LDFLAGS) -o duncr duncr.o $(LDLIBS)
  21. duncr.o: duncr.c
  22. $(CC) $(LDFLAGS) $(CFLAGS) -c duncr.c
  23. clean:
  24. $(RM) *.o *.s *.i
  25. distclean: clean
  26. $(RM) *.tar.gz *~ duncr test_duncr
  27. #test: test.cpp
  28. #> run tests
  29. dist: distclean
  30. tar -czvf ../duncr-source.tar.gz ./
  31. mv ../duncr-source.tar.gz ./
  32. install:
  33. cp ./duncr $(BINDIR)
  34. cp ./duncr.1 $(MANDIR)
  35. uninstall:
  36. rm $(BINDIR)/duncr
  37. rm $(MANDIR)/duncr.1