aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorbius2024-02-21 14:25:59 +0100
committerMorbius2024-02-21 14:25:59 +0100
commit8b2c2fdc4dc0abd517458836bddc7c8d33e1887f (patch)
tree0e7ad594a943e637a901c20426434030159a17b3
parentcade54fb55b51ef30d65b0be8017ad6a39cac0cd (diff)
downloadaur-8b2c2fdc4dc0abd517458836bddc7c8d33e1887f.tar.gz
Introduce Makefile
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..de365b80a52d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+# vim: ts=4 sw=4 noet
+
+BUILD = makepkg --log --syncdeps --rmdeps --check
+NAME = $(shell awk -F '=' '/^pkgname=/ {print $$2}' PKGBUILD)
+
+define usage
+
+Available make targets:
+
+ build Build $(NAME), but do not install.
+ clean Cleanup build artifacts and logs.
+ help Display this text.
+ install Build and install $(NAME).
+ mrproper Cleanup thoroughly, including downloaded files.
+ remove Print command to uninstall $(NAME) and its orphaned dependencies.
+ schk Check shell scripts.
+
+endef
+
+.PHONY: build clean help mrproper remove schk
+
+help:
+ $(info $(usage))
+ @exit 0
+
+clean:
+ rm -fr pkg src $(NAME)-*.{log,zst}*
+
+mrproper: clean
+ rm -f pkg src $(NAME)-*.gz
+
+.SRCINFO: PKGBUILD
+ makepkg --printsrcinfo >$@
+
+build: PKGBUILD
+ $(BUILD)
+
+install: PKGBUILD
+ $(BUILD) --install
+
+remove:
+ @echo -e "# Run the following only if you are certain:\nsudo pacman -Rs $(NAME)"
+
+schk:
+ shellcheck -s bash -e SC2034,SC2154 PKGBUILD