# Makefile for rrgb

VPATH = @srcdir@

VER = 0.35

# this looks wrong, but *ops.c are actually #include'd by z80.c
OBJS=main.o z80.o parse_map.o debugger.o disgb.o csock.o

CC = @CC@
CXX = @CXX@
STRIP = @STRIP@

CPPFLAGS += @CPPFLAGS@
LDFLAGS = @LDFLAGS@

OPTS = -DSEG
#CFLAGS=-O3 -fomit-frame-pointer -funroll-loops -Wall $(OPTS)
CFLAGS += @CFLAGS@ $(OPTS)
ifeq ($(shell uname -s),SunOS)
LIBS = -lm -lsocket
else
LIBS = -lm
endif

all: rrgb

rrgb: $(OBJS)
	$(CC) $(OPTS) $(LDFLAGS) -o rrgb $(OBJS) $(LIBS)

clean:
	$(RM) *.o *~ rrgb

distclean: clean
	$(RM) Makefile

install:
	install rrgb /usr/bin
	$(STRIP) /usr/bin/rrgb

src-dist: clean
	tar czf ../rrgb-$(VER).tar.gz *

# Dependencies

z80.o: z80.c z80.h z80ops.c cbops.c

main.o: z80.h disgb.h
