#----------------------------------------------------------------------------
#
# This file was chanced for compilation under OS/2 Warp with GCC+emx
#
# Michael Zimmermann, 15.Apr.96, Michael.Zimmermann@post.rwth-aachen.de
#
#----------------------------------------------------------------------------
#
# Changed again for compilation under eComStation with Innotek GCC
# My changes are marked "PJ"
# Compiler: Innotek GCC for OS/2 3.2.2 Beta 4 CSD1
# Make: IBM Developer's Toolkit version 4.5 nmake32 version 5.00.003
# Also used: Bison parser generator version 1.28 (bison128.zip) 
# Runtime library: Innotek libc05.dll
#
# Per Johansson, 2004-08-31, per@johansson.name
#
#----------------------------------------------------------------------------



.SUFFIXES	: .y .c .h .o .gs .s
HFILES		= prelude.h storage.h connect.h errors.h command.h
CFILES		= hugs.c storage.c input.c static.c type.c \
		  output.c compiler.c machine.c builtin.c
INCFILES	= parser.c preds.c bignums.c kind.c subst.c \
		  machdep.c commonui.c
YFILES		= parser.y
SOURCES		= $(HFILES) $(CFILES) $(INCFILES) $(YFILES) prelude
OBJECTS		= storage.o input.o static.o type.o compiler.o
IOBJECTS	= hugs.o builtin.o  machine.o output.o $(OBJECTS)

# Edit the following settings as required.
# There are two choices of command line editor that can be used with Hugs:
#
#  GNU readline:		usual GNU sources (e.g. bash distribution)
#  add -DUSE_READLINE=1 to CFLAGS and libreadline.a -ltermcap to LDFLAGS
#				      (or maybe -lreadline -ltermcap)
#
#  editline:			(comp.sources.misc, vol 31, issue 71)
#  add -DUSE_READLINE=1 to CFLAGS and libedit.a to LDFLAGS
#				      (or maybe -ledit)
#
# The best bet is to `touch prelude.h' after changing these settings to
# ensure that the whole collection of files is recompiled with the correct
# settings.
#
#
# Be sure to define the symbol LESS_OBNOXIOUS if you want the shorter
# version of the startup banner!

CC		= gcc
#CFLAGS		= -DLESS_OBNOXIOUS
# --- modified: ---
# PJ redefined __const__ to be able to compile stdlib.h (Innotek bug)
#CFLAGS		= -Zexe
CFLAGS		= -Zexe -D__const__=const
# PJ -lm = libm.a (math library) seems unnecessary
# PJ LDFLAGS    	= -lm
LDFLAGS    	= 
OPTFLAGS	= -O

all		: hugs

#PJ emxbind is not used any more
hugs		: $(IOBJECTS)
		  $(CC) $(OPTFLAGS) $(IOBJECTS) -o hugs.exe $(LDFLAGS)
#PJ		  emxbind -s hugs.exe

.c.o		:
		  $(CC) -c $(CFLAGS) $(OPTFLAGS) $<

# PJ There is no "rm" command, used "del" instead.
clean		:
		  del *.o
# PJ		  rm *.o


# PJ There is no "mv" command, used "rename" ibstead.
# Also used bison instead of yacc.
parser.c	: parser.y
# PJ		  -yacc parser.y
		  -bison --yacc parser.y
# PJ		  mv y.tab.c parser.c
		  rename y.tab.c parser.c

hugs.o		: prelude.h storage.h connect.h errors.h \
		  command.h machdep.c commonui.c
storage.o	: prelude.h storage.h connect.h errors.h
input.o		: prelude.h storage.h connect.h errors.h parser.c command.h
static.o	: prelude.h storage.h connect.h errors.h
type.o		: prelude.h storage.h connect.h errors.h preds.c kind.c subst.c
output.o	: prelude.h storage.h connect.h errors.h
compiler.o	: prelude.h storage.h connect.h errors.h
		  $(CC) -c $(CFLAGS) compiler.c
machine.o	: prelude.h storage.h connect.h errors.h
builtin.o	: prelude.h storage.h connect.h errors.h bignums.c
