# Makefile for xzx

PROGRAMS = xzx ddtrans

SRCS = main.c mem.c emul.c tables.c xspec.c dtbl.c joystick.c util.c \
	   resource.c rtcfg.c dis.c if1.c audio.c fdc.c loadsave.c snapshot.c
OBJS = main.o mem.o emul.o tables.o xspec.o dtbl.o joystick.o util.o \
	   resource.o rtcfg.o dis.o if1.o audio.o fdc.o loadsave.o snapshot.o

DDSRCS = ddtrans.c
DDOBJS = ddtrans.o

ZXLIBDIR = /usr/local/lib/xzx

LIBS = -lXext -lX11 # -lnsl -lsocket

# CC = cc
# CC = gcc
# CC = xlc -D_ALL_SOURCE                     # for AIX
# CC = cc -D_POSIX_SOURCE -D_XOPEN_SOURCE    # for HP-UX

# CDEBUGFLAGS = -O2 
# CDEBUGFLAGS = -g3 -DDEBUG

# END_DEF  = -DLITTLE_ENDIAN
END_DEF  = -DBIG_ENDIAN

SCAL_DEF = -DSCALING=1

# SHM_DEF  = -DMITSHM

NAME_DEF = -DHAS_UNAME

STRCASE_DEF = -DNEED_STRCASECMP

# JOY_DEF = -DJOY

# AUDIO_DEF = -DDEV_AUDIO
# AUDIO_DEF = -DXBELL_AUDIO
# AUDIO_DEF = -DPCSPKR_AUDIO

# PCSPKR_DEF = -DPCSPKR_AUDIO

IO_DEF = -DPSEUDO_IO

TAPE_DEF = -DLOAD_SAVE

IF1_DEF = -DXZX_IF1

LEVEL_DEF = -DLEVEL_LOADER

# SLOW_DEF = -DSLOWDOWN


# --- Don't change anything below this line ---

DEFINES = $(END_DEF) $(SCAL_DEF) $(SHM_DEF) $(MEM_DEF) $(JOY_DEF) $(NAME_DEF) \
          $(STRCASE_DEF) $(AUDIO_DEF) $(IO_DEF) $(TAPE_DEF) $(IF1_DEF) \
          $(PCSPKR_DEF) $(LEVEL_DEF) $(SLOW_DEF) $(SPEC_DEF)

CFLAGS = $(CDEBUGFLAGS) $(DEFINES)

all: xzx ddtrans 

xzx: $(OBJS)
	$(CC) -o xzx $(OBJS) $(LIBS)

ddtrans: ddtrans.o
	$(CC) -o ddtrans ddtrans.o

clean:
	rm -f xzx ddtrans *.o
