# lattice lmkfile
#OPTI = opt optinline optinlocal optcomp 10 optdepth 3 optrdepth 3 
OPTI = opt optinline optinlocal
#opti = 
CC = sc
#COPTS = streq math ieee ignore 161   debug full
#COPTS2 = $(COPTS)
COPTS= streq math ieee $(OPTI) ignore 161
COPTS2 = streq math ieee $(OPTI) ignore 161

OBJECTS1 = st_read.o commands.o automaton.o st_play.o open.o empty.o \
tools.o dump_song.o setup_audio.o notes.o display.o autoinit.o tags.o prefs.o \
color.o version.o st_virt.o play_list.o 

OBJECTS2 = Arch/amiga/ui.o Arch/amiga/client.o Arch/amiga/popen.o Arch/amiga/audio.o main.o \
Arch/amiga/scroll_window.o Arch/amiga/events.o Arch/amiga/requester.o Arch/amiga/wb2cli.o \
Arch/amiga/scroll.o Arch/amiga/info.o Arch/amiga/inhibit.o Arch/amiga/usage.o Arch/Amiga/handle_options.o

SERVOBJECTS = Arch/amiga/server/smain.o Arch/amiga/server/sound.o Arch/amiga/server/timer.o



VERSION=4.43


all: tracker #server


config.h:   Arch/amiga/config.h
   copy Arch/amiga/config.h config.h

server: $(SERVOBJECTS)
	sc link $(SERVOBJECTS) to $@


tracker: config.h $(OBJECTS1) $(OBJECTS2) $(SERVOBJECTS)
	sc <with <
link math ieee
$(OBJECTS1) $(OBJECTS2) $(SERVOBJECTS)
to $@ lib lib:reqtools.lib
<

open.o: open.c
   $(CC) $(COPTS) define COMPRESSION_FILE="s:compression_methods" open.c

.c.o:
	$(CC) $(COPTS) $*.c

version.c: smakefile
   echo >version.c "char **VERSION=*"$(VERSION)*", **amiga_version = *"$$VER: tracker $(VERSION)$$*";"

version.o: version.c
   $(CC) $(COPTS) $*.c

Arch/amiga/server/smain.o: Arch/amiga/server/smain.c
	sc NOSTACKCHECK $(COPTS2) $?

Arch/amiga/server/sound.o: Arch/amiga/server/sound.c
	sc NOSTACKCHECK $(COPTS2) $?

Arch/amiga/server/timer.o: Arch/amiga/server/timer.c
	sc NOSTACKCHECK $(COPTS2) $?

clean:
   -delete $(OBJECTS1) 
   -delete $(OBJECTS2)
   -delete $(SERVOBJECTS)

cleanserv:
	delete $(SERVOBJECTS)
