-
Notifications
You must be signed in to change notification settings - Fork 3
/
GNUmakefile
68 lines (49 loc) · 1.51 KB
/
GNUmakefile
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
PKG = $(basename $(wildcard *.cabal))
TARGETS := $(basename $(shell find Examples -name '[a-z]*.hs' -print))
TESTS := $(basename $(shell find tests -name '[a-z]*.hs' -print))
HSCS := $(patsubst %.hsc,%.hs,$(shell find . -name '*.hsc' -print))
HSCCLEAN = $(patsubst %.hs,%_hsc.[ch],$(HSCS))
all: $(TARGETS) $(HSCS)
.PHONY: all always clean build dist doc browse install hsc
GHC = ghc $(WALL)
#GHC = ghc $(WALL) -prof -auto-all -caf-all -rtsopts=all -with-rtsopts=-xc
WALL = -Wall -Werror
LIBS = -lz
always:
@:
Examples/%: always $(HSCS)
$(GHC) --make -i$(dir $@) [email protected] $(LIBS)
tests/%: always $(HSCS)
$(GHC) --make [email protected]
%.hs: %.hsc
hsc2hs $<
hsc: $(HSCS)
Setup: Setup.hs
$(GHC) --make Setup.hs
dist/setup-config: Setup $(PKG).cabal
./Setup configure --user
build: dist/setup-config
./Setup build
doc: dist/setup-config
./Setup haddock --hyperlink-source
dist: dist/setup-config
./Setup sdist
INDEXDOC = cd $(HOME)/.cabal/share/doc \
&& find . -name '*.haddock' -print \
| sed -e 's/\.\/\(.*\)\/[^\/]*\.haddock/--read-interface=\1,&/' \
| xargs -t haddock --gen-contents --gen-index --odir=.
install: build doc
./Setup install
$(INDEXDOC)
uninstall: dist/setup-config
./Setup unregister --user
rm -rf $(HOME)/.cabal/lib/$(PKG)-[0-9]*
rm -rf $(HOME)/.cabal/share/doc/$(PKG)-[0-9]*
$(INDEXDOC)
browse: doc
xdg-open dist/doc/html/$(PKG)/index.html
clean:
rm -rf dist
rm -f Setup $(TARGETS) $(TESTS) $(HSCS) $(HSCCLEAN)
find . \( -name '*~' -o -name '*.hi' -o -name '*.o' \) -print0 \
| xargs -0 rm -f --