summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/platex/jsclasses/Makefile
blob: b7af18707debd8a518f5dfe7445750fb21cea661 (plain)
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
STRIPTARGET = jsarticle.cls jslogo.sty okumacro.sty jsverb.sty okuverb.sty
DOCTARGET = jsclasses jslogo okumacro jsverb okuverb
PDFTARGET = $(addsuffix .pdf,$(DOCTARGET))
DVITARGET = $(addsuffix .dvi,$(DOCTARGET))
KANJI = -kanji=utf8
FONTMAP = -f ipaex.map -f ptex-ipaex.map
TEXMF = $(shell kpsewhich -var-value=TEXMFHOME)

default: $(STRIPTARGET) $(DVITARGET)
strip: $(STRIPTARGET)
all: $(STRIPTARGET) $(PDFTARGET)

JSCLASSES = jsarticle.cls jsbook.cls jsreport.cls jspf.cls kiyou.cls

# for generating files, we use pdflatex incidentally.
# otherwise, ptexenc might convert U+2212 -> U+FF0D in okumacro.sty
jsarticle.cls: jsclasses.dtx
	pdflatex jsclasses.ins

jslogo.sty: jslogo.dtx
	pdflatex jslogo.ins

okumacro.sty: okumacro.dtx
	pdflatex okumacro.ins

jsverb.sty: jsverb.dtx
	pdflatex jsverb.ins

okuverb.sty: okuverb.dtx
	pdflatex okuverb.ins

.SUFFIXES: .dtx .dvi .pdf
.dtx.dvi:
	platex $(KANJI) $<
	platex $(KANJI) $<
.dvi.pdf:
	dvipdfmx $(FONTMAP) $<

.PHONY: install clean cleanstrip cleanall cleandoc jisfile
install:
	mkdir -p ${TEXMF}/doc/platex/jsclasses
	cp ./LICENSE ${TEXMF}/doc/platex/jsclasses/
	cp ./README.md ${TEXMF}/doc/platex/jsclasses/
	cp ./*.pdf ${TEXMF}/doc/platex/jsclasses/
	mkdir -p ${TEXMF}/source/platex/jsclasses
	cp ./Makefile ${TEXMF}/source/platex/jsclasses/
	cp ./*.dtx ${TEXMF}/source/platex/jsclasses/
	cp ./*.ins ${TEXMF}/source/platex/jsclasses/
	mkdir -p ${TEXMF}/tex/platex/jsclasses
	cp ./*.cls ${TEXMF}/tex/platex/jsclasses/
	cp ./*.sty ${TEXMF}/tex/platex/jsclasses/
clean:
	rm -f $(JSCLASSES) \
	jslogo.sty okumacro.sty jsverb.sty okuverb.sty \
	$(DVITARGET)
cleanstrip:
	rm -f $(JSCLASSES) \
	jslogo.sty okumacro.sty jsverb.sty okuverb.sty
cleanall:
	rm -f $(JSCLASSES) \
	jslogo.sty okumacro.sty jsverb.sty okuverb.sty \
	$(DVITARGET) $(PDFTARGET)
cleandoc:
	rm -f $(DVITARGET) $(PDFTARGET)
jisfile:
	mkdir -p jis0
	cp *.{dtx,ins,cls,sty} jis0/
	# GNU iconv can be used to convert UTF-8 -> ISO-2022-JP
	for x in jis0/*; do \
		if [ -f "$$x" ]; then \
			iconv -f UTF-8 -t ISO-2022-JP "$$x" >"$$x.conv"; \
			mv "$$x.conv" "$$x"; \
		fi \
	done
	# jsclasses and okumacro contain non-ASCII chars also in stripped files
	for x in $(addprefix jis0/,$(JSCLASSES) jsclasses.dtx okumacro.dtx okumacro.sty); do \
		perl -pi.bak -0777 -e 's/(%\n)?\\ifx\\epTeXinputencoding\\undefined.*?\n\\fi\n(%\n)?//s' $$x; \
		rm -f $$x.bak; \
	done
	# others have no non-ASCII chars in stripped files
	for x in $(addprefix jis0/,$(wildcard *.dtx)); do \
		perl -pi.bak -0777 -e 's/(%\n)?% \\ifx\\epTeXinputencoding\\undefined.*?\n% \\fi\n(%\n)?//s' $$x; \
		perl -pi.bak -0777 -e 's/(%\n)?%<\*driver>\n\\ifx\\epTeXinputencoding\\undefined.*?\n\\fi\n%<\/driver>\n//s' $$x; \
		rm -f $$x.bak; \
	done
	rm -f jis/*.{dtx,ins,cls,sty}
	mv jis0/* jis/
	rmdir jis0