chore: bump version; add version management targets

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6e48eced0a604c9d3bd6f4f317f4d5236a6a6964
This commit is contained in:
raf 2025-11-01 18:38:11 +03:00
commit 9b42e70054
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 62 additions and 10 deletions

View file

@ -1,5 +1,5 @@
PROJECT_NAME = chroma PROJECT_NAME = chroma
VERSION = 1.0.0 VERSION = 1.0.1
# Directories # Directories
SRCDIR = src SRCDIR = src
@ -69,7 +69,7 @@ $(INCDIR):
@mkdir -p $(INCDIR) @mkdir -p $(INCDIR)
# Build main executable # Build main executable
$(TARGET): $(PROTOCOL_HEADERS) $(OBJECTS) | $(BINDIR) $(TARGET): version-header $(PROTOCOL_HEADERS) $(OBJECTS) | $(BINDIR)
@echo " LINK $@" @echo " LINK $@"
@$(CC) $(OBJECTS) -o $@ $(LDFLAGS) @$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
@ -110,6 +110,16 @@ uninstall:
rm -f $(DESTDIR)$(SYSTEMD_INSTALL)/$(PROJECT_NAME).service rm -f $(DESTDIR)$(SYSTEMD_INSTALL)/$(PROJECT_NAME).service
@echo "Uninstall complete." @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 # Create systemd service file
systemd-service: $(SYSTEMD_DIR)/$(PROJECT_NAME).service systemd-service: $(SYSTEMD_DIR)/$(PROJECT_NAME).service
@ -140,20 +150,53 @@ test: $(TARGET)
@echo "Running tests..." @echo "Running tests..."
@echo "Tests not implemented yet." @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 target
help: help:
@echo "Available targets:" @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 " debug - Build with debug symbols and sanitizers"
@echo " static - Build statically linked executable" @echo " static - Build statically linked executable"
@echo " check-deps - Check if all dependencies are available" @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 " uninstall - Remove installed files"
@echo " clean - Remove build artifacts" @echo " clean - Remove build artifacts"
@echo " distclean - Remove all generated files" @echo " distclean - Remove all generated files"
@echo " format - Format source code (requires clang-format)" @echo " format - Format source code (requires clang-format)"
@echo " analyze - Run static analysis (requires cppcheck)" @echo " analyze - Run static analysis (requires cppcheck)"
@echo " test - Run tests" @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 " help - Show this help message"
@echo "" @echo ""
@echo "Examples:" @echo "Examples:"
@ -161,12 +204,14 @@ help:
@echo " make debug # Build debug version" @echo " make debug # Build debug version"
@echo " make PREFIX=/usr install # Install to /usr instead of /usr/local" @echo " make PREFIX=/usr install # Install to /usr instead of /usr/local"
@echo " make CC=clang # Use clang instead of gcc" @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 dependency files
-include $(DEPENDS) -include $(DEPENDS)
# Phony targets # 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 variables
print-%: print-%:

3
include/chroma.h vendored
View file

@ -12,7 +12,8 @@
#include <wayland-client.h> #include <wayland-client.h>
#include <wayland-egl.h> #include <wayland-egl.h>
#define CHROMA_VERSION "1.0.0" #include "chroma_version.h"
#define MAX_OUTPUTS 16 #define MAX_OUTPUTS 16
#define MAX_PATH_LEN 4096 #define MAX_PATH_LEN 4096
#define CONFIG_FILE_NAME "chroma.conf" #define CONFIG_FILE_NAME "chroma.conf"

6
include/chroma_version.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef CHROMA_VERSION_H
#define CHROMA_VERSION_H
#define CHROMA_VERSION "1.0.1"
#endif // CHROMA_VERSION_H