1# Path to parent kernel include files directory 2KERNEL_INCLUDE=/usr/src/linux/include 3LIBC_INCLUDE=/usr/include 4 5DEFINES= 6 7#options if you have a bind>=4.9.4 libresolv (or, maybe, glibc) 8LDLIBS=-lresolv 9ADDLIB= 10 11ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h)) 12 ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h)) 13 GLIBCFIX=-Iinclude-glibc -include include-glibc/glibc-bugs.h 14 endif 15endif 16ifeq ($(LIBC_INCLUDE)/bits/socket.h,$(wildcard $(LIBC_INCLUDE)/bits/socket.h)) 17 GLIBCFIX=-Iinclude-glibc -include include-glibc/glibc-bugs.h 18endif 19 20ifeq ($(KERNEL_INCLUDE)/linux/pfkeyv2.h,$(wildcard $(KERNEL_INCLUDE)/linux/pfkeyv2.h)) 21 SUBDIRS=libipsec setkey 22 LDLIBS+=-Llibipsec -lipsec 23 IPSECDEF=-DDO_IPSEC -Ilibipsec 24endif 25 26 27#options if you compile with libc5, and without a bind>=4.9.4 libresolv 28# NOT AVAILABLE. Please, use libresolv. 29 30CC=gcc 31# What a pity, all new gccs are buggy and -Werror does not work. Sigh. 32#CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g -Werror 33CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g 34CFLAGS=$(CCOPT) $(GLIBCFIX) -I$(KERNEL_INCLUDE) -I../include $(IPSECDEF) $(DEFINES) 35 36IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd 37IPV6_TARGETS=ping6 tracepath6 traceroute6 38TARGETS=$(IPV6_TARGETS) #Gerald20060905, remarked. $(IPV4_TARGETS) 39 40all: check-kernel subdirs $(TARGETS) 41 42 43tftpd: tftpd.o tftpsubs.o 44ping: ping.o ping_common.o 45ping6: ping6.o ping_common.o 46ping.o ping6.o ping_common.o: ping_common.h 47tftpd.o tftpsubs.o: tftp.h 48 49rdisc_srv: rdisc_srv.o 50 51rdisc_srv.o: rdisc.c 52 $(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c 53 54check-kernel: 55ifeq ($(KERNEL_INCLUDE),) 56 @echo "Please, set correct KERNEL_INCLUDE"; false 57else 58 @set -e; \ 59 if [ ! -r $(KERNEL_INCLUDE)/linux/autoconf.h ]; then \ 60 echo "Please, set correct KERNEL_INCLUDE"; false; fi 61endif 62 63subdirs: 64ifneq ($(SUBDIRS),) 65 @set -e; \ 66 for i in $(SUBDIRS); \ 67 do $(MAKE) -C $$i; done; \ 68 cd racoon; ./configure; make 69endif 70 71 72modules: check-kernel 73 $(MAKE) KERNEL_INCLUDE=$(KERNEL_INCLUDE) -C Modules 74 75man: 76 $(MAKE) -C doc man 77 78html: 79 $(MAKE) -C doc html 80 81clean: 82 @rm -f *.o $(TARGETS) 83 @$(MAKE) -C Modules clean 84 @$(MAKE) -C doc clean 85ifneq ($(SUBDIRS),) 86 @for i in $(SUBDIRS); \ 87 do $(MAKE) -C $$i clean; done 88 @if [ -f racoon/Makefile ]; then \ 89 $(MAKE) -C racoon distclean; fi 90endif 91 92snapshot: clean 93 @if [ ! -e RELNOTES.xxyyzz ]; then echo "Where are RELNOTES?"; exit 1; fi 94 @if [ "`uname -n`" != "mops" ]; then echo "Not authorized to advance snapshot"; exit 1; fi 95 @if [ "`pwd`" != "/home/src/BH/hash/iputils" ]; then echo "Wrong place to do snapshot"; exit 1; fi 96 @if [ -e RELNOTES.bak ]; then echo "Not clean; check tree"; exit 1; fi 97 @cp RELNOTES RELNOTES.bak 98 @date "+[%y%m%d]" > RELNOTES 99 @cat RELNOTES.xxyyzz >> RELNOTES 100 @echo >> RELNOTES 101 @cat RELNOTES.bak >> RELNOTES 102 @date "+static char SNAPSHOT[] = \"%y%m%d\";" > SNAPSHOT.h 103 @$(MAKE) -C doc snapshot 104 @rm -f RELNOTES.xxyyzz RELNOTES.bak 105 @make man 106 @cd ..; tar c iputils | bzip2 -9c > `date +iputils-ss%y%m%d.tar.bz2` 107