summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d68e709
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+infiles := $(wildcard data/*.ttl data/*/*.ttl)
+turtlefiles := $(infiles:data/%.ttl=build/%/index.ttl)
+textfiles = $(turtlefiles:%.ttl=%.txt)
+rdfxmlfiles = $(turtlefiles:%.ttl=%.rdf)
+
+getbase = $(shell perl -ne '/^\@base\s+<(http.+)>/ and print $$1 and exit;' "$1")
+
+all: $(textfiles) $(rdfxmlfiles)
+
+clean:
+ rm -rf build
+
+$(turtlefiles): build/%/index.ttl : data/%.ttl
+ mkdir -p $(dir $@)
+ $(eval base = $(call getbase, $<))
+ rapper $(base:%=-I "%") -i turtle -o turtle "$<" > "$@"
+ perl -i -pe 's/ {4}/\t/g' "$@"
+
+$(textfiles): %.txt : %.ttl
+ ln -s $(notdir $<) $@
+
+$(rdfxmlfiles): %.rdf : %.ttl
+ $(eval base = $(call getbase, $<))
+ rapper $(base:%=-I "%") -i turtle -o rdfxml-abbrev "$<" > "$@"