#
# default base directory for YAP installation
# (EROOT for architecture-dependent files)
#
#
# default base directory for YAP installation
# (EROOT for architecture-dependent files)
#
prefix = /usr/pkg
exec_prefix = ${prefix}
ROOTDIR = $(prefix)
EROOTDIR = ${prefix}
abs_top_builddir = /tmp/pkgbuild/lang/yap/work.alpha/yap-6.3.3
#
# where the binary should be
#
BINDIR = $(EROOTDIR)/bin
#
# where YAP should look for libraries
#
LIBDIR=${exec_prefix}/lib
YAPLIBDIR=${exec_prefix}/lib/Yap
#
#
CC=gcc
MPI_CC=gcc
CFLAGS= -fPIC -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -O2 -mieee -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include
#
#
# You shouldn't need to change what follows.
#
INSTALL=/usr/bin/install -c -o pbulk -g users
INSTALL_DATA=/usr/bin/install -c -o pbulk -g users -m 644
INSTALL_PROGRAM=/usr/bin/install -c -s -o pbulk -g users -m 755
SHELL=/bin/sh
RANLIB=ranlib
srcdir=.
SO=so
CWD=$(PWD)
MPILDF=`$(MPI_CC) -showme|sed "s/[^ ]*//"|sed "s/-pt/-lpt/"`
MPICF=`$(MPI_CC) -showme| cut -d " " -f 2`
#

OBJS=yap_mpi.o hash.o prologterms2c.o
SOBJS=
#yap_mpi.so

#in some systems we just create a single object, in others we need to
# create a libray

all: $(SOBJS)

yap_mpi.o: $(srcdir)/yap_mpi.c   $(srcdir)/yap_mpi.c  
	$(MPI_CC)  $(CFLAGS) $(MPICF)  -c $(srcdir)/yap_mpi.c -o yap_mpi.o 

prologterms2c.o: $(srcdir)/prologterms2c.c $(srcdir)/prologterms2c.h
	$(MPI_CC) -c $(CFLAGS) $(srcdir)/prologterms2c.c -o prologterms2c.o

hash.o: $(srcdir)/hash.c $(srcdir)/hash.h
	$(MPI_CC) -c $(CFLAGS) $(srcdir)/hash.c -o hash.o

yap_mpi.so: $(OBJS)
	gcc -shared -Wl,-export-dynamic  -o yap_mpi.so $(OBJS)  $(MPILDF)  -L$(abs_top_builddir) -Wl,-R,$(YAPLIBDIR)

install: all
	@if test "$(SOBJS)" = ""; then echo ""; else $(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(YAPLIBDIR); fi

clean:
	rm -f *.o *~ $(OBJS) $(SOBJS) *.BAK

no:
	@echo "YAP LAM/MPI module not compiled."

