]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blob - makefile
Update dbschema diagrams for Odds and News.
[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 dist/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 doc: dist/doc
28
29
30 # The MLB schema is identical to the regular one.
31 doc/dbschema/MLB_earlylineXML.png: doc/dbschema/earlylineXML.png
32 cp $< $@
33
34
35 #
36 # Testing.
37 #
38
39 TESTSUITE_BIN = dist/build/testsuite/testsuite
40 TEST_SRCS := $(shell find test/ -type f -name '*.hs')
41 $(TESTSUITE_BIN): $(PN).cabal $(SRCS) $(TEST_SRCS)
42 runghc Setup.hs configure --user --enable-tests --prefix=/
43 runghc Setup.hs build
44
45 test: $(BIN) $(TESTSUITE_BIN)
46 runghc Setup.hs test
47
48
49 #
50 # Misc.
51 #
52
53 # Only generate MLB_earlylineXML.png long enough to create
54 # the tarball.
55 dist: doc/dbschema/MLB_earlylineXML.png
56 runghc Setup.hs configure --prefix=/
57 TAR_OPTIONS="--format=ustar" runghc Setup.hs sdist
58 rm $<
59
60 hlint:
61 hlint --ignore="Use camelCase" \
62 --ignore="Redundant bracket" \
63 --color \
64 src
65
66 clean:
67 runghc Setup.hs clean
68 rm -f *.log
69 rm -f *.xml
70 rm -rf tmp
71 rm -f schemagen/*.dtd
72 find ./ -name '*.prof' -delete
73 find ./ -name '*.o' -delete
74 find ./ -name '*.hi' -delete
75
76
77 #
78 # Schema generation.
79 #
80
81 XMLS := $(shell find schemagen/ -type f -name '*.xml')
82 XMLTYPES := $(shell find schemagen/ -mindepth 1 -maxdepth 1 -type d)
83 DTDS := $(addsuffix .dtd, $(XMLTYPES))
84
85 # We have to depend on *every* XML file here, since pattern matching
86 # and path globs don't play well together. The use of "%" on the right
87 # is a trick to make the ".dtd"-less path available in the rule via
88 # $<. Its use is legitimate since we do sort of depend on the
89 # directory existing.
90 $(DTDS): %.dtd: % $(XMLS)
91 schema-learn $</*.xml > $@
92
93 schema: $(DTDS)