blob: edda026e90bfd9fbde372a4215dc3d57a4bba66e [file] [log] [blame]
Mike Kershaw7153dbf2007-09-29 11:05:35 -04001-include .config
Johannes Bergcad53b32007-09-28 22:11:34 +02002
Johannes Berg82afaeb2008-04-02 17:40:05 +02003MAKEFLAGS += --no-print-directory
4
Mike Kershaw7153dbf2007-09-29 11:05:35 -04005CC ?= "gcc"
Johannes Berg25e42ae2008-04-02 16:49:26 +02006CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
7CFLAGS += -I/lib/modules/`uname -r`/build/include
8CFLAGS += -O2 -g
Mike Kershaw7153dbf2007-09-29 11:05:35 -04009LDFLAGS += -lnl
Johannes Bergcad53b32007-09-28 22:11:34 +020010
Luis Carlos Cobo3d1e8702008-04-01 12:03:41 -070011OBJS = iw.o interface.o info.o station.o util.o mpath.o
Mike Kershaw7153dbf2007-09-29 11:05:35 -040012ALL = iw
Johannes Berg82afaeb2008-04-02 17:40:05 +020013ifneq ($(shell which cgcc),"")
14DEF := check
15else
16DEF := all
17endif
18
19default: $(DEF)
Mike Kershaw7153dbf2007-09-29 11:05:35 -040020
21all: verify_config $(ALL)
22
23iw: $(OBJS)
24 $(CC) $(CFLAGS) $(OBJS) -o iw $(LDFLAGS)
Johannes Bergcad53b32007-09-28 22:11:34 +020025
Johannes Berg82afaeb2008-04-02 17:40:05 +020026check:
27 @$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
28
Johannes Bergcad53b32007-09-28 22:11:34 +020029clean:
Johannes Berg82afaeb2008-04-02 17:40:05 +020030 @rm -f iw *.o *~
Mike Kershaw7153dbf2007-09-29 11:05:35 -040031
32verify_config:
33 @if [ ! -r .config ]; then \
34 echo 'Building iw requires a configuration file'; \
Johannes Berg11b24c22007-11-03 14:55:04 +000035 echo '(.config). cp defconfig .config and edit.'; \
Mike Kershaw7153dbf2007-09-29 11:05:35 -040036 exit 1; \
37 fi