]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blob - makefile
Add a makefile rule to generate doc/dbschema/MLB_earlylineXML.png.
[dead/htsn-import.git] / makefile
1 PN = htsn-import
2 BIN = dist/build/$(PN)/$(PN)
3 SRCS := $(shell find src/ -type f -name '*.hs')
4
5 .PHONY : dist hlint
6
7 $(BIN): $(PN).cabal $(SRCS)
8 runghc Setup.hs configure --user --prefix=/
9 runghc Setup.hs build
10
11 # The $(BIN) dependency means that we should build once normally
12 # before attempting the profiling build (this is required for some
13 # reason).
14 profile: $(PN).cabal $(SRCS) $(BIN)
15 runghc Setup.hs configure --user \
16 --enable-executable-profiling \
17 --prefix=/
18 runghc Setup.hs build
19
20 doc: $(PN).cabal $(SRCS)
21 runghc Setup.hs configure --user --prefix=/
22 runghc Setup.hs hscolour --all
23 runghc Setup.hs haddock --all \
24 --hyperlink-source \
25 --haddock-options="--ignore-all-exports"
26
27
28 # The MLB schema is identical to the regular one.
29 doc/dbschema/MLB_earlylineXML.png: doc/dbschema/earlylineXML.png
30 cp $< $@
31
32
33 #
34 # Testing.
35 #
36
37 TESTSUITE_BIN = dist/build/testsuite/testsuite
38 TEST_SRCS := $(shell find test/ -type f -name '*.hs')
39 $(TESTSUITE_BIN): $(PN).cabal $(SRCS) $(TEST_SRCS)
40 runghc Setup.hs configure --user --enable-tests --prefix=/
41 runghc Setup.hs build
42
43 test: $(BIN) $(TESTSUITE_BIN)
44 runghc Setup.hs test
45
46
47 #
48 # Misc.
49 #
50
51 # Only generate MLB_earlylineXML.png long enough to create
52 # the tarball.
53 dist: doc/dbschema/MLB_earlylineXML.png
54 runghc Setup.hs configure --prefix=/
55 TAR_OPTIONS="--format=ustar" runghc Setup.hs sdist
56 rm $<
57
58 hlint:
59 hlint --ignore="Use camelCase" \
60 --ignore="Redundant bracket" \
61 --color \
62 src
63
64 clean:
65 runghc Setup.hs clean
66 rm -f *.log
67 rm -f *.xml
68 rm -rf tmp
69 rm -f schemagen/*.dtd
70 find ./ -name '*.prof' -delete
71 find ./ -name '*.o' -delete
72 find ./ -name '*.hi' -delete
73
74
75 #
76 # Schema generation.
77 #
78
79 XMLS := $(shell find schemagen/ -type f -name '*.xml')
80 XMLTYPES := $(shell find schemagen/ -mindepth 1 -maxdepth 1 -type d)
81 DTDS := $(addsuffix .dtd, $(XMLTYPES))
82
83 # We have to depend on *every* XML file here, since pattern matching
84 # and path globs don't play well together. The use of "%" on the right
85 # is a trick to make the ".dtd"-less path available in the rule via
86 # $<. Its use is legitimate since we do sort of depend on the
87 # directory existing.
88 $(DTDS): %.dtd: % $(XMLS)
89 schema-learn $</*.xml > $@
90
91 schema: $(DTDS)