Skip to content

Commit

Permalink
lk2nd: util: Add version tag generation
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Travkin <[email protected]>
  • Loading branch information
TravMurav committed Aug 29, 2023
1 parent 9390f66 commit c31d8d1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm/compile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ $(BUILDDIR)/%.o: %.c $(SRCDEPS)
@echo compiling $<
$(NOECHO)$(CC) $(CFLAGS) $(THUMBCFLAGS) --std=c99 $(INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@

$(BUILDDIR)/%.o: $(BUILDDIR)/%.c $(SRCDEPS)
@$(MKDIR)
@echo compiling $<
$(NOECHO)$(CC) $(CFLAGS) $(THUMBCFLAGS) --std=c99 $(INCLUDES) -c $< -MD -MT $@ -MF $(@:%o=%d) -o $@

$(BUILDDIR)/%.o: %.cpp $(SRCDEPS)
@$(MKDIR)
@echo compiling $<
Expand Down
6 changes: 6 additions & 0 deletions lk2nd/include/lk2nd/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef LK2ND_VERSION_H
#define LK2ND_VERSION_H

extern const char* LK2ND_VERSION;

#endif /* LK2ND_VERSION_H */
14 changes: 14 additions & 0 deletions lk2nd/util/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,17 @@ OBJS += \
$(LOCAL_DIR)/cmdline.o \
$(LOCAL_DIR)/lkfdt.o \
$(LOCAL_DIR)/mmu.o \

# Generate the version tag from VCS

LK2ND_VERSION := $(shell $(LK_TOP_DIR)/lk2nd/scripts/describe-version.sh)
VERSION_FILE := $(BUILDDIR)/$(LOCAL_DIR)/version.c

.PHONY: $(VERSION_FILE)
$(VERSION_FILE):
@$(MKDIR)
@echo generating $@ for lk2nd $(LK2ND_VERSION)
@echo "const char* LK2ND_VERSION = \"$(LK2ND_VERSION)\";" > $@

OBJS += \
$(LOCAL_DIR)/version.o \

0 comments on commit c31d8d1

Please sign in to comment.