Ditch the sysvinit stuff
[profile/ivi/iputils.git] / Makefile
1 # Path to parent kernel include files directory
2 LIBC_INCLUDE=/usr/include
3
4 DEFINES= 
5
6 #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
7 LDLIBS=
8 ADDLIB=
9
10 #options if you compile with libc5, and without a bind>=4.9.4 libresolv
11 # NOT AVAILABLE. Please, use libresolv.
12
13 CC=gcc
14 # What a pity, all new gccs are buggy and -Werror does not work. Sigh.
15 #CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -Werror
16 CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
17 CFLAGS=$(CCOPT) $(GLIBCFIX) $(DEFINES) 
18
19 IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
20 IPV6_TARGETS=tracepath6 traceroute6 ping6
21 TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
22
23 LASTTAG:=`git describe HEAD | sed -e 's/-.*//'`
24 TAG:=`date +s%Y%m%d`
25
26 all: $(TARGETS)
27
28
29 tftpd: tftpd.o tftpsubs.o
30 arping: arping.o -lsysfs
31 ping: ping.o ping_common.o
32 ping6: ping6.o ping_common.o -lresolv -lcrypto
33 ping.o ping6.o ping_common.o: ping_common.h
34 tftpd.o tftpsubs.o: tftp.h
35
36 rdisc_srv: rdisc_srv.o
37
38 rdisc_srv.o: rdisc.c
39         $(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
40
41
42 check-kernel:
43 ifeq ($(KERNEL_INCLUDE),)
44         @echo "Please, set correct KERNEL_INCLUDE"; false
45 else
46         @set -e; \
47         if [ ! -r $(KERNEL_INCLUDE)/linux/autoconf.h ]; then \
48                 echo "Please, set correct KERNEL_INCLUDE"; false; fi
49 endif
50
51 modules: check-kernel
52         $(MAKE) KERNEL_INCLUDE=$(KERNEL_INCLUDE) -C Modules
53
54 man:
55         $(MAKE) -C doc man
56
57 html:
58         $(MAKE) -C doc html
59
60 clean:
61         @rm -f *.o $(TARGETS)
62         @$(MAKE) -C Modules clean
63         @$(MAKE) -C doc clean
64
65 snapshot:
66         @if [ "`uname -n`" != "takos" ]; then echo "Not authorized to advance snapshot"; exit 1; fi
67         @date "+[$(TAG)]" > RELNOTES.NEW
68         @echo >>RELNOTES.NEW
69         @git log $(LASTTAG).. | git shortlog >> RELNOTES.NEW
70         @echo >> RELNOTES.NEW
71         @cat RELNOTES >> RELNOTES.NEW
72         @mv RELNOTES.NEW RELNOTES
73         @date "+static char SNAPSHOT[] = \"$(TAG)\";" > SNAPSHOT.h
74         @$(MAKE) -C doc snapshot
75         @$(MAKE) man
76         @git commit -a -m "iputils-$(TAG)"
77         @git tag -s -m "iputils-$(TAG)" $(TAG)
78         @git archive --format=tar --prefix=iputils-$(TAG)/ $(TAG) | bzip2 -9 > ../iputils-$(TAG).tar.bz2
79