File: Makefile

package info (click to toggle)
exult 1.12.0-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 43,608 kB
  • sloc: cpp: 169,917; xml: 7,400; yacc: 2,850; makefile: 2,419; java: 1,901; ansic: 1,654; lex: 673; sh: 539; objc: 416
file content (72 lines) | stat: -rw-r--r-- 2,279 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
top_srcdir := ../..
DOCS_DIR := $(top_srcdir)/docs

HTML_OBJS := $(patsubst %.xml,%.html,$(wildcard *.xml))
TEXT_OBJS := $(patsubst %.xml,%.txt,$(wildcard *.xml))
PHP_OBJS := $(patsubst %.xml,%.dat,$(wildcard *.xml))

DOCS_HTMLS := $(DOCS_DIR)/ReadMe.html $(DOCS_DIR)/faq.html $(DOCS_DIR)/exult_studio.html
DOCS_TEXTS := $(DOCS_DIR)/exult_studio.txt
TOP_TEXTS := $(top_srcdir)/FAQ $(top_srcdir)/README

ifdef WEB_DIR
	WEB_TEXTS := $(patsubst %.xml,$(WEB_DIR)/%.txt,$(wildcard *.xml))
	WEB_DATS := $(patsubst %.xml,$(WEB_DIR)/content/%.dat,$(wildcard *.xml))
else
	WEB_TEXTS :=
	WEB_DATS :=
endif

define build_output_files
	xsltproc -o $(1) $(2) $(3)
	sed -i'' 's/[[:blank:]]*$$//' $(1)
endef

define build_php_dats
	xsltproc -o $(1) $(2) $(3)
	sed -i'' -e '1s@<test xmlns="http://www.w3.org/1999/xhtml">@@; $$s@</test>@@ ; s/[[:blank:]]*$$//' $(1)
endef

# Rules for transforming the XML source
%.html: %.xml html.xsl docs.dtd
	$(call build_output_files, $@, html.xsl, $<)

%.txt: %.xml text.xsl docs.dtd
	$(call build_output_files, $@, text.xsl, $<)

%.dat: %.xml php.xsl docs.dtd
	$(call build_php_dats, $@, php.xsl, $<)

.SUFFIXES: .xml .html .txt .dat

all: html text php $(top_srcdir)/FAQ $(top_srcdir)/README $(WEB_TEXTS) $(WEB_DATS)

define update_files_template
$(1): $(2)
	cp $(2) $(1)
endef

ifdef WEB_DIR
$(foreach file, $(TEXT_OBJS), $(eval $(call update_files_template, $(WEB_DIR)/$(file), $(file))))
$(foreach file, $(PHP_OBJS), $(eval $(call update_files_template, $(WEB_DIR)/content/$(file), $(file))))
endif

# Rule for updating files in the docs directory
$(eval $(call update_files_template, $(DOCS_DIR)/ReadMe.html, docs.html))
$(eval $(call update_files_template, $(DOCS_DIR)/faq.html, faq.html))
$(eval $(call update_files_template, $(DOCS_DIR)/exult_studio.html, exult_studio.html))
$(eval $(call update_files_template, $(DOCS_DIR)/exult_studio.txt, exult_studio.txt))

# Rules for updating files in the top directory
$(eval $(call update_files_template, $(top_srcdir)/FAQ, faq.txt))
$(eval $(call update_files_template, $(top_srcdir)/README, docs.txt))

# remove all generated files
clean:
	-rm -f *.html *.txt *.dat

html: $(HTML_OBJS) $(DOCS_HTMLS) $(DOCS_TEXTS)
text: $(TEXT_OBJS) $(TOP_TEXTS)
php: $(PHP_OBJS)

.PHONY: all html text php clean update