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 <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck
2017-10-02 10:53:44 -07:00
parent 3fde481373
commit 1d68bab74c

View File

@@ -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) $@