Skip to content

Commit

Permalink
Build: Read rev-id from file.
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher committed Apr 20, 2024
1 parent 0c8b645 commit bd35100
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ rwildcard=$(foreach d,$(wildcard $1*), \
$(filter $(subst *,%,$2),$d))

SRCFILES=$(call rwildcard,$(SRCDIR)/,*.c *.S)
VERSION_CFLAGS=-DCOMMIT_ID=\"$(shell git -C $(SRCDIR) rev-parse --short HEAD)\"

ifeq ($(REV_ID),)
ifneq (,$(wildcard .rev-id))
REV_ID=$(shell cat .rev-id)
endif
ifeq ($(REV_ID),)
REV_ID=$(shell git -C $(SRCDIR) rev-parse --short HEAD)
endif
ifeq ($(REV_ID),)
REV_ID=unknown
endif
endif
VERSION_CFLAGS=-DCOMMIT_ID=\"$(REV_ID)\"

0 comments on commit bd35100

Please sign in to comment.