# Makefile for TeXplorators dvipaste
#
# config.unix.h is supplied as a model.
#
# UnixTeX would like to hear of any interesting
# alterations you may have to make to it.
#
# If you are on a Unix system, check the settings
# below, and if they suit you:
# 	make prepare,
# 	make all, 
#	make dotest
# then preview ./test/newjoin.dvi with your previewer.
# If all appears to be fine, make install.
# 
# If you are on a DOS system, copy config.MS.h to config.h.
# This Makefile may not work for MSDOS. Make your own,
# or compile by hand.
#
CFLAGS =

#CC = gcc
#OPTS = -traditional -O
# If you are using gcc on a DEC machine,
# replace -traditional with -ansi:
# OPTS= -ansi -O

# RS/6000, AIX 3.2, sites: use xlc instead of cc.
CC = cc
OPTS = -O

# RS/6000, AIX 3.2, sites: use /usr/ucb/install instead.
INSTALL = install

DESTDIR= /usr/local/bin


all:	dvipaste 

dvipaste:	dvipaste.o
	$(CC) -o dvipaste $(ARCH) $(OPTS) dvipaste.o

dvipaste.o:	dvipaste.c config.h
	$(CC) $(ARCH) $(OPTS) -c dvipaste.c

prepare:	endian.h

endian.h:	endian
	./endian > endian.h
	cp config.unix.h config.h

endian:		endian.c
	$(CC) -o endian $(OPTS) endian.c

config.h:
	@if test ! -f config.h ; then \
		echo "If you are on a Unix system, you must first make prepare;" ; \
		echo "if you are on a DOS system, copy config.MS.h to config.h." ; exit 1 ; \
	fi

dotest:	./test/boxes1.tex ./test/boxes2.tex \
		./test/dvipaste.tex ./test/join.tex
	-(cd test ; tex boxes1 ; tex boxes2 ; tex join ; \
	../dvipaste join newjoin )

install:	dvipaste
	$(INSTALL) -c -m 755 -s dvipaste $(DESTDIR)

clean:
	rm -f *.o *~ \#* core *.log 

veryclean:	clean
	rm -f config.h dvipaste endian endian.h
	(cd test ; rm -rf *.dat *.dvi *.log)

	
