summarylogtreecommitdiffstats
path: root/Makefile
blob: 2c2e83530317aa95d1ef30dec9e3557c40406136 (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
.SHELL = /usr/bin/env bash

NAME    = $(shell grep -m 1 pkgname .SRCINFO | cut -d '=' -f 2 | xargs)
URL     = $(shell grep url .SRCINFO | cut -d '=' -f 2 | xargs)
VERSION = $(shell grep pkgver .SRCINFO | cut -d '=' -f 2 | xargs)
RELEASE = $(shell grep pkgrel .SRCINFO | cut -d '=' -f 2 | xargs)

.PHONY: all
all: build git install

.PHONY: clean
clean:
	rm -r src pkg || true

.PHONY: geninteg
geninteg:
	sed -i '/.*sums.*=(/,$$d' PKGBUILD
	makepkg --geninteg >> PKGBUILD

.PHONY: srcinfo
srcinfo:
	makepkg --printsrcinfo > .SRCINFO

.PHONY: makepkg
makepkg:
	makepkg --syncdeps --force

.PHONY: build
build: geninteg srcinfo makepkg

.PHONY: git
git: git_add git_commit

.PHONY: git_add
git_add:
	git add PKGBUILD .SRCINFO Makefile

.PHONY: git_commit
git_commit: GIT_STATUS = "$(shell git status --porcelain)"
git_commit:
	[ -n ${GIT_STATUS} ] && git commit -m "Update to ${VERSION}-${RELEASE}"

.PHONY: install
install:
	makepkg --repackage --install --force

.PHONY: open
open:
	xdg-open $(URL)

.PHONY: run
run:
	env $(NAME)

.PHONY: test
test:
	env $(NAME) --version