]> git.ipfire.org Git - thirdparty/iw.git/blame - Makefile
add link command
[thirdparty/iw.git] / Makefile
CommitLineData
7153dbf3 1-include .config
cad53b3f 2
82afaeb7
JB
3MAKEFLAGS += --no-print-directory
4
30345664
RW
5PREFIX ?= /usr
6BINDIR ?= $(PREFIX)/bin
7MANDIR ?= $(PREFIX)/share/man
26ae7e4e 8PKG_CONFIG ?= pkg-config
30345664 9
848794ec 10MKDIR ?= mkdir -p
b0f79c45 11INSTALL ?= install
7153dbf3 12CC ?= "gcc"
30345664 13
e0738dbb 14CFLAGS ?= -O2 -g
dfd13ee5 15CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
cad53b3f 16
febeb0c0
JB
17OBJS = iw.o genl.o event.o info.o phy.o \
18 interface.o ibss.o station.o util.o \
19 mesh.o mpath.o scan.o reg.o version.o \
20 reason.o status.o connect.o link.o
7153dbf3 21ALL = iw
82afaeb7 22
26ae7e4e
KH
23NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
24NL2FOUND := $(shell $(PKG_CONFIG) --atleast-version=2 libnl-2.0 && echo Y)
dfd13ee5
PE
25
26ifeq ($(NL1FOUND),Y)
27NLLIBNAME = libnl-1
28endif
29
30ifeq ($(NL2FOUND),Y)
31CFLAGS += -DCONFIG_LIBNL20
32LIBS += -lnl-genl
33NLLIBNAME = libnl-2.0
34endif
35
34b6e0f5
PR
36ifeq ($(NLLIBNAME),)
37$(error Cannot find development files for any supported version of libnl)
38endif
39
98be8972
JB
40LIBS += $(shell pkg-config --libs $(NLLIBNAME))
41CFLAGS += $(shell pkg-config --cflags $(NLLIBNAME))
dfd13ee5 42
888e1192
JB
43ifeq ($(V),1)
44Q=
45NQ=true
46else
47Q=@
48NQ=echo
49endif
50
a0f7f1c5
BB
51all: version_check $(ALL)
52
53version_check:
dfd13ee5
PE
54ifeq ($(NL2FOUND),Y)
55else
56ifeq ($(NL1FOUND),Y)
57else
58 $(error No libnl found)
59endif
60endif
7153dbf3 61
d711f013 62
133b069f
JB
63VERSION_OBJS := $(filter-out version.o, $(OBJS))
64
65version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h iw.h Makefile \
66 $(wildcard .git/index .git/refs/tags)
67 @$(NQ) ' GEN ' $@
68 $(Q)./version.sh $@
69
70%.o: %.c iw.h nl80211.h
888e1192 71 @$(NQ) ' CC ' $@
f9c714d7 72 $(Q)$(CC) $(CFLAGS) -c -o $@ $<
888e1192 73
7153dbf3 74iw: $(OBJS)
888e1192 75 @$(NQ) ' CC ' iw
9b2e7e6e 76 $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
cad53b3f 77
82afaeb7 78check:
888e1192 79 $(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
82afaeb7 80
b0f79c45
JB
81%.gz: %
82 @$(NQ) ' GZIP' $<
83 $(Q)gzip < $< > $@
84
85install: iw iw.8.gz
86 @$(NQ) ' INST iw'
30345664
RW
87 $(Q)$(MKDIR) $(DESTDIR)$(BINDIR)
88 $(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(BINDIR) iw
b0f79c45 89 @$(NQ) ' INST iw.8'
30345664
RW
90 $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/
91 $(Q)$(INSTALL) -m 644 -t $(DESTDIR)$(MANDIR)/man8/ iw.8.gz
b0f79c45 92
cad53b3f 93clean:
133b069f 94 $(Q)rm -f iw *.o *~ *.gz version.c *-stamp