Makefile: refactor and sync with libite

- Create .sha256 checksums for tarballs, in addition to the .md5
- Use debuild to build .deb package, runs lintian as well
- List all resulting build artifacts
- Call release-hook first, to check if tagged

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-02-12 09:35:05 +01:00
1 parent b26eea6442
commit d7fd789378
1 file changed
+20 -16
+20 -16
View File
@@ -8,20 +8,9 @@ if ENABLE_EXAMPLES
SUBDIRS += examples
endif
## Generate .deb package
package:
@dpkg-buildpackage -uc -us -B
## Generate MD5 checksum file
MD5 = md5sum
md5-dist:
@for file in $(DIST_ARCHIVES); do \
$(MD5) $$file > $$file.md5; \
done
## Check if tagged in git
release-hook:
if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
@if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \
echo; \
printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \
printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \
@@ -37,10 +26,25 @@ release-hook:
echo; \
fi
## Generate .deb package
package:
@debuild -uc -us -B --lintian-opts --profile debian -i -I --show-overrides
## Target to run when building a release
release: distcheck release-hook md5-dist
release: release-hook distcheck package
@for file in $(DIST_ARCHIVES); do \
printf "$$file \tDistribution tarball\n"; \
printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \
mv $$file* ../; \
md5sum $$file > ../$$file.md5; \
sha256sum $$file > ../$$file.sha256; \
done
@mv $(DIST_ARCHIVES) ../
@echo
@echo "Resulting release files:"
@echo "================================================================="
@for file in $(DIST_ARCHIVES); do \
printf "%-32s Distribution tarball\n" $$file; \
printf "%-32s " $$file.md5; cat ../$$file.md5 | cut -f1 -d' '; \
printf "%-32s " $$file.sha256; cat ../$$file.sha256 | cut -f1 -d' '; \
done
@for file in `cd ..; ls $(PACKAGE)*_$(VERSION)*`; do \
printf "%-32s Debian/Ubuntu package\n" $$file; \
done