Create zip files when release-building
[oweals/nmrpflash.git] / Makefile
1 CC ?= gcc
2 PREFIX ?= /usr/local
3 VERSION = $(shell git describe --always)
4 CFLAGS += -Wall -g -DNMRPFLASH_VERSION=\"$(VERSION)\"
5 LIBS = -lpcap
6
7 .PHONY: clean install release release/osx release/linux release/win32
8
9 nmrpflash: nmrp.o tftp.o ethsock.o main.o
10         $(CC) $(CFLAGS) -o nmrpflash nmrp.o tftp.o ethsock.o main.o $(LIBS)
11
12 nmrp.o: nmrp.c nmrpd.h
13         $(CC) $(CFLAGS) -c -o nmrp.o nmrp.c
14
15 tftp.o: tftp.c nmrpd.h
16         $(CC) $(CFLAGS) -c -o tftp.o tftp.c
17
18 ethsock.o: ethsock.c nmrpd.h
19         $(CC) $(CFLAGS) -c -o ethsock.o ethsock.c
20
21 main.o: main.c nmrpd.h
22         $(CC) $(CFLAGS) -c -o main.o main.c
23
24 clean:
25         rm -f nmrp.o tftp.o main.o ethsock.o nmrpflash nmrpflash.exe
26
27 install: nmrpflash
28         install -m 755 nmrpflash $(PREFIX)/bin
29
30 release/osx:
31         CFLAGS="-arch i686 -arch x86_64" make release
32         zip nmrpflash-osx.zip nmrpflash
33
34 release/linux: release
35         zip nmrpflash-linux.zip nmrpflash
36
37 release/win32:
38         zip nmrpflash-win32.zip nmrpflash.exe
39
40 release: clean nmrpflash
41         strip nmrpflash