]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blobdiff - makefile
Begin work on the automatic schema generation.
[dead/htsn-import.git] / makefile
index d71ce4d002bea6e2f86d1fe5bb65ac94769971b9..608606c6ffcf7f7c7c3a7445f24231c5cd288d18 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,8 +1,6 @@
 PN = htsn-import
 BIN = dist/build/$(PN)/$(PN)
-TESTSUITE_BIN = dist/build/testsuite/testsuite
 SRCS := $(shell find src/ -type f -name '*.hs')
-TEST_SRCS := $(shell find test/ -type f -name '*.hs')
 
 .PHONY : dist hlint
 
@@ -21,12 +19,12 @@ doc: $(PN).cabal $(SRCS)
                                --executables \
                                --hyperlink-source
 
-clean:
-       runghc Setup.hs clean
-       rm -f *.log
-       rm -f *.xml
-       rm -rf tmp
+#
+# 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
@@ -34,6 +32,10 @@ $(TESTSUITE_BIN): $(PN).cabal $(SRCS) $(TEST_SRCS)
 test: $(BIN) $(TESTSUITE_BIN)
        runghc Setup.hs test
 
+
+#
+# Misc.
+#
 dist:
        runghc Setup.hs configure --prefix=/
        runghc Setup.hs sdist
@@ -43,3 +45,29 @@ hlint:
              --ignore="Redundant bracket" \
              --color                      \
              src
+
+clean:
+       runghc Setup.hs clean
+       rm -f *.log
+       rm -f *.xml
+       rm -rf tmp
+       rm -f schemagen/*.dtd
+
+
+#
+# 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)
+       learn $</*.xml > $@
+
+schema: $(DTDS)