]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
Tweaked makefile to use .config file and kernel headers
authorMike Kershaw <dragorn@kismetwireless.net>
Sat, 29 Sep 2007 15:05:35 +0000 (11:05 -0400)
committerJohannes Berg <johannes@sipsolutions.net>
Sat, 29 Sep 2007 15:40:39 +0000 (17:40 +0200)
Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net>
Makefile
defconfig [new file with mode: 0644]

index 1707f730c04cf18bfc657c05b80478dcaf3a7113..992d5b6e505fe11fb9e678601c603edd2610312d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,25 @@
-# adjust this
-LIBNL = /home/johannes/Projects/libnl/
+-include .config
 
-CFLAGS += -Wall -I$(LIBNL)/include/ -g
-LDFLAGS += -lnl -L$(LIBNL)/lib/
+CC ?= "gcc"
+CFLAGS += -Wall -I/lib/modules/`uname -r`/build/include -g
+LDFLAGS += -lnl
 
-iw:    iw.o interface.o
+OBJS = iw.o interface.o
+ALL = iw
+
+all: verify_config $(ALL)
+
+iw:    $(OBJS)
+       $(CC) $(CFLAGS) $(OBJS) -o iw $(LDFLAGS)
 
 clean:
        rm -f iw *.o *~
+
+verify_config:
+       @if [ ! -r .config ]; then \
+               echo 'Building iw requires a configuration file'; \
+               echo '(.config). See README for more instructions. You can'; \
+               echo 'run "cp defconfig .config" to create an example'; \
+               echo 'configuration.'; \
+               exit 1; \
+       fi
diff --git a/defconfig b/defconfig
new file mode 100644 (file)
index 0000000..d633c73
--- /dev/null
+++ b/defconfig
@@ -0,0 +1,21 @@
+# Example iw build time configuration
+#
+# This file lists the configuration options that are used when building the
+# iw binary. All lines starting with # are ignored. Configuration option
+# lines must be commented out complete, if they are not to be included, i.e.,
+# just setting VARIABLE=n is not disabling that variable.
+#
+# This file is included in Makefile, so variables like CFLAGS and LIBS can also
+# be modified from here. In most cases, these lines should use += in order not
+# to override previous values of the variables.
+
+# Kernel location for GIT NL80211 kernel code (assumed to be running,
+# by default)
+CONFIG_KERNEL_LOC = /lib/modules/`uname -r`/build/
+CFLAGS += -I$(CONFIG_KENREL_LOC)/include
+
+# LibNL location (if not installed)
+# CONFIG_LIBNL_LOC = /home/johannes/Projects/libnl/
+# CFLAGS += -I$(CONFIG_LIBNL_LOC)/include
+# LDFLAGS += -L$(CONFIG_LIBNL_LOC)/lib
+