/********************************************************************************
 * Copyright (c) Des Herriott 1993, 1994
 *               Erik Kunze   1995, 1996, 1997
 *
 * Permission to use, distribute, and sell this software and its documentation
 * for any purpose is hereby granted without fee, provided that the above
 * copyright notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that the name
 * of the copyright holder not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior permission.  The
 * copyright holder makes no representations about the suitability of this
 * software for any purpose.  It is provided "as is" without express or implied
 * warranty. THE CODE MAY NOT BE MODIFIED OR REUSED WITHOUT PERMISSION!
 *
 * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 * Author: Des Herriott
 *         Erik Kunze
 *******************************************************************************/

/* $Id: Imakefile,v 3.10 1997/10/24 13:17:25 erik Rel $ */

#if ProjectX < 5
#define XCOMM #
#define NullParameter
#define InstallNonExecFile InstallNonExec
#endif

XCOMM Imakefile for XZX

PROGRAMS = xzx

SUBDIRS = free roms contrib

#include <xzx.config>

SRCS =	audio.c debug.c dis.c emul.c if1.c io.c joystick.c \
	loadsave.c main.c mem.c snapshot.c tables.c util.c

OBJS =	audio.o debug.o dis.o emul.o if1.o io.o joystick.o \
	loadsave.o main.o mem.o snapshot.o tables.o util.o


XCOMM --- Do not change anything below this line ---


/* Additional compiler flags ***************************************************/

#ifdef NecArchitecture
CCOPTIONS = -I. -I./z80 -I./free -ZXNd=8000 -ZXNp=8000 -KOlimit=2000
#else
CCOPTIONS = -I. -I./z80 -I./free
#endif

DEFINES = $(END_DEF) $(SHM_DEF) $(TERMINAL_DEF) $(NAME_DEF) $(STRCASE_DEF) \
	  $(ESCAPE_DEF) $(JOY_DEF) $(AUDIO_DEF) $(IO_DEF) $(IF1_DEF) \
	  $(SLOW_DEF) $(MF128_DEF) $(PRINTER_DEF) $(PLUS3_DEF) $(DND_DEF) \
          -DUSRLIBDIR=\"$(LIBDIR)\" -DLIBDIR=\"$(ZXLIBDIR)\" -UREGISTERED

DEPENDFLAGS = $(CCOPTIONS) $(DEFINES)

/* Additional libraries ********************************************************/

LOCAL_LDFLAGS = -L./free

/* Linux usally has flex and libfl.a installed. */

#ifdef LinuxArchitecture
LOCAL_LIBRARIES = -lxzx -lfl
#else
LOCAL_LIBRARIES = -lxzx -ll
#endif

/* Make targets ****************************************************************/

#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'

AllTarget($(PROGRAMS))
DependTarget()
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
MakeLintLibSubdirs($(SUBDIRS))
MakeLintSubdirs($(SUBDIRS),install.ln,install.ln)
NormalProgramTarget(xzx,$(OBJS),libxzx,$(LOCAL_LIBRARIES),$(XLIB))

/* Additional rules for xzx library. Does not work without this! **************/

libxzx::
	(cd free; $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all)

/* Installation ****************************************************************/

/* Define this if you want XZX installed suid root. Only bother doing this on
   Linux with PC Speaker support defined */

#if defined(LinuxArchitecture) && defined(i386Architecture)
#define InstallXzxSetUID
#endif

#ifdef InstallXzxSetUID
InstallProgramWithFlags(xzx,$(BINDIR),$(INSTUIDFLAGS))
#else
InstallProgramWithFlags(xzx,$(BINDIR),NullParameter)
#endif

InstallManPage(xzx,$(MANDIR))
InstallAppDefaults(Xzx)

/* EOF *************************************************************************/
