3 VERSION = $(shell git describe --always | tail -c +2)
5 CFLAGS += -Wall -g -DNMRPFLASH_VERSION=\"$(VERSION)\"
8 ifeq ($(shell uname -s),Linux)
9 CFLAGS += $(shell pkg-config libnl-route-3.0 --cflags)
10 LIBS += $(shell pkg-config libnl-route-3.0 --libs)
13 nmrpflash_OBJ = nmrp.o tftp.o ethsock.o main.o util.o
15 .PHONY: clean install release release/macos release/linux release/win32
17 nmrpflash: $(nmrpflash_OBJ)
18 $(CC) $(CFLAGS) -o nmrpflash $(nmrpflash_OBJ) $(LDFLAGS)
21 CFLAGS=-DNMRPFLASH_TFTP_TEST make clean nmrpflash
24 $(CC) -c $(CFLAGS) $< -o $@
27 CC=afl-gcc CFLAGS=-DNMRPFLASH_FUZZ make nmrpflash
31 echo core | sudo tee /proc/sys/kernel/core_pattern
32 echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
33 afl-fuzz -i fuzzin -o fuzzout -- ./fuzz
34 echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
36 rm -f $(nmrpflash_OBJ) nmrpflash
39 install -m 755 nmrpflash $(PREFIX)/bin
42 CFLAGS="-mmacosx-version-min=10.6" make release
43 zip nmrpflash-$(VERSION)-macos.zip nmrpflash
45 release/linux: release
46 zip nmrpflash-$(VERSION)-linux.zip nmrpflash
49 zip nmrpflash-$(VERSION)-win32.zip nmrpflash.exe
51 release: clean nmrpflash