File: Makefile

package info (click to toggle)
stx2any 1.56-2.2
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 712 kB
  • sloc: sh: 312; python: 288; lisp: 137; makefile: 126; sed: 1
file content (111 lines) | stat: -rw-r--r-- 3,107 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111

BUILD_USAGE_WITH=w3m

INSTALL=install -c

STX2ANY=./scripts/stx2any
PREFIX=/usr
BASE=$(DESTDIR)$(PREFIX)
EXEDIR=$(BASE)/bin
LIBDIR=$(BASE)/share/stx2any
MANDIR=$(BASE)/share/man/man1
MSGDIR=$(LIBDIR)/messages
EMACSDIR=$(BASE)/share/emacs/site-lisp
SCRIPTS=stx2any strip_stx gather_stx_titles html2stx extract_usage_from_stx
MANPAGES:=$(SCRIPTS:=.1)
MESSAGES:=$(SCRIPTS:=.usage) version.msg
INST_SCRIPTS=$(SCRIPTS:=.inst)
DOCDIR=$(BASE)/share/doc/stx2any
DOCBASE:=stx2any Stx-doc Stx-ref strip_stx gather_stx_titles html2stx \
	accreditions extract_usage_from_stx
DOCBASE:=$(DOCBASE:%=examples/%)
DOCS:=$(DOCBASE:=.html) $(MANPAGES) examples/README.html
FORMATS=html man latex docbook-xml
COMMON=common.m4 markup.m4 begin.m4 end.m4 cleanup.m4 secure.m4 templ.m4 \
       emphasis.sed inline.sed block.sed quote.sed quote_us.sed wrapcalls.sed \
       gatherlinkmap.sed linking.sed quote_quotes.sed header.sed
STXDEFS:=$(FORMATS:=/make.m4) $(FORMATS:=/templ.m4) $(FORMATS:=/settings.sh) \
	$(COMMON:%=common/%)

.SUFFIXES:

all: chmod doc $(MESSAGES) $(INST_SCRIPTS) $(STXDEFS)

chmod:
	chmod +x scripts/* regression/run-tests

html2stx.inst: scripts/html2stx
	cp $< $@

%.inst: scripts/%
	sed -e "s#^BASE=.*#BASE="$(LIBDIR)"#" $< >$@

%.1: examples/%.txt $(STXDEFS)
	sed -e "s#PREFIX#$(PREFIX)#" $< | $(STX2ANY) -T man >$@

%.usage: examples/%.txt $(STXDEFS)
ifeq ($(BUILD_USAGE_WITH),w3m)
	./scripts/extract_usage_from_stx $< | $(STX2ANY) -T text >$@
else
	./scripts/extract_usage_from_stx $< >$@
endif

version.msg: debian/changelog
	sed -e 's#^\([^(]*\)(\([^)]*\)).*#\1\2#' -e '1q' $< >$@

%.m4: %.lm4 
	./scripts/strip_stx $< >$@

%.sh: %.lsh 
	./scripts/strip_stx $< >$@

%.sed: %.lsed
	./scripts/strip_stx $< >$@

test: chmod $(STXDEFS)
	./regression/run-tests

doc: chmod $(DOCS)

install: all
	$(INSTALL) -m 755 -d $(EXEDIR) $(LIBDIR) $(MSGDIR) $(MANDIR) $(DOCDIR) $(EMACSDIR)
	for i in $(INST_SCRIPTS); do \
		$(INSTALL) -m 755 $$i $(EXEDIR)/`basename $$i .inst`; \
	done
	$(INSTALL) -m 644 $(MANPAGES) $(MANDIR)
	$(INSTALL) -m 644 $(DOCS) $(DOCBASE:=.txt) $(MISC) $(DOCDIR)
	$(INSTALL) -m 644 stx-mode.el $(EMACSDIR)
	for i in $(FORMATS); do \
	  $(INSTALL) -m 755 -d $(LIBDIR)/$$i; \
	  $(INSTALL) -m 644 $$i/*.m4 $$i/*.sh $(LIBDIR)/$$i; \
	done
	$(INSTALL) -m 755 -d $(LIBDIR)/common
	$(INSTALL) -m 644 common/*.m4 common/*.sed $(LIBDIR)/common
	$(INSTALL) -m 644 $(MESSAGES) $(MSGDIR)

titles.m4: $(DOCBASE:=.txt) common/header.sed
	./scripts/gather_stx_titles -p examples -f txt -t html $^ > $@

examples/README.html: README titles.m4 $(STXDEFS)
	$(STX2ANY) --link-abbrevs titles.m4 $< > $@

examples/Stx-doc.html: examples/Stx-doc.txt titles.m4 $(STXDEFS)
	$(STX2ANY) --link-abbrevs titles.m4 $< > $@

examples/Stx-ref.html: examples/Stx-ref.txt titles.m4 $(STXDEFS)
	$(STX2ANY) --numbering on titles.m4 $< > $@

%.html: %.txt titles.m4 $(STXDEFS)
	$(STX2ANY) titles.m4 $< > $@

clean: gc clean-leavedocs
	rm -f $(DOCS)

gc:
	rm -f *.dvi *.toc *.log *.aux

clean-leavedocs:
	rm -f $(STXDEFS) $(INST_SCRIPTS) $(MESSAGES) titles.m4

.PHONY: clean gc clean-leavedocs all doc install test chmod