# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#  
#  The Hacker Crackdown (c) 1992, 1994 by Bruce Sterling
#  
#  Texinfo by -joke
#  
#  This file is free text; 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, or (at your option)
#     any later version.
#  
#  This file 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 file; if not, write to the Free Software
#     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#  
#     $Id: Makefile,v 1.2 1994/02/23 14:10:51 joke Exp $
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

CRACK		= crackdown
PCCRACK		= crack
VERS		= 1.2
PAPER		= letter

TEXINFO		= $(CRACK).texi

INFOFILE	= $(CRACK)-$(VERS).info
DVIFILE 	= $(CRACK)-$(VERS).dvi
PSFILE		= $(CRACK)-$(VERS).ps
SHARFILE	= $(CRACK)-$(VERS).shar
TARFILE		= $(CRACK)-$(VERS).tar
TXTFILE		= $(CRACK)-$(VERS).txt

USDVIFILE 	= $(CRACK)-$(VERS)-US.dvi
USPSFILE	= $(CRACK)-$(VERS)-US.ps

DISTDIR		= $(CRACK)

BLURB		=	\
	README		\
	CONTENTS

PARTS		=	\
	$(CRACK).texi	\
	preface.texi	\
	intro.texi	\
	chrono.texi	\
	part1.texi	\
	part2.texi	\
	part3.texi	\
	part4.texi	\
	after.texi	

XPARTS		=	\
	specials.texi	\
	texi2dvi	\
	texi2html	\
	texi2html.ext	\
	fonts/*

CONFIGS		=	\
	config/Makefile.a4	\
	config/Makefile.us	\
	config/$(CRACK).a4	\
	config/$(CRACK).us	\
	configure

PATCHES		= 	\
	patches/makeinfo-1.55.patch

HTMLINTRO	= $(PCCRACK).html
HTMLTAR 	= $(CRACK)-$(VERS).html.tar

HTMLTEXI	= $(PCCRACK).texi
HTMLFILES	= $(PCCRACK)_[0-9]*.html
HTMLFOOT	= $(PCCRACK)_foot.html
HTMLTOC		= $(PCCRACK)_toc.html

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
COMPRESS	= gzip -9 -v
ZSUFF		= gz

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
default:dvi

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
all:	ps info txt html

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ps:	dvi
	dvips -r0 -t$(PAPER) -o $(PSFILE) $(DVIFILE)

dvi:	clean
	./texi2dvi $(TEXINFO)
	./texi2dvi $(TEXINFO)
	mv $(CRACK).dvi $(DVIFILE)

txt:	clean
	makeinfo --verbose --no-split --fill-column 78 --no-headers \
$(TEXINFO) --output $(TXTFILE)

info:	clean
	makeinfo --verbose --no-split $(TEXINFO) --output $(INFOFILE)

html:
	cp $(TEXINFO) $(HTMLTEXI)
	./texi2html -verbose -menu -split_node $(HTMLTEXI)
	mv $(HTMLTOC) $(HTMLINTRO)

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
html-tar: html
	chmod 644 $(HTMLINTRO) $(HTMLFILES)
	tar cvf $(HTMLTAR) $(HTMLINTRO) $(HTMLFILES)
	$(COMPRESS) $(HTMLTAR)

tar:	clean
	tar cvf $(TARFILE) $(BLURB) $(PARTS) $(XPARTS) $(CONFIGS) $(PATCHES)
	$(COMPRESS) $(TARFILE)

dist:	ps info txt tar html-tar
	$(RM) -r $(DISTDIR)
	mkdir $(DISTDIR)
	cp $(BLURB) $(DISTDIR)
	mv $(TARFILE).$(ZSUFF) $(DISTDIR)
	$(COMPRESS) $(DVIFILE)
	mv $(DVIFILE).$(ZSUFF) $(DISTDIR)
	$(COMPRESS) $(PSFILE)
	mv $(PSFILE).$(ZSUFF) $(DISTDIR)
	$(COMPRESS) $(TXTFILE)
	mv $(TXTFILE).$(ZSUFF) $(DISTDIR)
	$(COMPRESS) $(INFOFILE)
	mv $(INFOFILE).$(ZSUFF) $(DISTDIR)
	mv $(HTMLTAR).$(ZSUFF) $(DISTDIR)
	configure --letter
	( make ps )
	$(COMPRESS) $(DVIFILE)
	mv $(DVIFILE).$(ZSUFF) $(DISTDIR)/$(USDVIFILE).$(ZSUFF)
	$(COMPRESS) $(PSFILE)
	mv $(PSFILE).$(ZSUFF) $(DISTDIR)/$(USPSFILE).$(ZSUFF)
	configure --a4

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
shar:
	shar -c -n "$(CRACK)-$(VERS)" -a -M \
		-s joke@ls11.informatik.uni-dortmund.de \
		-f -L50 -d "-joke" -o "$(SHARFILE)" \
		$(DISTDIR)

ftp:
	tar cvf $(DISTDIR)-$(VERS).tar $(DISTDIR)

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Yes, friends: parts of CRACK's have been edited on an ancient Atari 1040STF
disk:
	mcopy -t -n Makefile $(BLURB) $(PARTS) a:/crack
	mkmanifest Makefile $(BLURB) $(PARTS) >manifest
	chmod +x manifest

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
coffee:
	@echo "...doesn't work, yet."

love:
	@echo "Not war."

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
clean:
	$(RM) *.uue *.$(ZSUFF) *.em* *.ho* *.cp* *.fn* *.ky* *.pg* *.tp* \
*.vr* *.lof *.lot *.log *.aux *.toc *.shar.* *.bak *.old *.html crack.texi

clobber: clean
	$(RM) $(DVIFILE) $(PSFILE) $(INFOFILE) $(TXTFILE)

