]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blob - Makefile
(Logical change 1.3)
[lisovros/iproute2_canprio.git] / Makefile
1 # Path to parent kernel include files directory
2 DESTDIR=
3 SBINDIR=/sbin
4 CONFDIR=/etc/iproute2
5 DOCDIR=/usr/doc/iproute2
6
7 KERNEL_INCLUDE=/usr/src/linux/include
8 LIBC_INCLUDE=/usr/include
9
10 DEFINES= -DRESOLVE_HOSTNAMES
11
12 #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
13 LDLIBS=-lresolv
14 ADDLIB=
15
16 #options if you compile with libc5, and without a bind>=4.9.4 libresolv
17 #LDLIBS=
18 #ADDLIB=inet_ntop.o inet_pton.o
19
20 #options for decnet
21 ADDLIB+=dnet_ntop.o dnet_pton.o
22
23 #options for ipx
24 ADDLIB+=ipx_ntop.o ipx_pton.o
25
26 ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h))
27   ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h))
28     GLIBCFIX=-I../include-glibc -include ../include-glibc/glibc-bugs.h
29   endif
30 endif
31 ifeq ($(LIBC_INCLUDE)/bits/socket.h,$(wildcard $(LIBC_INCLUDE)/bits/socket.h))
32   GLIBCFIX=-I../include-glibc -I/usr/include/db3 -include ../include-glibc/glibc-bugs.h
33 endif
34
35
36 CC = gcc
37 CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
38 CFLAGS = $(CCOPTS) $(GLIBCFIX) -I$(KERNEL_INCLUDE) -I../include $(DEFINES)
39
40 LDLIBS += -L../lib -lnetlink -lutil
41
42 SUBDIRS=lib ip tc misc
43
44 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
45
46 all: check-kernel
47         @set -e; \
48         for i in $(SUBDIRS); \
49         do $(MAKE) -C $$i; done
50
51 check-kernel:
52 ifeq ($(KERNEL_INCLUDE),)
53         @echo "Please, set correct KERNEL_INCLUDE"; false
54 else
55         @set -e; \
56         if [ ! -r $(KERNEL_INCLUDE)/linux/autoconf.h ]; then \
57                 echo "Please, compile the kernel first"; false; fi
58 endif
59
60 install: all
61         install -m 0755 -d $(DESTDIR)$(SBINDIR)
62         install -m 0755 -d $(DESTDIR)$(CONFDIR)
63         install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
64         install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
65         install -m 0644 README.iproute2+tc $(shell find examples -type f -maxdepth 1) $(DESTDIR)$(DOCDIR)/examples
66         install -m 0644 $(shell echo examples/diffserv/*) $(DESTDIR)$(DOCDIR)/examples/diffserv
67         @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
68         @cd etc/iproute2; for i in *; do \
69                 if [ ! -e $(DESTDIR)$(CONFDIR)/$$i ]; then \
70                         echo install -m 0644 $$i $(DESTDIR)$(CONFDIR); \
71                         install -m 0644 $$i $(DESTDIR)$(CONFDIR); fi; done
72
73 clean:
74         for i in $(SUBDIRS) doc; \
75         do $(MAKE) -C $$i clean; done
76
77 .EXPORT_ALL_VARIABLES: