
## "UNTIL", a graphics editor,
##    Copyright (C) 1985, 1990 California Institute of Technology.
##    Original author: Glenn Gribble, port by Steve DeWeerth
##    Unix Port Maintainer: John Lazzaro
##    Maintainers's address: lazzaro@hobiecat.cs.caltech.edu;
##                           CB 425 CU Boulder/Boulder CO 91125. 
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation (Version 1, 1989).
##
## This program 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 program; see the file COPYING.  If not, write to the
## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
## USA. 

## comment blocks in this Makefile point to possible changes that need
## to be made for different systems. Its a good idea to look over each
## block and make necessary changes before doing a "make install"


LOCINC = ../../psys/include

##
## If X isn't in the include path (the case for many MachTen and Linux 
## installations) change XINCLUDEDIR to reflect this:
##
## XINCLUDEDIR = /usr/X11R6/include
##
## or maybe
##
## XINCLUDEDIR = /usr/X11/include
##
## or some other directory, depending on your installation. Use the
## first one for OS X.
##


XINCLUDEDIR = .

##
## If X isn't in the library path (the case for many MachTen and Linux 
## installations) change LIBX11 to reflect this:
##
## LIBX11 = -L/usr/X11/lib -lX11
##
## or maybe
##
##  LIBX11 = -lX11 -L/usr/X11R6/lib
##
## or some other directory, depending on your installation. Use the
## first one for OS X.
##


LIBX11 = -lX11


LIBP2C = ../../psys/src/libp2c.a

##
## (1) Library additions
## ---------------------
##
## on some systems, -ldl must be added to the following line

OTHERLIBS= -lm

##
##  (2) Choosing your compiler
##  ---------------------------
##
## For Sun SPARC, HP series 300/400, and Apple, gcc is recommended, 
## most 2.XX and 1.XX work well.
##
## For DEC MIPS-based Ultrix, a "stable" gcc 2.X.X is recommended
##
## For HP series 700/800 (extra-cost) ANSI cc is recommended (see below for
##  options). HP's non-ANSI cc will not work, and gcc presently has some
##  problems with <varargs.h>. For version 8.05 (and earlier) of HP ANSI cc
##  you will need a patch tape from HP to fix compiler bugs; alternatively,
##  you can get around the problem by compile the file math.c 
##  with the gcc 2.XX compiler. 
##
## For IBM RS/6000, xlc is recommended (see below for options)
##
## For Linux & FreeBSD, gcc 2.X.X is recommended (see below for options)
##
## For SGI machines, cc is recommended.
##
## For AmigaOS, ADE (Amiga Development Enviroment) with gcc is recommended.
##
  

CHIPMUNKCC = gcc
CC = $(CHIPMUNKCC) 

BINDIR = ../../bin
LIBDIR = `pwd`/../../lib

SYSRC =  $(LIBDIR)/system.untilrc
SYSPS =  $(LIBDIR)/pensps.map
SYSHD =  $(LIBDIR)/until.ps

##
## (3) Adding appropriate flags
## -----------------------------
##
## for HP series 800 (using cc), add these flags to CHIPMUNKFLAGS
##
## -w -Aa -D_HPUX_SOURCE -DF_OK=0
##
## for IBM RS/6000 (using xlc) add these flags 
##
##  -DBSD=0
##
## for Apple OS/X, add this flags 
##
##  -DBSD -Dlinux -Dfreebsd
##
## for AU/X, add this flags 
##
##  -Daux
##
## for linux gcc 2.3.3 using xfree1.1 Xserver, add these flags 
##
## -DBSD -Dlinux -DF_OK=0 
##
## also add the flag
##
## -m486 
##
## if you are running on a 486-compatable CPU. For maximum speed, try the
## flags -fomit-frame-pointer -O6; however, the former flag will make it
## difficult for you to track down any bugs that occur while using the
## tools, and the latter will expose you to possible optimizer bugs. However,
## our alpha-testers have reported no problems using these two flags.
##
##
## For freeBSD, add the following flags 
##
##  -DBSD -Dfreebsd -Dlinux -DF_OK=0 -m486 
##
## for SGI add these flags 
##
## CFLAGS =  -ansi 
##
## for AmigaOS using gcc, add these flags 
##
## -ansi -DBSD -DF_OK=0
##
## to increase speed, try to add -O3 and, based on your CPU, one of these
##
##   -m68020              : for 68020
##   -m68020 -m68881      : for 68020+6888x
##   -m68030              : for 68030
##   -m68030 -m68881      : for 68030+6888x
##   -m68040              : for 68040 and 68060
##
## if you are using X shared library with ADE , see notes below
## in until rule
##

