Browse Source

Add (and use) git describe to get module version.

Godzil 6 years ago
parent
commit
4db826209e
2 changed files with 7 additions and 3 deletions
  1. 2 2
      kfusd/Makefile
  2. 5 1
      kfusd/kfusd.c

+ 2 - 2
kfusd/Makefile

@@ -5,11 +5,11 @@ else
 KDIR	?= /lib/modules/$(shell uname -r)/build
 PWD	:= $(shell pwd)
 ROOTFS ?=
-
+GIT_DESCRIBE = $(shell git describe --dirty --tags)
 KERNEL_VER ?= 2.6.32.7
 
 default:
-	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) EXTRA_CFLAGS=-I$(PWD)/../include modules
+	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) EXTRA_CFLAGS="-I$(PWD)/../include -DGIT_DESCRIBE='\"${GIT_DESCRIBE}\"'" V=1 modules
 
 install:
 	install -d -m 0755 $(ROOTFS)/lib/modules/$(KERNEL_VER)/kernel/drivers/misc

+ 5 - 1
kfusd/kfusd.c

@@ -90,6 +90,9 @@
 
 #define STATIC
 
+#ifndef GIT_DESCRIBE
+#define GIT_DESCRIBE "unknownversion-dirty"
+#endif
 /* Define this if you want to emit debug messages (adds ~8K) */
 //#define CONFIG_FUSD_DEBUG
 
@@ -284,7 +287,8 @@ DEFINE_SEMAPHORE (fusd_devlist_sem);
 
 //#ifdef MODULE_LICENSE
 MODULE_AUTHOR ("Jeremy Elson <jelson@acm.org> (c)2001");
-MODULE_AUTHOR ("Manoel Trapier <godzil@godzil.net> (c)2009-2012");
+MODULE_AUTHOR ("Manoel Trapier <godzil@godzil.net> (c)2009-2018");
+MODULE_VERSION(GIT_DESCRIBE);
 MODULE_LICENSE ("GPL");
 //#endif