From 670fc8b3cd28f565b3a669576bfa57842bbb045b Mon Sep 17 00:00:00 2001 From: Raphael Date: Sun, 31 Dec 2023 00:29:20 +0100 Subject: [PATCH] add git hash to version number --- ...e DRIVERVERSION \"v5.2.20.2_ohd_THIS_IS_DIRTY\"" | 1 + Makefile | 5 +++++ include/rtw_version.h | 13 +------------ 3 files changed, 7 insertions(+), 12 deletions(-) create mode 100644 "#define DRIVERVERSION \"v5.2.20.2_ohd_THIS_IS_DIRTY\"" diff --git "a/#define DRIVERVERSION \"v5.2.20.2_ohd_THIS_IS_DIRTY\"" "b/#define DRIVERVERSION \"v5.2.20.2_ohd_THIS_IS_DIRTY\"" new file mode 100644 index 0000000..8b6ff93 --- /dev/null +++ "b/#define DRIVERVERSION \"v5.2.20.2_ohd_THIS_IS_DIRTY\"" @@ -0,0 +1 @@ +ERSION_HEADER diff --git a/Makefile b/Makefile index d40cc58..cab606f 100755 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +VERSION_HEADER = include/rtw_version.h EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) -fno-pie EXTRA_CFLAGS += -O1 #EXTRA_CFLAGS += -O3 @@ -1603,6 +1604,8 @@ export CONFIG_RTL8812AU = m all: modules modules: + @echo '#define DRIVERVERSION "v5.2.20.2_ohd_$(shell git rev-parse --short HEAD)"' > $(VERSION_HEADER) + $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd) O="$(KBUILD_OUTPUT)" modules strip: @@ -1658,6 +1661,7 @@ config_r: .PHONY: modules clean clean: + @echo '#define DRIVERVERSION "v5.2.20.2_ohd_THIS_IS_DIRTY"' > $(VERSION_HEADER) #$(MAKE) -C $(KSRC) M=$(shell pwd) clean cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/*.o.* */*/*/.*.cmd */*/*/*.ko cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/*.o.* */*/.*.cmd */*/*.ko @@ -1672,4 +1676,5 @@ clean: rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko *~ rm -fr .tmp_versions rm -fr .cache.mk + endif diff --git a/include/rtw_version.h b/include/rtw_version.h index 042f3b4..9711e49 100644 --- a/include/rtw_version.h +++ b/include/rtw_version.h @@ -1,12 +1 @@ -#ifndef RTW_VERSION_H -#define RTW_VERSION_H - -// Helper macro to convert a macro to a string -#define STR_HELPER(x) #x -#define STR(x) STR_HELPER(x) - -// Generate the version string with the current date in the format v5.2.20.2_OHD_20122023 -#define CURRENT_DATE __DATE__ -#define DRIVERVERSION "v5.2.20.2_OHD_" STR(CURRENT_DATE[4]) STR(CURRENT_DATE[5]) STR(CURRENT_DATE[7]) STR(CURRENT_DATE[8]) STR(CURRENT_DATE[9]) STR(CURRENT_DATE[22]) STR(CURRENT_DATE[23]) - -#endif // RTW_VERSION_H +#define DRIVERVERSION "v5.2.20.2_ohd_THIS_IS_DIRTY"