# $Id: Makefile.in,v 1.16 2002/07/09 10:32:33 joy Exp $

CC = @CC@
RC = windres
EXEEXT=@EXEEXT@
TARGET=atari800$(EXEEXT)
CFLAGS=@CPPFLAGS@ @CFLAGS@
DEFS=@DEFS@

PREFIX		= @prefix@
BIN_PATH	= ${PREFIX}/bin
LIB_PATH	= ${PREFIX}/lib
MAN_PATH	= ${PREFIX}/share/man

INCLUDE=-I.

LDFLAGS=@LDFLAGS@
LIBS=@LIBS@

OBJ = \
	atari.o \
	cpu.o \
	monitor.o \
	sio.o \
	devices.o \
	antic.o \
	gtia.o \
	pokey.o \
	pia.o \
	cartridge.o \
	rtime.o \
	prompts.o \
	rt-config.o \
	ui.o \
	ui_basic.o \
	binload.o \
	list.o \
	ataripcx.o \
	log.o \
	compfile.o \
	memory.o \
	statesav.o \
	diskled.o \
	colours.o \
	pokeysnd.o \
	sndsave.o \
	cassette.o \
	input.o

OBJ += @OBJ@

all: $(TARGET)

%.o: %.c
	$(CC) -c -o $@ $(DEFS) $(INCLUDE) $(CFLAGS) $<

%.ro: %.rc
	$(RC) --define WIN32 --define __MINGW32__ --include-dir . $< $@

%.o: %.cpp
	$(CC) -c -o $@ $(DEFS) $(INCLUDE) $(CFLAGS) $<

%.o: %.asm
	cd $(<D); xgen -L1 $(@F) $(<F)
	cd $(<D); gst2gcc gcc $(@F)

$(TARGET): $(OBJ)
	$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)

dep:
	@if ! makedepend -Y $(DEFS) $(INCLUDE) ${OBJ:.o=.c} 2>/dev/null; \
	then echo warning: makedepend failed; fi

clean:
	rm -f $(OBJ) $(TARGET)

install-svgalib : install
	chown root.root ${BIN_PATH}/$(TARGET)
	chmod 4755 ${BIN_PATH}/$(TARGET)

install :
	cp atari800 ${BIN_PATH}/$(TARGET)
	cp atari800.man ${MAN_PATH}/man1/atari800.1

        
