Skip to content

Commit 99a16d1

Browse files
committed
Add Makefile for generating conversion stylesheet from rules.
1 parent 7fa6b31 commit 99a16d1

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ indent_size = 2
99
indent_style = space
1010
insert_final_newline = true
1111
trim_trailing_whitespace = true
12+
13+
[Makefile]
14+
indent_style = tab

xsl/Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.PHONY : test_compile test_rules test check clean distclean
2+
3+
XSLTPROC = xsltproc
4+
XSPEC = xspec.sh
5+
6+
bibframe2marc.xsl : rules.xml
7+
$(XSLTPROC) src/compile.xsl rules.xml > bibframe2marc.xsl
8+
9+
rules.xml : $(shell find rules)
10+
./buildrules.sh
11+
12+
test_compile :
13+
$(XSPEC) test/compile.xspec
14+
15+
test_rules : bibframe2marc.xsl
16+
$(XSPEC) rules/test/rules.xspec
17+
18+
test : test_compile test_rules
19+
20+
check : test
21+
22+
clean :
23+
-rm rules.xml bibframe2marc.xsl
24+
25+
distclean : clean
26+
-find . -name "xspec" | xargs rm -r

xsl/buildrules.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
# Generate a rules.xml file from the xml files in the rules/ directory
4+
5+
if [ "$1" = "" ]; then
6+
RULES_FILE=rules.xml
7+
else
8+
RULES_FILE=$1
9+
fi
10+
11+
if [ -r rules/VERSION ]; then
12+
VERSION=`cat rules/VERSION`
13+
fi
14+
15+
echo "<rules xmlns=\"http://www.loc.gov/bf2marc\">" > $RULES_FILE
16+
if [ "$VERSION" != "" ]; then
17+
echo " <version>$VERSION</version>" >> $RULES_FILE
18+
fi
19+
20+
for filename in rules/*.xml; do
21+
echo " <file>$filename</file>" >> $RULES_FILE
22+
done
23+
24+
echo "</rules>" >> $RULES_FILE

xsl/rules/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0-SNAPSHOT

0 commit comments

Comments
 (0)