# mk.x86-linux
#

SHELL =		/bin/sh

MAKE =		make
AS =		as --32
CC =		gcc -ansi
CFLAGS =	-O2 -m32
CPP =		gcc -x assembler-with-cpp -E -P
#XOBJS =	xmonitor.o
#LD_LIBS =	-lX11
#BASE_DEFS =	-DHEAP_MONITOR
XOBJS =
XLIBS =		../c-libs/dl/libunix-dynload.a
LD_LIBS =	-ldl
XDEFS =
BASE_DEFS =
#
# NOTE: we need the D_FILE_OFFSET_BITS to avoid problems on some file systems.
#
DEFS		= $(XDEFS) $(BASE_DEFS) -DHOST_X86 -DTARGET_X86 -DOPSYS_UNIX -DOPSYS_LINUX -D_GNU_SOURCE -DGNU_ASSEMBLER -DDLOPEN -D_FILE_OFFSET_BITS=64
TARGET =	X86
VERSION =	v-x86-linux
RUNTIME =	run.x86-linux
RUNTIME_SO =	run.x86-linux.so
RUNTIME_A =	run.x86-linux.a

all:
	($(MAKE) RUNTIME="$(RUNTIME)" VERSION="$(VERSION)" AS="$(AS)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME))
	($(MAKE) RUNTIME="$(RUNTIME_SO)" VERSION="$(VERSION)" AS="$(AS)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" LDFLAGS="-shared" $(RUNTIME_SO))
	($(MAKE) RUNTIME_A="$(RUNTIME_A)" VERSION="$(VERSION)" AS="$(AS)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" LDFLAGS="" $(RUNTIME_A))
