PN = htsn-import BIN = dist/build/$(PN)/$(PN) SRCS := $(shell find src/ -type f -name '*.hs') .PHONY : dist hlint $(BIN): $(PN).cabal $(SRCS) runghc Setup.hs configure --user --prefix=/ runghc Setup.hs build # The $(BIN) dependency means that we should build once normally # before attempting the profiling build (this is required for some # reason). profile: $(PN).cabal $(SRCS) $(BIN) runghc Setup.hs configure --user \ --enable-executable-profiling \ --prefix=/ runghc Setup.hs build dist/doc: $(PN).cabal $(SRCS) runghc Setup.hs configure --user --prefix=/ runghc Setup.hs hscolour --all runghc Setup.hs haddock --all \ --hyperlink-source \ --haddock-options="--ignore-all-exports" doc: dist/doc # The MLB schema is identical to the regular one. doc/dbschema/MLB_earlylineXML.png: doc/dbschema/earlylineXML.png cp $< $@ # # Testing. # TESTSUITE_BIN = dist/build/testsuite/testsuite TEST_SRCS := $(shell find test/ -type f -name '*.hs') $(TESTSUITE_BIN): $(PN).cabal $(SRCS) $(TEST_SRCS) runghc Setup.hs configure --user --enable-tests --prefix=/ runghc Setup.hs build test: $(BIN) $(TESTSUITE_BIN) runghc Setup.hs test # # Misc. # # Only generate MLB_earlylineXML.png long enough to create # the tarball. dist: doc/dbschema/MLB_earlylineXML.png runghc Setup.hs configure --prefix=/ TAR_OPTIONS="--format=ustar" runghc Setup.hs sdist rm $< hlint: hlint --ignore="Use camelCase" \ --ignore="Redundant bracket" \ --color \ src clean: runghc Setup.hs clean rm -f *.log rm -f *.xml rm -rf tmp rm -f schemagen/*.dtd find ./ -name '*.prof' -delete find ./ -name '*.o' -delete find ./ -name '*.hi' -delete # # Schema generation. # XMLS := $(shell find schemagen/ -type f -name '*.xml') XMLTYPES := $(shell find schemagen/ -mindepth 1 -maxdepth 1 -type d) DTDS := $(addsuffix .dtd, $(XMLTYPES)) # We have to depend on *every* XML file here, since pattern matching # and path globs don't play well together. The use of "%" on the right # is a trick to make the ".dtd"-less path available in the rule via # $<. Its use is legitimate since we do sort of depend on the # directory existing. $(DTDS): %.dtd: % $(XMLS) schema-learn $ $@ schema: $(DTDS)