chore: bump version; add version management targets
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6e48eced0a604c9d3bd6f4f317f4d5236a6a6964
This commit is contained in:
parent
3d42f75052
commit
9b42e70054
3 changed files with 62 additions and 10 deletions
63
Makefile
63
Makefile
|
|
@ -1,5 +1,5 @@
|
|||
PROJECT_NAME = chroma
|
||||
VERSION = 1.0.0
|
||||
VERSION = 1.0.1
|
||||
|
||||
# Directories
|
||||
SRCDIR = src
|
||||
|
|
@ -69,7 +69,7 @@ $(INCDIR):
|
|||
@mkdir -p $(INCDIR)
|
||||
|
||||
# Build main executable
|
||||
$(TARGET): $(PROTOCOL_HEADERS) $(OBJECTS) | $(BINDIR)
|
||||
$(TARGET): version-header $(PROTOCOL_HEADERS) $(OBJECTS) | $(BINDIR)
|
||||
@echo " LINK $@"
|
||||
@$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
|
||||
|
||||
|
|
@ -110,6 +110,16 @@ uninstall:
|
|||
rm -f $(DESTDIR)$(SYSTEMD_INSTALL)/$(PROJECT_NAME).service
|
||||
@echo "Uninstall complete."
|
||||
|
||||
# Create version header
|
||||
version-header:
|
||||
@echo "Generating version header..."
|
||||
@echo "#ifndef CHROMA_VERSION_H" > $(INCDIR)/chroma_version.h
|
||||
@echo "#define CHROMA_VERSION_H" >> $(INCDIR)/chroma_version.h
|
||||
@echo "" >> $(INCDIR)/chroma_version.h
|
||||
@echo "#define CHROMA_VERSION \"$(VERSION)\"" >> $(INCDIR)/chroma_version.h
|
||||
@echo "" >> $(INCDIR)/chroma_version.h
|
||||
@echo "#endif // CHROMA_VERSION_H" >> $(INCDIR)/chroma_version.h
|
||||
|
||||
# Create systemd service file
|
||||
systemd-service: $(SYSTEMD_DIR)/$(PROJECT_NAME).service
|
||||
|
||||
|
|
@ -140,33 +150,68 @@ test: $(TARGET)
|
|||
@echo "Running tests..."
|
||||
@echo "Tests not implemented yet."
|
||||
|
||||
# Version management targets
|
||||
bump-patch:
|
||||
@echo "Bumping patch version..."
|
||||
@$(eval NEW_VERSION := $(shell echo $(VERSION) | awk -F. '{print $$1"."$$2"."$$3+1}'))
|
||||
@sed -i 's/^VERSION = .*/VERSION = $(NEW_VERSION)/' Makefile
|
||||
@echo "Version bumped to $(NEW_VERSION)"
|
||||
|
||||
bump-minor:
|
||||
@echo "Bumping minor version..."
|
||||
@$(eval NEW_VERSION := $(shell echo $(VERSION) | awk -F. '{print $$1"."$$2+1".0"}'))
|
||||
@sed -i 's/^VERSION = .*/VERSION = $(NEW_VERSION)/' Makefile
|
||||
@echo "Version bumped to $(NEW_VERSION)"
|
||||
|
||||
bump-major:
|
||||
@echo "Bumping major version..."
|
||||
@$(eval NEW_VERSION := $(shell echo $(VERSION) | awk -F. '{print $$1+1".0.0"}'))
|
||||
@sed -i 's/^VERSION = .*/VERSION = $(NEW_VERSION)/' Makefile
|
||||
@echo "Version bumped to $(NEW_VERSION)"
|
||||
|
||||
set-version:
|
||||
@if [ -z "$(NEW_VER)" ]; then \
|
||||
echo "Usage: make set-version NEW_VER=X.Y.Z"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Setting version to $(NEW_VER)..."
|
||||
@sed -i 's/^VERSION = .*/VERSION = $(NEW_VER)/' Makefile
|
||||
@echo "Version set to $(NEW_VER)"
|
||||
|
||||
# Help target
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Build the main executable (default)"
|
||||
@echo " all - Build main executable (default)"
|
||||
@echo " debug - Build with debug symbols and sanitizers"
|
||||
@echo " static - Build statically linked executable"
|
||||
@echo " check-deps - Check if all dependencies are available"
|
||||
@echo " install - Install the executable and systemd service"
|
||||
@echo " install - Install executable and systemd service"
|
||||
@echo " uninstall - Remove installed files"
|
||||
@echo " clean - Remove build artifacts"
|
||||
@echo " distclean - Remove all generated files"
|
||||
@echo " format - Format source code (requires clang-format)"
|
||||
@echo " analyze - Run static analysis (requires cppcheck)"
|
||||
@echo " test - Run tests"
|
||||
@echo " version-header - Generate version header from Makefile"
|
||||
@echo " bump-patch - Increment patch version (X.Y.Z+1)"
|
||||
@echo " bump-minor - Increment minor version (X.Y+1.0)"
|
||||
@echo " bump-major - Increment major version (X+1.0.0)"
|
||||
@echo " set-version - Set specific version (use NEW_VER=X.Y.Z)"
|
||||
@echo " help - Show this help message"
|
||||
@echo ""
|
||||
@echo "Examples:"
|
||||
@echo " make # Build with default settings"
|
||||
@echo " make debug # Build debug version"
|
||||
@echo " make PREFIX=/usr install # Install to /usr instead of /usr/local"
|
||||
@echo " make CC=clang # Use clang instead of gcc"
|
||||
@echo " make # Build with default settings"
|
||||
@echo " make debug # Build debug version"
|
||||
@echo " make PREFIX=/usr install # Install to /usr instead of /usr/local"
|
||||
@echo " make CC=clang # Use clang instead of gcc"
|
||||
@echo " make bump-patch # Bump to 1.0.2"
|
||||
@echo " make set-version NEW_VER=2.0.0 # Set to 2.0.0"
|
||||
|
||||
# Include dependency files
|
||||
-include $(DEPENDS)
|
||||
|
||||
# Phony targets
|
||||
.PHONY: all debug static check-deps install uninstall systemd-service sample-config clean distclean format analyze test help
|
||||
.PHONY: all debug static check-deps install uninstall systemd-service version-header sample-config clean distclean format analyze test help bump-patch bump-minor bump-major set-version
|
||||
|
||||
# Print variables
|
||||
print-%:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue