From 918ddfcaa4e55946e662d3b4b2766e92084c43c6 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Sun, 9 Mar 2008 14:30:23 +0000 Subject: The main Makefile now knows if we don't have kernel source. * Nicer handling of situations where we don't have kernel source and don't really need it ('make clean', mainly). * The test for hotplug firmware is now from the same .config file. No more strange message about autoconf.h . git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3976 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 259fa36..b39e566 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,13 @@ endif KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2) KINCLUDES:=$(KSRC)/include +KCONFIG:=$(KSRC)/.config +ifneq (,$(wildcard $(KCONFIG))) + HAS_KSRC=yes +else + HAS_KSRC=no +endif + ifeq ($(KVERS_MAJ),2.4) BUILDVER:=linux24 else @@ -54,7 +61,9 @@ ifeq ($(BUILDVER),linux26) DYNFS=yes UDEVRULES=yes endif - HOTPLUG_FIRMWARE:=$(shell if grep CONFIG_FW_LOADER $(KINCLUDES)/linux/autoconf.h | grep -q undef; then echo "no"; else echo "yes"; fi) + ifeq (yes,$(HAS_KSRC)) + HOTPLUG_FIRMWARE:=$(shell if grep '^CONFIG_FW_LOADER=[ym]' $(KCONFIG); then echo "no"; else echo "yes"; fi) + endif endif # If the file .zaptel.makeopts is present in your home directory, you can @@ -276,7 +285,10 @@ programs: libs utils utils: $(BINS) utils-subdirs modules: prereq - @if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi +ifeq (no,$(HAS_KSRC)) + echo "You do not appear to have the sources for the $(KVERS) kernel installed." + exit 1 +endif $(KMAKE) modules version.h: @@ -555,7 +567,9 @@ clean: rm -f $(BINS) rm -f *.o ztcfg tzdriver sethdlc sethdlc-new rm -f $(LTZ_SO) $(LTZ_A) *.lo +ifeq (yes,$(HAS_KSRC)) $(KMAKE) clean +endif @for dir in $(SUBDIRS_UTILS_ALL); do \ $(MAKE) -C $$dir clean; \ done -- cgit v1.2.3