Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 1 | -include .config |
Johannes Berg | cad53b3 | 2007-09-28 22:11:34 +0200 | [diff] [blame] | 2 | |
Johannes Berg | 82afaeb | 2008-04-02 17:40:05 +0200 | [diff] [blame^] | 3 | MAKEFLAGS += --no-print-directory |
| 4 | |
Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 5 | CC ?= "gcc" |
Johannes Berg | 25e42ae | 2008-04-02 16:49:26 +0200 | [diff] [blame] | 6 | CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration |
| 7 | CFLAGS += -I/lib/modules/`uname -r`/build/include |
| 8 | CFLAGS += -O2 -g |
Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 9 | LDFLAGS += -lnl |
Johannes Berg | cad53b3 | 2007-09-28 22:11:34 +0200 | [diff] [blame] | 10 | |
Luis Carlos Cobo | 3d1e870 | 2008-04-01 12:03:41 -0700 | [diff] [blame] | 11 | OBJS = iw.o interface.o info.o station.o util.o mpath.o |
Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 12 | ALL = iw |
Johannes Berg | 82afaeb | 2008-04-02 17:40:05 +0200 | [diff] [blame^] | 13 | ifneq ($(shell which cgcc),"") |
| 14 | DEF := check |
| 15 | else |
| 16 | DEF := all |
| 17 | endif |
| 18 | |
| 19 | default: $(DEF) |
Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 20 | |
| 21 | all: verify_config $(ALL) |
| 22 | |
| 23 | iw: $(OBJS) |
| 24 | $(CC) $(CFLAGS) $(OBJS) -o iw $(LDFLAGS) |
Johannes Berg | cad53b3 | 2007-09-28 22:11:34 +0200 | [diff] [blame] | 25 | |
Johannes Berg | 82afaeb | 2008-04-02 17:40:05 +0200 | [diff] [blame^] | 26 | check: |
| 27 | @$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc" |
| 28 | |
Johannes Berg | cad53b3 | 2007-09-28 22:11:34 +0200 | [diff] [blame] | 29 | clean: |
Johannes Berg | 82afaeb | 2008-04-02 17:40:05 +0200 | [diff] [blame^] | 30 | @rm -f iw *.o *~ |
Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 31 | |
| 32 | verify_config: |
| 33 | @if [ ! -r .config ]; then \ |
| 34 | echo 'Building iw requires a configuration file'; \ |
Johannes Berg | 11b24c2 | 2007-11-03 14:55:04 +0000 | [diff] [blame] | 35 | echo '(.config). cp defconfig .config and edit.'; \ |
Mike Kershaw | 7153dbf | 2007-09-29 11:05:35 -0400 | [diff] [blame] | 36 | exit 1; \ |
| 37 | fi |