-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
94 lines (75 loc) · 2.8 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/make -f
.SILENT:
DEBTOOL ?= dpkg-buildpackage -rfakeroot
STATUS_CMD ?= bzr st
PKGNAME = $*
DATE = $(shell date +"%b %d %T")
TMPFILE := $(shell mktemp)
DIFF = bzr diff
COMMIT = bzr commit
REVERT = bzr revert
.PHONY: all status
all: $(patsubst %/gcs,%.build,$(wildcard */gcs))
status: $(patsubst %/gcs,%/status,$(wildcard */gcs))
notreleased: $(patsubst %/gcs,%/notreleased,$(wildcard */gcs))
%/build: %.build
$(info [$(DATE)] $(PKGNAME): Finished.)
%.build: %/debian/changelog
$(info [$(DATE)] $(PKGNAME): starting build process...)
(cd $(PKGNAME); $(DEBTOOL))
touch $(PKGNAME).build
%/debian/changelog: %/gcs/info %/svgz
$(info [$(DATE)] $(PKGNAME): building debian files...)
(cd $(PKGNAME); gcs_build -S)
%/svgz:
$(info [$(DATE)] $(PKGNAME): gzipping SVG files...)
find $(PKGNAME) -iname "*.svg" \
-exec gzip '{}' \; \
-exec mv '{}.gz' '{}z' \;
%/svg:
$(info [$(DATE)] $(PKGNAME): gunzipping SVGZ files...)
find $(PKGNAME) -iname "*.svgz" \
-exec mv '{}' '{}.gz' \; \
-exec gunzip '{}.gz' \; \
-exec rename 's/\.svgz$$/\.svg/' {} \;
%/clean: %/svg
$(info [$(DATE)] $(PKGNAME): cleanning useless files...)
-find $(PKGNAME) -iname "*.gcs" -delete
-find $(PKGNAME) -iname "*.~?~" -delete
-rm -rf $(PKGNAME)/debian
%/fullclean: %/clean
$(info [$(DATE)] $(PKGNAME): removing all output files...)
$(REVERT) $(PKGNAME)/gcs/changelog
-rm -f $(PKGNAME)*.build
-rm -f $(PKGNAME)*.dsc
-rm -f $(PKGNAME)*.changes
-rm -f $(PKGNAME)*.tar.gz
-rm -f $(PKGNAME)*.deb
%/status: %/notreleased
$(info ~~~~~ $(PKGNAME) ~~~~~)
$(STATUS_CMD) $(PKGNAME)
%/notreleased:
if ! grep -q "($(shell awk '$$1 == "version:" { print $$2 }' $(PKGNAME)/gcs/info))" $(PKGNAME)/gcs/changelog; then \
echo $(PKGNAME) not released ; \
fi
%/commit: %/clean
$(DIFF) $(PKGNAME)/gcs/changelog | grep '^+.*urgency=' | sed -e 's/\(.* (.*)\).*/\1/g' -e '1s/.*/Released packages:\n&/' | tee $(TMPFILE)
$(DIFF) $(PKGNAME)/gcs/info | grep "^+" | sed -e 's#+++ \(.*\)/gcs/info.*#\n\1:#g' -e 's#^+version: \(.*\)#(New version: \1)#' -e 's#^+##' | sed '1d' | tee -a $(TMPFILE)
echo Press [ENTER] to continue or ctrl-c to cancel commit
read dummy
$(COMMIT) $(PKGNAME) -F $(TMPFILE)
-rm -f $(TMPFILE)
uncommit:
bzr uncommit
commit: clean
$(DIFF) */gcs/changelog | grep '^+.*urgency=' | sed -e 's/\(.* (.*)\).*/\1/g' -e 's/^+/ - /g' -e '1s/.*/Released packages:\n&/' | tee $(TMPFILE)
$(DIFF) */gcs/info | grep "^+" | sed -e 's#+++ \(.*\)/gcs/info.*#\n\1:#g' -e 's#^+version: \(.*\)#(New version: \1)#' -e 's#^+##' | sed '1d' | tee -a $(TMPFILE)
echo Press [ENTER] to continue or ctrl-c to cancel commit
read dummy
$(COMMIT) -F $(TMPFILE)
-rm -f $(TMPFILE)
recommit: fullclean uncommit commit
.PHONY: clean
clean: $(patsubst %/gcs,%/clean,$(wildcard */gcs))
.PHONY: fullclean
fullclean: $(patsubst %/gcs,%/fullclean,$(wildcard */gcs)) clean