Few fixes allow cross compilation
authorPhilip A. Prindeville <philipp_subx@redfish-solutions.com>
Thu, 16 Jul 2009 16:18:49 +0000 (09:18 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Thu, 16 Jul 2009 16:18:49 +0000 (09:18 -0700)
Makefile

index 0ab7d2788f44fa3931f2deecb1e31abcd5dc3674..4bf23f8ece0a5039a61070f3ba26fb167ccbe410 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 export KMODDIR?=       updates
 KMODDIR_ARG:=   "INSTALL_MOD_DIR=$(KMODDIR)"
-ifneq ($(origin $(KLIB)), undefined)
+ifneq ($(origin KLIB), undefined)
 KMODPATH_ARG:=  "INSTALL_MOD_PATH=$(KLIB)"
 else
 export KLIB:=          /lib/modules/$(shell uname -r)
@@ -11,6 +11,8 @@ MODPROBE := /sbin/modprobe
 MADWIFI=$(shell $(MODPROBE) -l ath_pci)
 OLD_IWL=$(shell $(MODPROBE) -l iwl4965)
 
+DESTDIR?=
+
 ifneq ($(KERNELRELEASE),)
 
 include $(M)/$(COMPAT_CONFIG)
@@ -58,21 +60,25 @@ $(CREL_CHECK):
        @touch $@
        @md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK)
 
-install: uninstall modules
+install: uninstall install-modules install-scripts
+
+install-modules: modules
        $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
                modules_install
+
+install-scripts:
        @# All the scripts we can use
-       @mkdir -p /usr/lib/compat-wireless/
-       @install scripts/modlib.sh      /usr/lib/compat-wireless/
-       @install scripts/madwifi-unload /usr/sbin/
+       @mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
+       @install scripts/modlib.sh      $(DESTDIR)/usr/lib/compat-wireless/
+       @install scripts/madwifi-unload $(DESTDIR)/usr/sbin/
        @# This is to allow switching between drivers without blacklisting
-       @install scripts/athenable      /usr/sbin/
-       @install scripts/b43enable      /usr/sbin/
-       @install scripts/iwl-enable     /usr/sbin/
-       @install scripts/athload        /usr/sbin/
-       @install scripts/b43load        /usr/sbin/
-       @install scripts/iwl-load       /usr/sbin/
-       @if [ ! -z $(MADWIFI) ]; then \
+       @install scripts/athenable      $(DESTDIR)/usr/sbin/
+       @install scripts/b43enable      $(DESTDIR)/usr/sbin/
+       @install scripts/iwl-enable     $(DESTDIR)/usr/sbin/
+       @install scripts/athload        $(DESTDIR)/usr/sbin/
+       @install scripts/b43load        $(DESTDIR)/usr/sbin/
+       @install scripts/iwl-load       $(DESTDIR)/usr/sbin/
+       @if [ ! -z $(MADWIFI) && -z "$(DESTDIR)" ]; then \
                echo ;\
                echo -n "Note: madwifi detected, we're going to disable it. "  ;\
                echo "If you would like to enable it later you can run:"  ;\
@@ -81,7 +87,7 @@ install: uninstall modules
                echo Running athenable ath5k...;\
                /usr/sbin/athenable ath5k ;\
        fi
-       @if [ ! -z $(OLD_IWL) ]; then \
+       @if [ ! -z $(OLD_IWL) && -z "$(DESTDIR)" ]; then \
                echo ;\
                echo -n "Note: iwl4965 detected, we're going to disable it. "  ;\
                echo "If you would like to enable it later you can run:"  ;\