aboutsummarylogtreecommitdiffstats
path: root/Makefile
blob: 4c59dc17434dbd8b0a80e813be360952cc2b3a66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# 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.
  geninteg  Generate integrity checksums.
  help      Display this text.
  install   Build and install $(NAME).
  janitor   Housekeeping jobs.
  mrproper  Cleanup thoroughly, including downloaded files.
  push      Push to all configured Git remotes.
  remove    Print command to uninstall $(NAME) and its orphaned dependencies.
  schk      Check shell scripts.

endef

.PHONY:	build clean help janitor mrproper push remove schk

help:
	$(info $(usage))
	@exit 0

clean:
	rm -fr pkg src $(NAME)-*.{log,zst}*

mrproper:	clean
	rm -f pkg src $(NAME)-*.gz

geninteg:
	sed -e '/^b2sums=/,/)$$/d' PKGBUILD >.tmp
	makepkg --geninteg | sed -e 's/^\s\+/\t/' >>.tmp
	mv .tmp PKGBUILD

.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)"

janitor:	.gitignore .SRCINFO
	sort -o $< $<

push:
	for _r in $(shell git remote); do git push $$_r; done; unset _r

schk:
	shellcheck -s bash -e SC2034 PKGBUILD *.sh