Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/duo_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
VERSION_NUMBER=$(echo $LATEST_TAG | sed "s/${BRANCH_SUFFIX}//g")
VERSION_MAJOR=$(echo $VERSION_NUMBER | cut -d. -f1)
VERSION_MINOR=$(echo $VERSION_NUMBER | cut -d. -f2)
echo "Revisions:"
git rev-list $LATEST_TAG..HEAD
BUILD_NUMBER=$(git rev-list --count $LATEST_TAG..HEAD)
fi
FULL_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$BUILD_NUMBER"
Expand Down
31 changes: 15 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: all clean install serial upload compute_version

ifeq ($(OS),Windows_NT) # Windows
BINDIR="C:/Program Files (x86)/Atmel/Studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/"
AVRDUDEDIR="$(shell echo "$$LOCALAPPDATA")/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18/bin"
Expand Down Expand Up @@ -67,19 +69,6 @@ BOOTEND = 0x7e
# The branch/tag suffix for this device
BRANCH_SUFFIX=d

# Fetch tags, determine version numbers based on the latest tag, and slice off the branch suffix
VORTEX_VERSION_MAJOR ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list "*$(BRANCH_SUFFIX)" | sort -V | tail -n1 | cut -d. -f1)
VORTEX_VERSION_MINOR ?= $(shell git tag --list "*$(BRANCH_SUFFIX)" | sort -V | tail -n1 | sed 's/$(BRANCH_SUFFIX)$$//' | cut -d. -f2)
VORTEX_BUILD_NUMBER ?= $(shell git rev-list --count HEAD)

# If no tags are found, default to 0.1.0
VORTEX_VERSION_MAJOR := $(if $(VORTEX_VERSION_MAJOR),$(VORTEX_VERSION_MAJOR),0)
VORTEX_VERSION_MINOR := $(if $(VORTEX_VERSION_MINOR),$(VORTEX_VERSION_MINOR),1)
VORTEX_BUILD_NUMBER := $(if $(VORTEX_BUILD_NUMBER),$(VORTEX_BUILD_NUMBER),0)

# Combine into a full version number
VORTEX_VERSION_NUMBER := $(VORTEX_VERSION_MAJOR).$(VORTEX_VERSION_MINOR).$(VORTEX_BUILD_NUMBER)

# compiler defines
DEFINES=\
-DVORTEX_VERSION_MAJOR=$(VORTEX_VERSION_MAJOR) \
Expand Down Expand Up @@ -147,7 +136,7 @@ DFILES = $(SRCS:.cpp=.d)
# Target name
TARGET = vortex

all: $(TARGET).hex
all: compute_version $(TARGET).hex
$(OBJDUMP) --disassemble --source --line-numbers --demangle --section=.text $(TARGET).elf > $(TARGET).lst
$(NM) --numeric-sort --line-numbers --demangle --print-size --format=s $(TARGET).elf > $(TARGET).map
chmod +x avrsize.sh
Expand All @@ -168,7 +157,7 @@ $(TARGET).elf: $(OBJS)
%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@

upload: $(TARGET).hex
upload: all
$(AVRDUDE) $(AVRDUDE_FLAGS) \
-Ufuse0:w:$(WDTCFG):m \
-Ufuse1:w:$(BODCFG):m \
Expand All @@ -181,7 +170,7 @@ upload: $(TARGET).hex
-Uflash:w:$(TARGET).hex:i

# upload via SerialUPDI
serial: $(TARGET).hex
serial: all
$(PYTHON) -u $(PYPROG) -t uart -u $(SERIAL_PORT) -b 921600 -d $(AVRDUDE_CHIP) \
--fuses 0:$(WDTCFG) 1:$(BODCFG) 2:$(OSCCFG) 4:$(TCD0CFG) 5:$(SYSCFG0) 6:$(SYSCFG1) 7:$(APPEND) 8:$(BOOTEND) -f $< -a write -v

Expand All @@ -208,5 +197,15 @@ endif
clean:
rm -f $(OBJS) $(TARGET).elf $(TARGET).hex $(DFILES)