CHIPMUNKFLAGS =   

CFLAGS = $(CHIPMUNKFLAGS) -I$(LOCINC) -I$(XINCLUDEDIR) \
-DF_OK=0 -DUNTILRC=\"$(SYSRC)\" -DUNTILPSMAP=\"$(SYSPS)\" \
-DUNTILHEADER=\"$(SYSHD)\"

LDFLAGS = $(LIBP2C)  $(LIBX11) $(OTHERLIBS)

OBJS = bb_stuff.o cnf_stuff.o  crt_stuff.o data_types.o datawalk.o \
dispmod.o ffman.o gr_stuff.o main.o mat_stuff.o menu.o menu_stuff.o \
name_stuff.o prim_stuff.o tablet_stuff.o

until: $(OBJS)
	$(CC) $(CFLAGS) -o until $(OBJS) $(LDFLAGS)

# The following permits you to link properly with AmigaOS and 
# X shared libraries used in ADE
# 
#until: $(OBJS)
#	prelink $(LIBX11)
#	$(CC) -Tshared.x -Wa,-s $(CFLAGS) -o until $(OBJS) $(LDFLAGS)
#	postlink until
#	rm shared.x xlibs.c xlibs.o
  


clean:
	-rm -f *.o until
##
## (4) Name change for ksh users
## -----------------------------

## "until" is a command in ksh, so the program has been renamed to
## Until as its moved to bin; non ksh-users may wish to change it back.

install: until
	cp until $(BINDIR)/Until
	cp pensps.map $(LIBDIR)/pensps.map
	cp system.untilrc $(LIBDIR)/system.untilrc
	cp until.pro  $(LIBDIR)/until.pro
	cp until.ps  $(LIBDIR)/until.ps


bb_stuff.o : bb_stuff.c bb_stuff.h 
cnf_stuff.o : cnf_stuff.c cnf_stuff.h tablet_stuff.h crt_stuff.h \
  mat_stuff.h gr_stuff.h bb_stuff.h data_types.h ffman.h prim_stuff.h \
  menu_stuff.h menu.h
crt_stuff.o : crt_stuff.c crt_stuff.h 
data_types.o : data_types.c data_types.h mat_stuff.h crt_stuff.h bb_stuff.h \
  gr_stuff.h 
datawalk.o : datawalk.c datawalk.h dispmod.h tablet_stuff.h crt_stuff.h \
  mat_stuff.h bb_stuff.h gr_stuff.h data_types.h 
dispmod.o : dispmod.c dispmod.h 
ffman.o : ffman.c ffman.h gr_stuff.h bb_stuff.h mat_stuff.h crt_stuff.h \
  data_types.h 
gr_stuff.o : gr_stuff.c gr_stuff.h bb_stuff.h mat_stuff.h 
main.o : main.c tablet_stuff.h crt_stuff.h mat_stuff.h gr_stuff.h \
  bb_stuff.h data_types.h ffman.h prim_stuff.h menu_stuff.h menu.h \
  cnf_stuff.h name_stuff.h datawalk.h 
mat_stuff.o : mat_stuff.c mat_stuff.h 
menu.o : menu.c menu.h tablet_stuff.h crt_stuff.h mat_stuff.h gr_stuff.h \
  bb_stuff.h data_types.h ffman.h prim_stuff.h 
menu_stuff.o : menu_stuff.c menu_stuff.h tablet_stuff.h crt_stuff.h \
  mat_stuff.h gr_stuff.h bb_stuff.h data_types.h ffman.h 
name_stuff.o : name_stuff.c name_stuff.h tablet_stuff.h \
  crt_stuff.h mat_stuff.h gr_stuff.h bb_stuff.h data_types.h ffman.h \
  prim_stuff.h menu_stuff.h menu.h 
prim_stuff.o : prim_stuff.c prim_stuff.h tablet_stuff.h crt_stuff.h \
  mat_stuff.h gr_stuff.h bb_stuff.h data_types.h 
tablet_stuff.o : tablet_stuff.c tablet_stuff.h crt_stuff.h mat_stuff.h 



## The following part of the Makefile is for making a tar file of the
## original parts of the until distribution. Most users have no need for it.

VERSION = 1.14

dist:
	rm -rf until
	mkdir until 
	mkdir until/V1.2
	cp COPYING Makefile  until/V1.2
	cp *.c *.h *.ps *.map *.untilrc until.pro welcome.ff until/V1.2
	cp -R ../designrules ../doc ../README until/

tardist:
	tar cvf until.tar until
	rm -f until.tar.gz
	gzip until.tar

create: dist tardist 
