1# rules for ninja (ninja-build) or samurai
2
3cc=musl-gcc
4#cc=gcc
5#cc=clang
6
7#cflags = -O2 -Wall -pipe -I. -fpie
8cflags = -g -Wall -pipe -I. -fpie
9ldflags=-static -Wl,--no-dynamic-linker -lm
10
11rule cc
12  command = $cc $cflags -c $in -o $out
13
14rule ld
15  command = $cc $ldflags -o $out $in
16
17build abcm2ps.o: cc abcm2ps.c | config.h abcm2ps.h
18build abcparse.o: cc abcparse.c | config.h abcm2ps.h
19build buffer.o: cc buffer.c | config.h abcm2ps.h
20build deco.o: cc deco.c | config.h abcm2ps.h
21build draw.o: cc draw.c | config.h abcm2ps.h
22build format.o: cc format.c | config.h abcm2ps.h
23build front.o: cc front.c | config.h abcm2ps.h
24build glyph.o: cc glyph.c | config.h abcm2ps.h
25build music.o: cc music.c | config.h abcm2ps.h
26build parse.o: cc parse.c | config.h abcm2ps.h
27build subs.o: cc subs.c | config.h abcm2ps.h
28build svg.o: cc svg.c | config.h abcm2ps.h
29build syms.o: cc syms.c | config.h abcm2ps.h
30
31build abcm2ps: ld abcm2ps.o abcparse.o buffer.o deco.o draw.o format.o front.o $
32  glyph.o music.o parse.o subs.o svg.o syms.o
33
34default abcm2ps
35
36# GitHub releases
37rule version
38  command = tag=`grep VERSION= configure|cut -d'=' -f2`;$
39	if [ $out = minor ]; then$
40		m=$${tag#*.};$
41		m=$${m%%.*};$
42		m=$$((m + 1));$
43		newtag="$${tag%%.*}.$$m.0";$
44	else$
45		p=$${tag##*.};$
46		p=$$((p + 1));$
47		newtag="$${tag%.*}.$$p";$
48	fi;$
49	p=`grep VDATE= configure|cut -d'=' -f2`;$
50	m=`date +%F`;$
51	mv configure configure~;$
52	sed -e "s/$$tag/$$newtag/;s/$$p/$$m/" configure~ > configure;$
53	chmod +x configure;$
54	echo "New release v$$newtag" | git commit -F- configure;$
55	git tag -a v$$newtag;$
56	echo "Don't forget: git push --follow-tags; configure"
57build minor: version
58build patch: version
59