-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
71 lines (52 loc) · 1.56 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
.PHONY: doc clean cabal ubuntu-build-deps tarballs
# Prevents the .sha files from being deleted. Not sure what the story is.
.SECONDARY:
v = $(shell git describe || bin/dist cabal_version || echo '(unversioned)')
tag = arx-$(shell ./bin/dist tag)
built = $(wildcard tmp/dist/*/arx)
tarballs = $(built:%/arx=%.tbz)
ifeq (Darwin,$(shell uname))
tagged = tmp/arx.cabal
else
tagged = tmp/arx.custom
endif
this_platform: tmp/dist/$(tag)/arx
version:
echo $v > $@
tmp/dist/$(tag)/arx: $(tagged)
mkdir -p tmp/dist/$(tag)
mv -f $< $@
tmp/dist/%/arx.gpg: tmp/dist/%/arx
gpg --use-agent --detach-sign $<
tmp/dist/%/arx.sha: d = $(@:%/arx.sha=%)
tmp/dist/%/arx.sha: tmp/dist/%/arx
( cd $d && shasum --portable --algorithm 512 arx > arx.sha )
tarballs: $(tarballs)
tmp/dist/%.tbz: d = $(@:tmp/dist/%.tbz=%)
tmp/dist/%.tbz: tmp/dist/%/arx tmp/dist/%/arx.gpg tmp/dist/%/arx.sha
tar cjf $@ -C tmp/dist $d
arx: version arx.hs doc
ghc -outputdir tmp --make -O2 arx.hs -o arx
tmp/arx.custom: libs = $(shell bin/so2a4hs statics arx)
tmp/arx.custom: arx bin/so2a4hs
ghc -outputdir tmp --make -O2 arx.hs -o $@ \
-optl-Wl,--whole-archive \
$(libs:%=-optl%) \
-optl-Wl,--no-whole-archive
strip $@
ubuntu-build-deps:
env DEBIAN_FRONTEND=noninteractive aptitude install -y \
python-sphinx cabal-install
cabal install --only-dependencies
tmp/arx.cabal: dist/build/arx/arx
mkdir -p tmp
cp dist/build/arx/arx $@
strip $@
dist/build/arx/arx: cabal
cabal: version
cabal configure --disable-profiling
cabal build
doc:
cd docs && make blessed
clean:
rm -rf tmp arx dist/build