# Makefile.gcc - 20:56 GMT +10:00 Wed 18 Aug 93 - Geoffrey Tobin.
# - make dvgt for gcc.
# Tested on Suns and Sparcs running Sun/OS 4.0.3c and Solaris.
# - for dvgt 3.51 (DVItoVDU version 3.0, gt modification 5, revision 1).
# Compile (without optimization) and link dvgt.

# Targets are all, depend, dvgt, tag and clean.

SHELL = /bin/sh
.SUFFIXES: .h

# INC = -I/usr/local/include	# Where stdlib.h lives?
# INC = -I/usr/local/lib/gcc-include	# Where gcc's stdlib.h lives?
# OPT = -O    # Optimise - many compilers get this horribly wrong.

# Compile-time options:
#	-DNOLOG		Supresses all log files
#	-DNOGL		Use plain vga calls instead of gl calls.  If
#			dvgt doesn't work, or complains that it can't
#			find a 256 color mode, try recompiling it with
#			NOGL set on.

CC = gcc
CFLAGS = -ansi -DNOLOG #-DNOGL
DEBUG = #-g  
DEFN =
INC =
LDFLAGS = -s 
LIB = -lm -lvgagl -lvga
OPT = -O2 -ffast-math -finline-functions -fomit-frame-pointer 

USUALS = config.h globals.h

# Standard Header dependencies:
#   <ctype.h>
#   <fcntl.h>
#   <math.h>
#   <stddef.h>
#   <stdio.h>
#   <stdlib.h>
#   <strings.h>
#   <time.h>
#   <unistd.h>

objs =  dvireader.o dvitovdu.o fontreader.o lstring.o options.o \
	screenio.o unixio.o vdu.o

termobjs = \
	aed512vdu.o \
	linuxvdu.o \
	ncsatelvdu.o \
	regisvdu.o \
	tek4010emu.o \
	vis240vdu.o \
	vis500vdu.o \
	vis550vdu.o \
	vis603vdu.o \
	vis630vdu.o \
	vt100vdu.o \
	vt100132vdu.o \
	vt220vdu.o \
	vt640vdu.o

objects = $(objs) $(termobjs)


srcs =  dvireader.c dvitovdu.c fontreader.c lstring.c options.c \
	screenio.c unixio.c vdu.c

termsrcs = \
	aed512vdu.c \
	linuxvdu.c \
	ncsatelvdu.c \
	regisvdu.c \
	tek4010emu.c \
	vis240vdu.c \
	vis500vdu.c \
	vis550vdu.c \
	vis603vdu.c \
	vis630vdu.c \
	vt100vdu.c \
	vt100132vdu.c \
	vt220vdu.c \
	vt640vdu.c

CSRCS = $(srcs) $(termsrcs)

all: dvgt

.c.o:
	$(CC) $(CFLAGS) $(DEBUG) -c $(INC) $(OPT) $(DEFN) $<

#install: all
#         - install -s -o root -m +s dvgt /usr/TeX/bin

depend: $(CSRCS)
	$(CC) -M $(CSRCS) > makedep
	@echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	@echo '$$r makedep' >>eddep
	@echo 'w' >>eddep
	@cp Makefile Makefile.bak
	ed - Makefile < eddep
	@rm -f eddep makedep
	@echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	@echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	@echo '# see make depend above' >> Makefile
	- diff Makefile Makefile.bak
	@rm -f Makefile.bak


dvgt: $(objects)
	$(CC) $(LDFLAGS) $(DEBUG) $(objects) $(LIB) -o dvgt
# Only strip when not DEBUG-ging.
#	strip dvgt

tag:
	ctags -t -w -f TAGS *.h *.c

clean:
	rm -f dvgt core *.o *~ *.vlg


# DO NOT DELETE THIS LINE

dvireader.o : dvireader.c \
  $(USUALS) \
  dvireader.h  files.h  fontreader.h  options.h  screenio.h

dvitovdu.o : dvitovdu.c \
  $(USUALS) \
  defaults.h  dvireader.h  fontreader.h  help.h  new.h  options.h \
  screenio.h  vdu.h  version.h

fontreader.o : fontreader.c \
  $(USUALS) \
  dvireader.h  files.h  fontreader.h  lstring.h  new.h  options.h \
  screenio.h  vdu.h

lstring.o : lstring.c \
  lstring.h  new.h

options.o : options.c \
  $(USUALS) \
  options.h  screenio.h  defaults.h

screenio.o : screenio.c \
  $(USUALS) \
  screenio.h  unixio.h  vdu.h

unixio.o : unixio.c \
  $(USUALS) \
  screenio.h unixio.h

vdu.o : vdu.c \
  $(USUALS) \
  options.h  screenio.h  vdu.h

aed512vdu.o : aed512vdu.c \
  $(USUALS) \
  screenio.h  vdu.h

ncsatelvdu.o : ncsatelvdu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h  vdu.h  vis500vdu.h  vt100vdu.h

regisvdu.o : regisvdu.c \
  $(USUALS) \
  screenio.h  vdu.h  vt100vdu.h

tek4010emu.o : tek4010emu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h

vis240vdu.o : vis240vdu.c \
  $(USUALS) \
  screenio.h  vdu.h

vis500vdu.o : vis500vdu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h  vdu.h

vis550vdu.o : vis550vdu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h  vdu.h  vis500vdu.h  vt100vdu.h

vis603vdu.o : vis603vdu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h  vdu.h

vis630vdu.o : vis630vdu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h  vdu.h  vt100vdu.h

vt100vdu.o : vt100vdu.c \
  $(USUALS) \
  screenio.h  vdu.h

vt100132vdu.o : vt100132vdu.c \
  $(USUALS) \
  screenio.h  vdu.h

vt220vdu.o : vt220vdu.c \
  $(USUALS) \
  screenio.h  vdu.h  vt100vdu.h

vt640vdu.o : vt640vdu.c \
  $(USUALS) \
  screenio.h  tek4010emu.h  vdu.h  vt100vdu.h

# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
