File: Makefile

package info (click to toggle)
libmodulemd 2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,152 kB
  • sloc: ansic: 37,845; python: 3,236; xml: 1,739; sh: 377; makefile: 42
file content (33 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SCHEMA = ../schema.xsd
GOOD = $(wildcard good/*.xml)
BAD = $(wildcard bad/*.xml)
GOOD_OUT = $(patsubst %.xml,%.out,$(GOOD))
BAD_OUT = $(patsubst %.xml,%.out,$(BAD))
.PHONY: bad check example good

check: bad good example

example: $(SCHEMA) ../example.xml
	xmllint --noout --schema "$(SCHEMA)" ../example.xml

good: $(GOOD_OUT)

bad: $(BAD_OUT)

good/%.out: $(SCHEMA) good/%.xml
	xmllint --noout --schema "$(SCHEMA)" good/$*.xml

.ONESHELL:
bad/%.out: $(SCHEMA) bad/%.xml
	@xmllint --noout --schema "$(SCHEMA)" bad/$*.xml 2>/dev/null
	RETVAL=$$?
	if [ "$$RETVAL" == 3 ]; then
		echo "bad/$*.xml fails to validate as expected"
		exit 0
	fi
	if [ "$$RETVAL" == 0 ]; then
		echo "bad/$*.xml unexpectedly validated"
	else
		echo "bad/$*.xml failed to be processed"
	fi
	exit 1