]> git.proxmox.com Git - mirror_iproute2.git/blob - Makefile
config: put CFLAGS/LDLIBS in config.mk
[mirror_iproute2.git] / Makefile
1 # Top level Makefile for iproute2
2
3 ifeq ($(VERBOSE),0)
4 MAKEFLAGS += --no-print-directory
5 endif
6
7 PREFIX?=/usr
8 LIBDIR?=$(PREFIX)/lib
9 SBINDIR?=/sbin
10 CONFDIR?=/etc/iproute2
11 DATADIR?=$(PREFIX)/share
12 HDRDIR?=$(PREFIX)/include/iproute2
13 DOCDIR?=$(DATADIR)/doc/iproute2
14 MANDIR?=$(DATADIR)/man
15 ARPDDIR?=/var/lib/arpd
16 KERNEL_INCLUDE?=/usr/include
17 BASH_COMPDIR?=$(DATADIR)/bash-completion/completions
18
19 # Path to db_185.h include
20 DBM_INCLUDE:=$(DESTDIR)/usr/include
21
22 SHARED_LIBS = y
23
24 DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
25 ifneq ($(SHARED_LIBS),y)
26 DEFINES+= -DNO_SHARED_LIBS
27 endif
28
29 DEFINES+=-DCONFDIR=\"$(CONFDIR)\"
30
31 #options for decnet
32 ADDLIB+=dnet_ntop.o dnet_pton.o
33
34 #options for ipx
35 ADDLIB+=ipx_ntop.o ipx_pton.o
36
37 #options for mpls
38 ADDLIB+=mpls_ntop.o mpls_pton.o
39
40 CC := gcc
41 HOSTCC ?= $(CC)
42 DEFINES += -D_GNU_SOURCE
43 # Turn on transparent support for LFS
44 DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
45 CCOPTS = -O2
46 WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
47 WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
48
49 CFLAGS := $(WFLAGS) $(CCOPTS) -I../include $(DEFINES) $(CFLAGS)
50 YACCFLAGS = -d -t -v
51
52 SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
53
54 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
55 LDLIBS += $(LIBNETLINK)
56
57 all: config.mk
58 @set -e; \
59 for i in $(SUBDIRS); \
60 do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done
61
62 config.mk:
63 sh configure $(KERNEL_INCLUDE)
64
65 install: all
66 install -m 0755 -d $(DESTDIR)$(SBINDIR)
67 install -m 0755 -d $(DESTDIR)$(CONFDIR)
68 install -m 0755 -d $(DESTDIR)$(ARPDDIR)
69 install -m 0755 -d $(DESTDIR)$(HDRDIR)
70 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples
71 install -m 0755 -d $(DESTDIR)$(DOCDIR)/examples/diffserv
72 install -m 0644 README.iproute2+tc $(shell find examples -maxdepth 1 -type f) \
73 $(DESTDIR)$(DOCDIR)/examples
74 install -m 0644 $(shell find examples/diffserv -maxdepth 1 -type f) \
75 $(DESTDIR)$(DOCDIR)/examples/diffserv
76 @for i in $(SUBDIRS) doc; do $(MAKE) -C $$i install; done
77 install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONFDIR)
78 install -m 0755 -d $(DESTDIR)$(BASH_COMPDIR)
79 install -m 0644 bash-completion/tc $(DESTDIR)$(BASH_COMPDIR)
80 install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR)
81
82 snapshot:
83 echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
84 > include/SNAPSHOT.h
85
86 clean:
87 @for i in $(SUBDIRS) doc; \
88 do $(MAKE) $(MFLAGS) -C $$i clean; done
89
90 clobber:
91 touch config.mk
92 $(MAKE) $(MFLAGS) clean
93 rm -f config.mk cscope.*
94
95 distclean: clobber
96
97 cscope:
98 cscope -b -q -R -Iinclude -sip -slib -smisc -snetem -stc
99
100 .EXPORT_ALL_VARIABLES: