Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. CC ?= gcc
  2. PREFIX ?= /usr/local
  3. VERSION = $(shell git describe --always | tail -c +2)
  4. LIBS = -lpcap
  5. CFLAGS += -Wall -g -DNMRPFLASH_VERSION=\"$(VERSION)\"
  6. LDFLAGS += $(LIBS)
  7. nmrpflash_OBJ = nmrp.o tftp.o ethsock.o main.o util.o
  8. .PHONY: clean install release release/osx release/linux release/win32
  9. nmrpflash: $(nmrpflash_OBJ)
  10. $(CC) $(CFLAGS) -o nmrpflash $(nmrpflash_OBJ) $(LDFLAGS)
  11. tftptest:
  12. CFLAGS=-DNMRPFLASH_TFTP_TEST make clean nmrpflash
  13. %.o: %.c nmrpd.h
  14. $(CC) -c $(CFLAGS) $< -o $@
  15. fuzz: clean
  16. CC=afl-gcc CFLAGS=-DNMRPFLASH_FUZZ make nmrpflash
  17. mv nmrpflash fuzz
  18. dofuzz: fuzz
  19. echo core | sudo tee /proc/sys/kernel/core_pattern
  20. echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
  21. afl-fuzz -i fuzzin -o fuzzout -- ./fuzz
  22. clean:
  23. rm -f $(nmrpflash_OBJ) nmrpflash
  24. install: nmrpflash
  25. install -m 755 nmrpflash $(PREFIX)/bin
  26. release/osx:
  27. CFLAGS="-arch i386 -arch x86_64 -mmacosx-version-min=10.6" make release
  28. zip nmrpflash-$(VERSION)-osx.zip nmrpflash
  29. release/linux: release
  30. zip nmrpflash-$(VERSION)-linux.zip nmrpflash
  31. release/win32:
  32. zip nmrpflash-$(VERSION)-win32.zip nmrpflash.exe
  33. release: clean nmrpflash
  34. strip nmrpflash