Skip to content

Commit

Permalink
add git hash to version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael committed Dec 30, 2023
1 parent 705d560 commit 670fc8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions #define DRIVERVERSION "v5.2.20.2_ohd_THIS_IS_DIRTY"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERSION_HEADER
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VERSION_HEADER = include/rtw_version.h
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) -fno-pie
EXTRA_CFLAGS += -O1
#EXTRA_CFLAGS += -O3
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -1672,4 +1676,5 @@ clean:
rm -fr *.mod.c *.mod *.o *.o.* .*.cmd *.ko *~
rm -fr .tmp_versions
rm -fr .cache.mk

endif
13 changes: 1 addition & 12 deletions include/rtw_version.h
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 670fc8b

Please sign in to comment.