@@ -3,7 +3,7 @@ |
| 3 | 3 | |
| 4 | 4 | # Project configuration |
| 5 | 5 | PROJECT_NAME = gitswitch-c |
| 6 | | -VERSION = 1.0.0-dev |
| 6 | +VERSION = 1.0.2 |
| 7 | 7 | TARGET = gitswitch |
| 8 | 8 | |
| 9 | 9 | # Directories |
@@ -16,7 +16,7 @@ DOCDIR = docs |
| 16 | 16 | |
| 17 | 17 | # Compiler and flags |
| 18 | 18 | CC = gcc |
| 19 | | -CFLAGS = -std=c11 -Wall -Wextra -Wpedantic -Wstrict-prototypes \ |
| 19 | +CFLAGS = -std=c11 -Wall -Wextra -Wstrict-prototypes \ |
| 20 | 20 | -Wmissing-prototypes -Wold-style-definition -Wredundant-decls \ |
| 21 | 21 | -Wbad-function-cast -Wnested-externs -Winit-self -Wlogical-op \ |
| 22 | 22 | -Wshadow -Wwrite-strings -Wcast-align -Wstrict-aliasing=2 \ |
@@ -32,7 +32,7 @@ SECURITY_FLAGS_RELEASE = -D_FORTIFY_SOURCE=2 -fstack-protector-strong \ |
| 32 | 32 | |
| 33 | 33 | # Debug/Release configurations |
| 34 | 34 | DEBUG_FLAGS = -g -O0 -DDEBUG -fsanitize=address -fsanitize=undefined \ |
| 35 | | - -fno-omit-frame-pointer -Wno-pedantic $(SECURITY_FLAGS_DEBUG) |
| 35 | + -fno-omit-frame-pointer -Wpedantic $(SECURITY_FLAGS_DEBUG) |
| 36 | 36 | RELEASE_FLAGS = -O2 -DNDEBUG -s $(SECURITY_FLAGS_RELEASE) |
| 37 | 37 | |
| 38 | 38 | # Default to debug build |
@@ -246,6 +246,8 @@ help: |
| 246 | 246 | @echo " deps Check dependencies" |
| 247 | 247 | @echo " info Show build information" |
| 248 | 248 | @echo " dev Quick development cycle (clean + debug + test)" |
| 249 | + @echo " dist Create distribution tarball" |
| 250 | + @echo " rpm Build RPM package" |
| 249 | 251 | @echo " help Show this help" |
| 250 | 252 | @echo "" |
| 251 | 253 | @echo "Variables:" |
@@ -253,5 +255,30 @@ help: |
| 253 | 255 | @echo " CC Compiler (default: gcc)" |
| 254 | 256 | @echo " DESTDIR Installation prefix" |
| 255 | 257 | |
| 258 | +# RPM package building |
| 259 | +PACKAGE = gitswitcher |
| 260 | +RPM_VERSION = $(VERSION) |
| 261 | + |
| 262 | +.PHONY: dist rpm |
| 263 | +dist: clean |
| 264 | + @echo "Creating distribution tarball..." |
| 265 | + tar czf $(PACKAGE)-$(RPM_VERSION).tar.gz \ |
| 266 | + --exclude='.git*' \ |
| 267 | + --exclude='*.o' \ |
| 268 | + --exclude='build' \ |
| 269 | + --exclude='*.core' \ |
| 270 | + --exclude='valgrind.log' \ |
| 271 | + --transform 's,^,$(PACKAGE)-$(RPM_VERSION)/,' \ |
| 272 | + src/ *.md Makefile $(PACKAGE).spec |
| 273 | + |
| 274 | +rpm: dist |
| 275 | + @echo "Building RPM package..." |
| 276 | + @command -v rpmbuild >/dev/null 2>&1 || (echo "rpmbuild not available - install rpm-build package" && exit 1) |
| 277 | + mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} |
| 278 | + cp $(PACKAGE)-$(RPM_VERSION).tar.gz ~/rpmbuild/SOURCES/ |
| 279 | + cp $(PACKAGE).spec ~/rpmbuild/SPECS/ |
| 280 | + rpmbuild -ba ~/rpmbuild/SPECS/$(PACKAGE).spec |
| 281 | + @echo "RPM packages created in ~/rpmbuild/RPMS/" |
| 282 | + |
| 256 | 283 | # Prevent make from removing intermediate files |
| 257 | 284 | .SECONDARY: $(OBJECTS) $(TEST_OBJECTS) |