#
# Makefile for SAS/C 6.58
#

HDRS = \
  h-basic.h \
  h-define.h h-type.h h-system.h h-config.h

INCS = \
  angband.h \
  config.h defines.h types.h externs.h \
  z-term.h z-rand.h z-util.h z-virt.h z-form.h $(HDRS)

# Objects split into two parts to avoid 256 char limit.

OBJS = \
  z-util.o z-virt.o z-form.o z-rand.o z-term.o \
  variable.o tables.o util.o cave.o \
  object1.o object2.o monster1.o monster2.o \
  xtra1.o xtra2.o spells1.o spells2.o \
  melee1.o melee2.o save.o files.o \
  cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o

OBJS2 = \
  store.o birth.o load.o \
  wizard1.o wizard2.o obj-info.o \
  generate.o dungeon.o init1.o init2.o randart.o \
  script.o use-obj.o x-spell.o l-misc.o l-monst.o l-object.o \
  l-player.o l-random.o l-spell.o l-ui.o \
  sound-ami.o main-ami.o main.o

LIBS = LIB sc:lib/reqtools.lib LIB sc:lib/scmnb.lib LIB sc:lib/sc.lib \
  LIB sc:lib/amiga.lib LIB lua/lua.lib

#

CFLAGS = DEFINE AMIGA DEFINE USE_AMI

all: lua.lib Angband.gst Angband
   @VersionWB TEXT COMFILE COMERASE QUIET Angband
   @echo Angband compiled...

Angband.gst : $(INCS)
   @echo "Building GST ..."
   @-delete >NIL: Angband.GST
   @gst >NIL: Angband.GST unload
   @echo >makegst.c "\#include *"angband.h*""
   @sc makegst.c MAKEGST Angband.GST NOOBJNAME

Angband: $(OBJS) $(OBJS2)
   @echo Linking...
   @echo >t:temp "LIB:c.o $(OBJS) "
   @echo >>t:temp " $(OBJS2) "
   @echo >>t:temp "TO Angband $(LIBS) NOICONS STRIPDEBUG"
   @slink WITH t:temp QUIET
   @-delete t:temp

lua.lib:
	@execute <<
cd lua
smake
<<

clean:
   @-delete (*.o|*.bak|*.gst) QUIET

.c.o:
   @echo Compiling $*.c
   @sc $(CFLAGS) $*

optimap.o:
   @copy Data:Compile/optimap.o to optimap.o

vers.h:
   
   @Data:Compile/bablosdate


#
# Hack -- some file dependencies
#

birth.o: birth.c $(INCS)
bldg.o: bldg.c $(INCS)
cave.o: cave.c $(INCS)
cmd1.o: cmd1.c $(INCS)
cmd2.o: cmd2.c $(INCS)
cmd3.o: cmd3.c $(INCS)
cmd4.o: cmd4.c $(INCS)
cmd5.o: cmd5.c $(INCS)
cmd6.o: cmd6.c $(INCS)
dungeon.o: dungeon.c $(INCS)
files.o: files.c $(INCS)
generate.o: generate.c $(INCS)
init1.o: init1.c $(INCS)
init2.o: init2.c $(INCS)
load1.o: load1.c $(INCS)
load2.o: load2.c $(INCS)
main-ami.o: main-ami.c $(INCS) main.h vers.h
main.o: main.c $(INCS) main.h
melee1.o: melee1.c $(INCS)
melee2.o: melee2.c $(INCS)
monster1.o: monster1.c $(INCS)
monster2.o: monster2.c $(INCS)
obj-info.o: obj-info.c $(INCS)
object1.o: object1.c $(INCS)
object2.o: object2.c $(INCS)
save.o: save.c $(INCS)
sound-ami.o: sound-ami.c
spells1.o: spells1.c $(INCS)
spells2.o: spells2.c $(INCS)
store.o: store.c $(INCS)
tables.o: tables.c $(INCS)
util.o: util.c $(INCS)
variable.o: variable.c $(INCS)
wizard1.o: wizard1.c $(INCS)
wizard2.o: wizard2.c $(INCS)
xtra1.o: xtra1.c $(INCS)
xtra2.o: xtra2.c $(INCS)
z-form.o: z-form.c $(HDRS) z-form.h z-util.h z-virt.h
z-rand.o: z-rand.c $(HDRS) z-rand.h
z-term.o: z-term.c $(HDRS) z-term.h z-virt.h
z-util.o: z-util.c $(HDRS) z-util.h
z-virt.o: z-virt.c $(HDRS) z-virt.h z-util.h

