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