From 1d68bab74cfe2323042571662496d89608e7ee79 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Mon, 2 Oct 2017 10:53:44 -0700 Subject: [PATCH] Makefile: Versioning, take three Make sure the build passes if the source is not in a git repository. Again, that means that version information won't be available, but there is only so much we can do about that. Signed-off-by: Guenter Roeck --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d4b96c3..1b88e2a 100644 --- a/Makefile +++ b/Makefile @@ -44,10 +44,14 @@ all: modules # Targets for running make directly in the external module directory: -EXTRA_CFLAGS=-DIT87_DRIVER_VERSION='\"$(shell git describe --long)\"' +ifneq ("","$(wildcard .git/*)") +IT87_CFLAGS=-DIT87_DRIVER_VERSION='\"$(shell git describe --long)\"' +else +IT87_CFLAGS=-DIT87_DRIVER_VERSION='\"\"' +endif modules: - @$(MAKE) EXTRA_CFLAGS=$(EXTRA_CFLAGS) -C $(KERNEL_BUILD) M=$(CURDIR) $@ + @$(MAKE) EXTRA_CFLAGS="$(IT87_CFLAGS)" -C $(KERNEL_BUILD) M=$(CURDIR) $@ clean: @$(MAKE) -C $(KERNEL_BUILD) M=$(CURDIR) $@ -- 2.39.5