Add Linux Makefile
[uci2wb.git] / Makefile
1 srcdir = .
2
3 CC?=gcc
4 CFLAGS?= -O2 -s
5 LDFLAGS?= -lpthread
6 VERSION?=`grep 'define VERSION' UCI2WB.c | sed -e 's/.*"\(.*\)".*/\1/'`
7
8 ALL= uci2wb uci2wb.6.gz
9
10 all: ${ALL}
11
12 uci2wb: UCI2WB.c
13         $(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) UCI2WB.c -o uci2wb
14
15 install: ${ALL}
16         install -d -m0755 $(DESTDIR)/usr/games
17         cp -u ${srcdir}/uci2wb $(DESTDIR)/usr/games
18         install -d -m0755 $(DESTDIR)/usr/share/man/man6
19         cp -u ${srcdir}/uci2wb.6.gz $(DESTDIR)/usr/share/man/man6
20
21 uci2wb.6.gz: uci2wb.pod
22         pod2man -s 6 uci2wb.pod | gzip -9n > uci2wb.6.gz
23
24 clean:
25         rm -f ${ALL}
26
27 dist-clean:
28         rm -f ${ALL} *~ md5sums
29
30 dist:
31         install -d -m0755 UCI2WB
32         rm -f uci2wb.tar uci2wb.tar.gz
33         cp UCI2WB.c uci2wb.pod Makefile README.txt UCI2WB
34         md5sum UCI2WB/* > UCI2WB/md5sums
35         tar -cvvf uci2wb-$(VERSION).tar UCI2WB
36         gzip uci2wb-$(VERSION).tar
37         rm UCI2WB/*
38         rmdir UCI2WB
39
40 uninstall:
41         rm -f $(DESTDIR)/usr/share/man/man6/uci2wb.6.gz
42         rm -f $(DESTDIR)/usr/games/uci2wb
43