# botForth kernel in C  Rob Chapman  May 5, 1992
# Adaptations for 'embedded' for MSDOS with DJGPP
#   Pedro Andr_s Aranda Guti_rrez (paag@alpha.tid.es) Feb 11, 1994
# Macros
#   kernel is the essential core set of files needed
kernel   = kernel.c ii.c io.c library.c shells.c xtras.c theend.c localio.c
kernelo   = kernel.o ii.o io.o library.o shells.o xtras.o theend.o localio.o
           
#   small is for compiling a minimum kernel
small    = $(kernel) signals.c smalties.c ld.c 
#   botforth is for compiling a full system
botforth   = $(kernel) signals.c boties.c file.c aoloader.c timeout.c \
#   timbre is for compiling a system with timbre installed
timbre   = $(kernel) signals.c ties.c file.c aoloader.c timbre.c timeout.c \
           auto.c
timbreo   = $(kernelo) signals.o ties.o file.o aoloader.o timbre.o timeout.o \
             auto.o
# for dependancies between header files c file and object files
c = aoloader.c auto.c boties.c file.c ii.c io.c kernel.c ld.c library.c \
    localio.c shells.c signals.c smalties.c theend.c ties.c timbre.c \
    timeout.c xtras.c
obj = aoloader.o auto.o boties.o file.o ii.o io.o kernel.o ld.o library.o \
      localio.o shells.o signals.o smalties.o theend.o ties.o timbre.o \
      timeout.o xtras.o
h = aoloader.h auto.h botforth.h extii.h extkern.h extlib.h file.h \
    ii.h io.h kernel.h ld.h library.h localio.h shells.h timbre.h \
    timeout.h xtras.h 
# Kernel code and headers for dictionary
# Rulesets and their binaries
clean:
	-rm $(obj)
# for Sun machines with a native ANSI C compiler
#   note: to make this work, fsetpos, fgetpos and memmove must be defined
#         this can be done by using lseek, ftell and ???
sun : $(c) $(h)
	@ gnucc -o sun  -O  -Dfpos_t=int $(timbreo) 
# for HP 9000 series 700 workstations native C compiler in ANSI mode
#   note: -Dunix added to define unix for #ifdef statements in localio.c
snake : $(c) $(h)
	@ cc -o snake -Ae -O -Dunix $(timbre)
bsnake : $(c) $(h)
	@ cc -o botforth -Ae -O -Dunix $(botforth)
# Compile on a DOS machine with Symantec C compiler
scforth : $(c) $(h)
	@ sc -mx -obotforth $(botforth)
sctimbre : $(c) $(h)
	@ sc -mx -otimbre $(timbre)
# for testing a small system
small : $(c) $(h)
	@ cc -o small -Ae -O $(small)
# for use with xdb
xsnake : $(c) $(h)
	@ cc -o xsnake -Ae -g -Dunix $(timbreo)
# for HP 9000 series 400 workstations Gnu compiler
400 :  $(c) $(h)
	@ echo "GNU C Compiling botForth@"
	@ gcc -o 400  -O -fstrength-reduce -fomit-frame-pointer $(timbre)
b400 :  $(c) $(h)
	@ echo "GNU C Compiling botForth@"
	@ gcc -o bf  -O -fstrength-reduce -fomit-frame-pointer $(botforth)
# for PC with gcc
obj2 = ii.o io.o kernel.o ld.o library.o shells.o embedded.o ties.o \
       theend.o xtras.o
TARGET = $(obj2)
forth:  $(TARGET)
		gcc -o forth *.o -lpc
forth.exe:	forth
			strip forth
			aout2exe forth
# object dependancies
#kernel.o:   kernel.c kernel.h
#ii.o:       ii.c ii.h
#io.o:       io.c io.h
#library.o:  library.c library.h
#shells.o:   shells.c shells.h
#xtras.o:    xtras.c xtras.h
#theend.o:   theend.c theend.h
#localio.o:  localio.c localio.h
#ld.o:       signals.c
#file.o:		file.c file.h
#aoloader.o:	aoloader.c aoloader.h
#timbre.o:	timbre.c timbre.h
#timeout.o:	timeout.c timeout.h
#auto.o:		auto.c auto.h
#ld.o:		ld.c ld.h
#smalties.o:	smalties.c $(h)
#boties.o:	boties.c $(h)
#ties.o:     ties.c $(h)
 