#   Makefile for SWI-Prolog <-> PCE interface
#
#   Copyright in the whole and every part of this software is owned  by  the
#   University  of  Amsterdam.   No reproduction of the whole or any part of
#   this software is to be made without the authority of the  University  of
#   Amsterdam.
#
#   Copyright (c) 1991, University of Amsterdam
# 

#   NOTE: this file is normally included from Makefile-MACHINE.  Try to
#	  make system dependant changes there.

PLBASE=../../../pl
RUNTIME=$(PLBASE)/runtime/$(MACHINE)/pl.o
XPCEOBJ=../../$(MACHINE)/XPCE.a

OBJ=	$(RUNTIME) interface.o link.o $(XPCEOBJ)
BINOBJ= ../../pl/runtime/$(MACHINE)/pl.o interface.o link.o $(XPCEOBJ)
LIBS=	-lXt -lX11 -lm -ltermcap -lreadline $(EXTRALIBS)
TARGET=	xpce

PL_INCLUDEDIR=$(PLBASE)/include

CFLAGS= 	$(OPTIMIZE) -DMD=\"../../src/md-$(MACHID).h\" -I$(PL_INCLUDEDIR)
ITF=		../../prolog/c/interface.c ../../prolog/c/interface.h

all:		$(TARGET) pl-crt0.o 

interface.o:	../../.parms $(ITF) interface.c

xpce.base:	$(OBJ)
		$(CC) $(LDFLAGS) -L$(PCEXBASE)/lib $(OPTIMIZE) -o $@ $(OBJ) $(LIBS)

printcmd:
		@echo $(CC) $(LDFLAGS) -o xpce.base $(BINOBJ) $(LIBS)

$(TARGET):	xpce.base domangle
		./dump ./xpce.base $@

mangle:		mangle.c
		$(CC) -O -o mangle mangle.c

domangle:	mangle mlist xpce.base
		./mangle mlist xpce.base
		touch domangle

clean:		
		rm -f *.o core a.out *~
