-include Makefile.config

CC=gcc
LD=gcc

CONFIG_DIR=/usr/local/etc
VERSION=0.3.3

OTHERCFLAGS= -O2 -DCOLOR_SUPPORT
# OTHERCFLAGS= -g -DCOLOR_SUPPORT -DVERBOSE_RESTORE
OTHERLDFLAGS=
OTHERLIBS=

FINALCFLAGS = -c -Iinclude -DCONFIG_DIR="\"$(CONFIG_DIR)\"" -DVERSION="\"$(VERSION)\"" $(CFLAGS) $(CURSESCFLAGS) $(OTHERCFLAGS)
FINALLDFLAGS = $(LDFLAGS) $(CURSESLDFLAGS) $(OTHERLDFLAGS)
FINALLIBS = $(CURSESLIBS) $(OTHERLIBS)

COBJS = core/random.o core/quetzal.o core/sound.o \
	core/hotkey.o core/stream.o core/process.o \
	core/input.o core/options.o core/table.o \
	core/math.o core/object.o core/fastmem.o \
	core/files.o core/buffer.o core/variable.o \
	core/redirect.o core/err.o core/text.o core/screen.o \
	core/main.o \
	curses/ux_pic.o curses/ux_screen.o curses/ux_file.o \
	curses/ux_text.o curses/ux_audio_none.o \
	curses/ux_init.o curses/ux_input.o curses/ux_scrollback.o \
	babel/adrift.o \
	babel/advsys.o \
	babel/agt.o \
	babel/alan.o \
	babel/babel_handler.o \
	babel/blorb.o \
	babel/glulx.o \
	babel/hugo.o \
	babel/ifiction.o \
	babel/level9.o \
	babel/magscrolls.o \
	babel/md5.o \
	babel/misc.o \
	babel/register.o \
	babel/register_ifiction.o \
	babel/tads2.o \
	babel/tads3.o \
	babel/tads.o \
	babel/zcode.o

OBJS = $(COBJS)

nfrotz: $(OBJS)
	$(LD) $(FINALLDFLAGS) -o nfrotz $(OBJS) $(FINALLIBS)

clean:
	rm -f nfrotz *.o core/*.o curses/*.o babel/*.o

depend:
	find . -name \*.c | xargs makedepend -Y. -Iinclude >& /dev/null

$(COBJS): %.o: %.c
	$(CC) $(FINALCFLAGS) -o $@ $<

# DO NOT DELETE

./babel/zcode.o: include/treaty_builder.h include/treaty.h
./babel/hugo.o: include/treaty_builder.h include/treaty.h
./babel/md5.o: include/md5.h
./babel/glulx.o: include/treaty_builder.h include/treaty.h
./babel/level9.o: include/treaty_builder.h include/treaty.h
./babel/ifiction.o: include/ifiction.h include/treaty.h
./babel/alan.o: include/treaty_builder.h include/treaty.h
./babel/blorb.o: include/treaty_builder.h include/treaty.h
./babel/agt.o: include/treaty_builder.h include/treaty.h
./babel/register.o: include/modules.h include/treaty.h
./babel/advsys.o: include/treaty_builder.h include/treaty.h
./babel/tads3.o: include/treaty_builder.h include/treaty.h include/tads.h
./babel/tads2.o: include/treaty_builder.h include/treaty.h include/tads.h
./babel/magscrolls.o: include/treaty_builder.h include/treaty.h
./babel/adrift.o: include/treaty_builder.h include/treaty.h
./babel/babel_handler.o: include/treaty.h include/md5.h
./babel/tads.o: include/treaty.h include/tads.h include/md5.h
./babel/register_ifiction.o: include/treaty.h include/modules.h
./core/random.o: include/frotz.h
./core/quetzal.o: include/frotz.h
./core/sound.o: include/frotz.h
./core/hotkey.o: include/frotz.h
./core/stream.o: include/frotz.h
./core/process.o: include/frotz.h
./core/input.o: include/frotz.h
./core/table.o: include/frotz.h
./core/math.o: include/frotz.h
./core/object.o: include/frotz.h
./core/fastmem.o: include/frotz.h include/babel_handler.h include/treaty.h
./core/files.o: include/frotz.h
./core/buffer.o: include/frotz.h
./core/variable.o: include/frotz.h
./core/redirect.o: include/frotz.h
./core/err.o: include/frotz.h
./core/text.o: include/frotz.h
./core/screen.o: include/frotz.h
./core/main.o: include/frotz.h
./curses/ux_pic.o: include/ux_frotz.h include/frotz.h include/ux_setup.h
./curses/ux_screen.o: include/ux_frotz.h include/frotz.h include/ux_setup.h
./curses/ux_text.o: include/ux_frotz.h include/frotz.h include/ux_setup.h
./curses/ux_scrollback.o: include/frotz.h
./curses/ux_audio_none.o: include/ux_frotz.h include/frotz.h
./curses/ux_audio_none.o: include/ux_setup.h
./curses/ux_init.o: include/ux_frotz.h include/frotz.h include/ux_setup.h
./curses/ux_init.o: include/ifiction.h include/treaty.h
./curses/ux_input.o: include/ux_frotz.h include/frotz.h include/ux_setup.h
