make: define RELEASE and VERSION variables
authorFrantisek Hrbata <frantisek@hrbata.com>
Tue, 22 Dec 2020 11:13:26 +0000 (12:13 +0100)
committerFrantisek Hrbata <frantisek@hrbata.com>
Tue, 22 Dec 2020 11:16:10 +0000 (12:16 +0100)
Add RELEASE and VERSION so we can use them instead of values
hardcoded in gimrr.spec.

Signed-off-by: Frantisek Hrbata <frantisek@hrbata.com>
Makefile

index d88ce565d2ff127a4123c5feb585ee98a870f4b9..1815b3ee2106332224dbd72e5a920cf4b4966757 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+VERSION = 0.2
+RELEASE = 1
+
 .PHONY: clean rpm doc man html install uninstall clean_man clean_html help
 
 all: help
@@ -83,7 +86,9 @@ clean_html:
 RPM_TOP_DIR = $(CURDIR)/rpmbuild
 rpm:
        mkdir -p $(RPM_TOP_DIR)/{BUILD,RPMS,SPECS,SRPMS}
-       $(RPMBUILD) -bb --build-in-place --define "_topdir $(RPM_TOP_DIR)" gimrr.spec
+       $(INSTALL) -m 644 gimrr.spec $(RPM_TOP_DIR)/SPECS/gimrr.spec
+       sed -i s'/%%VERSION%%/$(VERSION)/;s/%%RELEASE%%/$(RELEASE)/' $(RPM_TOP_DIR)/SPECS/gimrr.spec
+       $(RPMBUILD) -bb --build-in-place --define "_topdir $(RPM_TOP_DIR)" $(RPM_TOP_DIR)/SPECS/gimrr.spec
 
 doc: man html