~z-man/armagetronad/0.4-armagetronad-ct-ladderlog-unified

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# include $(top_srcdir)/Makefile.paths

# installation destination
resourcedir=${aa_datadir}/resource

sourcefiles = $(shell test -d ${srcdir}/proto && find ${srcdir}/proto -type f | grep -v CVS | grep -v "~")

included: ${sourcefiles} ${top_srcdir}/batch/make/sortresources.py ${top_srcdir}/batch/make/copyresources.py Makefile
	if test -d ${srcdir}/proto; then python ${top_srcdir}/batch/make/copyresources.py ${srcdir}/proto $@ && cp -r ${srcdir}/binary/* $@/; fi
# @sh ${top_srcdir}/batch/make/sortresources ${srcdir}/proto $@ ${top_srcdir}/batch/make/sortresources.py || { rm -rf $@; false; }

all: included

linked_included.%: included
	rm -rf $@
	if test ! -r $@; then \
		if test -d included; then\
			ln -sf ./included $@;\
		else\
			ln -sf ${srcdir}/included $@;\
		fi;\
	fi

install-data-local: linked_included.install
#   copy processed included resources into target directory
	mkdir -p ${DESTDIR}${resourcedir}/included
	cp -r $</* ${DESTDIR}${resourcedir}/included
	find ${DESTDIR}${resourcedir} -type d -exec chmod 755 \{\} \;
	find ${DESTDIR}${resourcedir} -type f -exec chmod 644 \{\} \;
	rm -f $<	

uninstall-local:
#   remove resources
	rm -rf ${DESTDIR}${resourcedir}/included

dist-hook: linked_included.dist
#   copy processed included resources into distribution
	mkdir -p $(distdir)/included
	cp -r $</* $(distdir)/included/

#	delete temporary files
	rm -f $<

#	update included resources to correct dtd version
	for type in `ls included | grep '.dtd$$' | grep -v -- - | sed -e 's,.dtd,,'`; do\
	    echo fixing referenced DTD version of XML files of type $${type}...; \
		if test -r included/.$${type}version; then \
			for file in `find $(distdir)/included/ -name "*.aa$${type}.xml" -o -name "*.$${type}.xml"`; do \
				echo "Adapting dtd in $$file" | sed -e "s,$(distdir)/included/,,";\
				sed -e "s,$${type}.dtd,AATeam/$${type}-`cat included/.$${type}version`.dtd,g" < $$file > $$file.processed ;\
				mv $$file.processed $$file ;\
			done ;\
		fi; \
		rm -f $(distdir)/included/$${type}.dtd; \
	done

clean-local:
	test -d ${srcdir}/proto && rm -rf included || true