-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (54 loc) · 1.96 KB
/
Makefile
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
60
61
62
63
64
65
66
67
CONF=./test/tomato.conf
REPO=/tmp/tomato
with=
makepkgconf=${CURDIR}/docker/makepkg.conf
SEED=$(shell date +'%s')
TEMP=/tmp/tomato-$(SEED)
AUR_REPO=ssh://[email protected]/tomato.git
HUB_REPO=https://raw.githubusercontent.com/aji-prod/tomato
help:
echo -e \
"Available $(MAKE) targets:\n"\
"$(MAKE) image # build docker test image\n"\
"$(MAKE) run with=\"args\" # test tomato with args\n"\
"$(MAKE) version # show and ensure version\n"\
"$(MAKE) tar # create a source archive\n"\
"$(MAKE) pkg [makepkgconf=\"path\"] # create a pacman package."
image: docker/Dockerfile
./tomato "--tomato-config=$(CONF)" --rebuild-image "$(with)"
$(REPO):
-mkdir "$(REPO)"
run: $(REPO)
./tomato "--tomato-config=$(CONF)" "$(with)"
_version:
sh version
version: _version
$(eval VERSION := $(shell sh version 2> /dev/null))
$(TEMP):
-mkdir "$(TEMP)"
tar: version $(TEMP)
ln -s "${CURDIR}" "$(TEMP)/tomato-$(VERSION)"
bsdtar -c -H -z \
--exclude ".git/*" \
--exclude "tomato-*.tar.*" \
--exclude "pkg" \
--exclude "src" \
-f "tomato-$(VERSION).tar.gz" -C "$(TEMP)" "tomato-$(VERSION)"
pkg: tar
mkdir pkg || rm -r pkg/* || true
cp PKGBUILD "tomato-$(VERSION).tar.gz" pkg
sh geninteg --config "$(makepkgconf)" --inplace pkg/PKGBUILD
cd pkg && namcap PKGBUILD && makepkg --config "$(makepkgconf)"
aur: version $(TEMP)
test -n "${AUR_USERNAME}" -a -n "${AUR_USEREMAIL}"
git clone -c "user.name=${AUR_USERNAME}" \
-c "user.email=${AUR_USEREMAIL}" \
$(AUR_REPO) "$(TEMP)/v$(VERSION)"
curl "$(HUB_REPO)/v$(VERSION)/PKGBUILD" > "$(TEMP)/v$(VERSION)/PKGBUILD"
sh geninteg --config "$(makepkgconf)" --inplace "$(TEMP)/v$(VERSION)/PKGBUILD"
cd "$(TEMP)/v$(VERSION)" && \
makepkg --config "$(makepkgconf)" --printsrcinfo > .SRCINFO && \
git add -f PKGBUILD .SRCINFO && \
makepkg --config "$(makepkgconf)" -c
.PHONY: help image run _version version tar aur
.SILENT: help test _version version