1# $Id: Makefile.in,v 1.9 1999/10/25 21:18:21 MRO Exp $
2# Makefile for LaTeX2HTML.
3# Copyright (C) 1997 Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
4
5# @configure_input@
6
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2, or (at your option)
10# any later version.
11
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20# 02111-1307, USA.
21
22#### Start of system configuration section. ####
23AT=@
24DISTVER = @distver@
25srcdir = @srcdir@
26
27PERL = @PERL@
28PLAT = @plat@
29AUTOCONF = autoconf
30
31# All programs
32SCRIPTS = latex2html texexpand pstoimg
33
34# Modules
35MODULES = l2hconf.pm
36
37# for dependencies
38wrappers = wrapper/dos.pin wrapper/macos.pin wrapper/os2.pin \
39        wrapper/unix.pin wrapper/win32.pin
40
41# Switch for Perl Warnings; should always be on
42# temporary solution until latexhtml is cleaned up
43PERLW =# -w
44
45#### End of system configuration section. ####
46
47# Placeholder for additional arguments
48ARGS=#
49
50SHELL = /bin/sh
51
52# Files that can be generated, but should be up to date for a distribution.
53DISTDEP = configure Makefile MANIFEST
54
55buildcmd = config/build.pl
56BUILDOPT=# nothing special, but -devel is a good idea!
57TESTCASE=l2htest# can be overridden on the command line
58installcmd = config/install.pl
59cfgfile = cfgcache.pm
60
61all: ${SCRIPTS} ${MODULES}
62
63devel:
64	$(AT)${MAKE} all BUILDOPT=-devel
65
66# .SUFFIXES:
67
68pstoimg:  ${cfgfile} ${srcdir}/${buildcmd} pstoimg.pin ${wrappers}
69	$(AT)${PERL} ${srcdir}/${buildcmd} -x ${BUILDOPT} $@
70	$(AT)touch pstoimg
71
72latex2html:  ${cfgfile} ${srcdir}/${buildcmd} latex2html.pin ${wrappers}
73	$(AT)${PERL} ${srcdir}/${buildcmd} -x ${BUILDOPT} $@
74	$(AT)touch latex2html
75
76texexpand:  ${cfgfile} ${srcdir}/${buildcmd} texexpand.pin ${wrappers}
77	$(AT)${PERL} ${srcdir}/${buildcmd} -x ${BUILDOPT} $@
78	$(AT)touch texexpand
79
80${cfgfile}: config.status
81
82l2hconf.pm: ${cfgfile} ${srcdir}/${buildcmd} l2hconf.pin
83	$(AT)${PERL} ${srcdir}/${buildcmd} ${BUILDOPT} $@
84	$(AT)touch l2hconf.pm
85
86test: all
87	$(AT)LATEX2HTMLDIR=${srcdir}; export LATEX2HTMLDIR ; \
88	latex2html='' ; \
89	for file in latex2html bin/latex2html* bin/${PLAT}/latex2html*; do \
90	  test -s $$file && latex2html=$$file break ; \
91	done ; \
92	if test -n "$$latex2html"; then \
93	  echo "*** Running test on $$latex2html"; \
94	  cd tests ; ${PERL} ../$$latex2html -test_mode ${ARGS} ${TESTCASE} ; \
95	fi
96
97test_clean:
98	$(AT)cd tests ; \
99	for i in *.tex ; do \
100	  dir=`basename $$i .tex` ; \
101	  rm -rf $$dir ; \
102	done ; \
103	rm -f *.aux *.dvi *.log
104
105test_pstoimg: pstoimg
106	$(AT)LATEX2HTMLDIR=${srcdir}; export LATEX2HTMLDIR ; \
107	pstoimg='' ; \
108	for file in pstoimg bin/pstoimg* bin/${PLAT}/pstoimg*; do \
109	  test -s $$file && pstoimg=$$file break ; \
110	done ; \
111	if test -n "$$pstoimg"; then \
112	  echo "*** Running test: $$pstoimg ${ARGS}"; \
113	  ${PERL} $$pstoimg ${ARGS} ; \
114	fi
115
116texlive: texlive.pm
117	$(AT)cp texlive.pm ${cfgfile}
118	$(AT)${MAKE} all
119
120check: all
121	$(AT)LATEX2HTMLDIR=${srcdir}; export LATEX2HTMLDIR ; \
122	for file in versions/*.pl styles/*.perl; do \
123	  ${PERL} ${PERLW} -c $$file || exit 1; \
124	done ; \
125	for file in ${SCRIPTS} ${MODULES}; do \
126	  test -s $$file && ( ${PERL} ${PERLW} -c $$file || exit 1 ); \
127	  test -s $$file.pl && ( ${PERL} ${PERLW} -c $$file.pl || exit 1 ); \
128	done ; \
129	exit 0
130
131install: all
132	$(AT)${PERL} ${installcmd}
133
134# Don't cd, to avoid breaking install-sh references.
135
136${srcdir}/configure:
137	$(AT)cd ${srcdir} && \
138	${AUTOCONF}
139
140Makefile: Makefile.in config.status
141	$(AT)./config.status
142
143config.status: ${srcdir}/configure config/config.pl
144	$(AT)./config.status --recheck
145
146clean mostlyclean distclean:: test_clean
147	$(AT)rm -f ${SCRIPTS} ${MODULES} *.tmp *.bak *.pl
148	$(AT)rm -fr bin
149	$(AT)rm -f *~ styles/*~
150
151distclean::
152	$(AT)rm -f Makefile config.status config.cache config.log ${cfgfile}
153	$(AT)rm -f test.bat install.bat
154
155MANIFEST:
156	$(AT)${PERL} make_manifest \
157	  -x configure.in \
158	  -x make_manifest \
159	> MANIFEST
160
161# Create a distribution based on the MANIFEST file
162dist: ${DISTDEP}
163	$(AT)distname=latex2html-${DISTVER} ; \
164	rm -fr $$distname; \
165	mkdir $$distname; \
166	for item in `cat MANIFEST`; do \
167	  test -d $$item && mkdir $$distname/$$item; \
168	  test -f $$item && ( \
169	    ln $$item $$distname/$$item || \
170	    { echo copying $$item instead; cp -p $$item $$distname/$$item;}; \
171	  ) ; \
172	done; \
173	chmod -R u+rw,go-w+rX $$distname; \
174	tar -chz -f $$distname.tar.gz $$distname; \
175	rm -fr $$distname
176
177# Create a zipped dist
178zipdist: ${DISTDEP}
179	$(AT)distname=latex2html-${DISTVER} ; \
180	rm -fr $$distname; \
181	mkdir $$distname; \
182	for item in `cat MANIFEST`; do \
183	  test -d $$item && mkdir $$distname/$$item; \
184	  test -f $$item && ( \
185	    ln $$item $$distname/$$item || \
186	    { echo copying $$item instead; cp -p $$item $$distname/$$item;}; \
187	  ) ; \
188	done; \
189	chmod -R u+rw,go-w+rX $$distname; \
190	zip -r -y $$distname.zip $$distname; \
191	rm -fr $$distname
192
193# no comment...
194love:
195	$(AT)echo "...not war!"
196
197