File: Makefile

package info (click to toggle)
zh-sgmltools 1.0.1-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 384 kB
  • ctags: 35
  • sloc: sh: 318; makefile: 139; cpp: 123; perl: 36
file content (134 lines) | stat: -rw-r--r-- 4,090 bytes parent folder | download
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#
#	Makefile for the zh-sgmltools package: ripped straight from ipchains.
#	(C) 1998-1999 All rights reserved.
#       EMail complaints to Chih-Wei Huang <cwhuang@linux.org.tw>
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 2 of the License, or
#	(at your option) any later version.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program; if not, write to the Free Software
#	Foundation, Inc., 59 Temple Place, Suite 330, Boston,
#       MA 02111-1307 USA
#

VERSION	= $(shell cat VERSION)
RELEASE	= $(shell cat RELEASE)
CC	= c++
COPTS   = -O2
CFLAGS	= -Wall -Wunused $(COPTS)
LIB	= -lstdc++
BIN	= /usr/local/bin
MANDIR	= /usr/local/man
INSTALL = install
SCRIPT	= bg5sgmlcheck bg5sgml2html bg5sgml2latex bg5sgml2txt bg5sgml2lyx \
	  gbsgmlcheck gbsgml2html gbsgml2latex gbsgml2txt gbsgml2lyx

.SUFFIXES: .html .txt .tex .lyx .sgml
.sgml.html:
	@PATH=.:$(PATH) ./bg5sgml2html $<
.sgml.txt:
	./bg5sgml2txt $<
.sgml.tex:
	@PATH=.:$(PATH) ./bg5sgml2latex $< --clean \
		--output=tex --output=dvi --output=ps
.sgml.lyx:
	@PATH=.:$(PATH) ./bg5sgml2lyx $< 


all:	mb2a script readme.html readme.txt readme.tex readme.lyx

mb2a:	mb2a.cc
	$(CC) $(CFLAGS) $(LIB) -o mb2a mb2a.cc

zhsgmltools:	zhsgmltools.in pre-CJK-LaTeX.pl.in
	perl -pe 'if (/#CJK_PRE-PROCESSOR_SCRIPT#/) { \
		open(PRECJK, "<pre-CJK-LaTeX.pl.in"); \
		while (<PRECJK>) { \
			s/(?=[\\\$$])/\\/g; \
			s/@([A-Z]+)@/\$$$$1/g; \
			s/^/\t\t/; \
			print; \
		} \
		close(PRECJK); \
	}' $@.in > $@
	chmod +x $@

script: zhsgmltools
	@for i in $(SCRIPT); do [ -f $$i ] || ln zhsgmltools $$i ; done
	@touch script

version:
	@echo This is version $(VERSION), release $(RELEASE).

install:	uninstall
	$(INSTALL) -s -m 0755 -o 0 -g 0 mb2a $(BIN)
	$(INSTALL) -m 0755 -o 0 -g 0 zhsgmltools $(BIN)
	for i in $(SCRIPT); \
		do ln $(BIN)/zhsgmltools $(BIN)/$$i ; \
	done
	@rm -f $(BIN)/zhsgmltools

uninstall:
	for i in $(SCRIPT) zhsgmltools mb2a; do rm -f $(BIN)/$$i; done

doc:	mb2a script
	@PATH=.:$(PATH) ./bg5sgml2html readme
	@if [ -n "`type -p lynx`" ]; then \
		PATH=.:$(PATH) ./bg5sgml2txt readme ; \
	fi
	@if [ -n "`type -p chilatex`" -o -n "`type -p bg5latex`" ]; then \
		PATH=.:$(PATH) ./bg5sgml2latex readme --clean \
				--output=tex --output=dvi --output=ps ; \
	fi
	@PATH=.:$(PATH) ./bg5sgml2lyx readme

clean:
	rm -f mb2a *.o a.out core tmp@
	rm -rf zh-sgmltools-*
	rm -f *.htm *.html *.tex *.dvi *.ps *.aux *.toc *.log *.txt
	rm -f *.info *.rtf *.man *.lyx
	rm -f $(SCRIPT) script

pack:	clean
	FILE=`ls *`; mkdir zh-sgmltools-$(VERSION)-$(RELEASE); \
	cp -pf $$FILE zh-sgmltools-$(VERSION)-$(RELEASE)
	tar cf - zh-sgmltools-$(VERSION)-$(RELEASE) | \
	gzip -9 > ../zh-sgmltools-$(VERSION)-$(RELEASE).tar.gz
	rm -rf zh-sgmltools-$(VERSION)-$(RELEASE)

buildrpm:
	@echo "%define version $(VERSION)" >> \
		/usr/src/redhat/SPECS/zh-sgmltools.spec
	@echo "%define release $(RELEASE)" >> \
		/usr/src/redhat/SPECS/zh-sgmltools.spec
	@cat zh-sgmltools.spec >> /usr/src/redhat/SPECS/zh-sgmltools.spec
	rpm -ba /usr/src/redhat/SPECS/zh-sgmltools.spec

rpm2:
	@cp -f ../zh-sgmltools-$(VERSION)-$(RELEASE).tar.gz \
		/usr/src/redhat/SOURCES
	@echo '%define packager Chih-Wei Huang <cwhuang@linux.org.tw>' > \
		/usr/src/redhat/SPECS/zh-sgmltools.spec
	@echo '%define distribution Chinese Linux Extension' >> \
		/usr/src/redhat/SPECS/zh-sgmltools.spec

rpm:	pack rpm2 buildrpm

rhcn2:
	@cp -f ../zh-sgmltools-$(VERSION)-$(RELEASE).tar.gz \
		/usr/src/redhat/SOURCES
	@echo '%define packager Red Hat Contrib|Net <rhcn-bugs@redhat.com>' > \
		/usr/src/redhat/SPECS/zh-sgmltools.spec
	@echo '%define distribution Red Hat Contrib|Net' >> \
		/usr/src/redhat/SPECS/zh-sgmltools.spec

rhcn:	pack rhcn2 buildrpm