]> git.sur5r.net Git - groeck-it87/blobdiff - Makefile
Makefile: Versioning, take three
[groeck-it87] / Makefile
index d4b96c3b26400d777a761a72fe20fe05c30cf2d0..1b88e2a01ce096f7a5e697b9cc51f297ac5c0150 100644 (file)
--- 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='\"<unknown>\"'
+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) $@