#
# This SMakefile collects all files necessary for porting Web2c 7.2
# to the Amiga with SAS/C++ 6.58 and creates the archive for the Aminet
# or CTAN distribution in LHA or TAR format respectively.
#
# Copyright (C) 1997 by Andreas Scherer.
# This makefile is free software; the author gives unlimited permission
# to copy, distribute, and modify it.
#

# The list of files added to Web2c on the Amiga:
# ==============================================
# General stuff for easy installation:
general = SMakefile \
	configure.rexx \
	install.rexx
#
# DTL (DVI Text Language) package:
dtl = dtl/SMakefile.in
#
# DVI to DVI converter:
dvidvi = dvidvi/SMakefile.in
#
# DVI driver for HP LaserJet IV:
dviljk = dviljk/SMakefile.in
#
# General purpose DVI-to-PostScript converter:
dvipsk = dvipsk/SMakefile.in \
	dvipsk/texc.rexx
#
# Convert PostScript outline fonts to PK bitmap fonts:
gsftopk = gsftopk/c-auto.sed.in \
	gsftopk/SMakefile.in
#
# General purpose file-lookup library:
kpathsea = kpathsea/c-auto.sed \
	kpathsea/depend.smake \
	kpathsea/SMakefile.in
#
# LaTeX syntax checker:
lacheck = lacheck/SMakefile.in
#
# Chunks of SMakefiles used everywhere:
make = make/clean.smake \
	make/common.smake \
	make/config.smake \
	make/library.smake \
	make/paths.smake \
	make/programs.smake \
	make/texi.smake \
	make/tkpathsea.smake
#
# General purpose index manager (separate because no WEB program):
makeindexk = makeindexk/SMakefile.in
#
# MusixTeX utility:
musixflx = musixflx/SMakefile.in
#
# Another PostScript-to-PK converter:
ps2pkm = ps2pkm/hints.ch \
	ps2pkm/regions.ch \
	ps2pkm/SMakefile.in
#
# SeeTeX:
seetexk = seetexk/SMakefile.in
#
# TeX for HTML:
tex4htk = tex4htk/SMakefile.in \
	tex4htk/tex4ht.rexx
#
# Web2c support library including assembler routines:
web2clib = web2c/lib/opt680x0.a \
	web2c/lib/SMakefile.in
#
# Tools for using TeX labels in METAPOST graphics:
mpware = web2c/mpware/makempx.rexx \
	web2c/mpware/SMakefile.in
#
# Extended/Enhanced/European TeX:
etexsupport = web2c/etexdir/etex.smake
#
# 16-bit extension of TeX; Omega:
omegasupport = web2c/omegadir/omega.smake \
	web2c/otps/depend.smake \
	web2c/otps/SMakefile.in
#
# Alternative TeX for creating output in PDF:
pdftexsupport = web2c/pdftexdir/pdftex.smake \
	web2c/pdftexdir/SMakefile.in \
	web2c/pdftexdir/ttf2tfm.rexx \
	web2c/pdftexdir/libpng/SMakefile.in \
	web2c/pdftexdir/zlib/SMakefile.in
#
# (Not-so-) General purpose WEB (i.e. Pascal) to C converter:
web2c = web2c/doc/SMakefile.in \
	web2c/web2c/convert.rexx \
	web2c/web2c/cvtmf3.sed \
	web2c/web2c/SMakefile.in
#
# "TeX and friends":
taf = web2c/depend.smake \
	web2c/kpathsea.smake \
	web2c/SMakefile.in

# Include or update each file in the archive:
# ===========================================
filelist = contents

# For Aminet distribution:
# ========================
LHAPACK = lha -x -r  u
lha = texk-ami.lha

# For CTAN distribution:
# ======================
TARPACK	= tar -c -v -f
tar = texk-ami.tar

default: $(tar) $(lha)

aminet: $(lha)
$(lha): $(filelist)
	$(LHAPACK) $@ @$(filelist)
ctan: $(tar)
$(tar): $(filelist)
	$(TARPACK) $@ -T $(filelist)

#
# Auxiliary targets for automatic contents creation:
# ==================================================

break = break.sed
tempfile = $(filelist).temp

$(filelist): $(dtl) $(dvidvi) $(dviljk) $(dvipsk) $(etexsupport) $(general) \
$(gsftopk) $(kpathsea) $(lacheck) $(make) $(makeindexk) $(mpware) $(musixflx) \
$(omegasupport) $(pdftexsupport) $(ps2pkm) $(seetexk) $(taf) $(tex4htk) \
$(web2c) $(web2clib)
	@echo $(dtl) $(dvidvi) $(dviljk) $(dvipsk) $(etexsupport) > $(tempfile)
	@echo $(general) $(gsftopk) $(kpathsea) $(lacheck) $(make) >> $(tempfile)
	@echo $(makeindexk) $(mpware) $(musixflx) $(omegasupport) >> $(tempfile)
	@echo $(pdftexsupport) $(ps2pkm) $(seetexk) $(taf) >> $(tempfile)
	@echo $(tex4htk) $(web2c) $(web2clib) >> $(tempfile)
	@echo s/ /\\ > $(break)
	@echo /g >> $(break)
	@sed -f $(break) $(tempfile) > $(filelist)
	@delete force quiet $(tempfile) $(break)

# For use on UNIX/LinuX systems:
# ==============================
Makefile: SMakefile
	@sed -e 's/@delete force quiet/@rm -f/g' SMakefile > Makefile

# EOF SMakefile