compute_version:
$(eval LATEST_TAG ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list "*$(BRANCH_SUFFIX)" | sort -V | tail -n1))
$(eval VORTEX_VERSION_MAJOR ?= $(shell echo $(LATEST_TAG) | cut -d. -f1))
$(eval VORTEX_VERSION_MINOR ?= $(shell echo $(LATEST_TAG) | sed 's/$(BRANCH_SUFFIX)$$//' | cut -d. -f2))
$(eval VORTEX_BUILD_NUMBER ?= $(shell git rev-list --count $(LATEST_TAG)..HEAD))
$(eval VORTEX_VERSION_MAJOR := $(if $(VORTEX_VERSION_MAJOR),$(VORTEX_VERSION_MAJOR),0))
$(eval VORTEX_VERSION_MINOR := $(if $(VORTEX_VERSION_MINOR),$(VORTEX_VERSION_MINOR),1))
$(eval VORTEX_BUILD_NUMBER := $(if $(VORTEX_BUILD_NUMBER),$(VORTEX_BUILD_NUMBER),0))
$(eval VORTEX_VERSION_NUMBER := $(VORTEX_VERSION_MAJOR).$(VORTEX_VERSION_MINOR).$(VORTEX_BUILD_NUMBER))

# include dependency files to ensure partial rebuilds work correctly
-include $(DFILES)
27 changes: 14 additions & 13 deletions VortexEngine/VortexLib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SUFFIXES:

# List all make targets which are not filenames
.PHONY: all tests clean wasm
.PHONY: all tests clean wasm compute_version

# compiler tool definitions
ifdef WASM
Expand All @@ -24,17 +24,8 @@ ifndef WASM
CFLAGS += -g
endif

# Determine the current version based on Git tags
VORTEX_VERSION_MAJOR ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list | grep -E "^[[:digit:]]+\.[[:digit:]]+\$$" | sort -V | tail -n1 | cut -d. -f1)
VORTEX_VERSION_MINOR ?= $(shell git tag --list | grep -E "^[[:digit:]]+\.[[:digit:]]+\$$" | sort -V | tail -n1 | cut -d. -f2)
VORTEX_BUILD_NUMBER ?= $(shell git rev-list --count HEAD)

# If no tags are found, default to 0.1.0
VORTEX_VERSION_MAJOR := $(if $(VORTEX_VERSION_MAJOR),$(VORTEX_VERSION_MAJOR),0)
VORTEX_VERSION_MINOR := $(if $(VORTEX_VERSION_MINOR),$(VORTEX_VERSION_MINOR),1)
VORTEX_BUILD_NUMBER := $(if $(VORTEX_BUILD_NUMBER),$(VORTEX_BUILD_NUMBER),0)

VORTEX_VERSION_NUMBER ?= $(VORTEX_VERSION_MAJOR).$(VORTEX_VERSION_MINOR).$(VORTEX_BUILD_NUMBER)
# The branch/tag suffix for this device
BRANCH_SUFFIX=d

# compiler defines
DEFINES=\
Expand Down Expand Up @@ -122,7 +113,7 @@ TARGETS=vortex.a
endif

# Default target for 'make' command
all: $(TARGETS)
all: compute_version $(TARGETS)

# unit test target
tests: $(TESTS)
Expand Down Expand Up @@ -156,6 +147,16 @@ FORCE:
clean:
@$(RM) $(DFILES) $(OBJS) $(TARGETS) $(TESTS) VortexLib.js vortex.wasm

compute_version:
$(eval LATEST_TAG ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list "*$(BRANCH_SUFFIX)" | sort -V | tail -n1))
$(eval VORTEX_VERSION_MAJOR ?= $(shell echo $(LATEST_TAG) | cut -d. -f1))
$(eval VORTEX_VERSION_MINOR ?= $(shell echo $(LATEST_TAG) | sed 's/$(BRANCH_SUFFIX)$$//' | cut -d. -f2))
$(eval VORTEX_BUILD_NUMBER ?= $(shell git rev-list --count $(LATEST_TAG)..HEAD))
$(eval VORTEX_VERSION_MAJOR := $(if $(VORTEX_VERSION_MAJOR),$(VORTEX_VERSION_MAJOR),0))
$(eval VORTEX_VERSION_MINOR := $(if $(VORTEX_VERSION_MINOR),$(VORTEX_VERSION_MINOR),1))
$(eval VORTEX_BUILD_NUMBER := $(if $(VORTEX_BUILD_NUMBER),$(VORTEX_BUILD_NUMBER),0))
$(eval VORTEX_VERSION_NUMBER := $(VORTEX_VERSION_MAJOR).$(VORTEX_VERSION_MINOR).$(VORTEX_BUILD_NUMBER))

# Now include our target dependency files
# the hyphen means ignore non-existent files
-include $(DFILES)