#
# default base directory for YAP installation
# (EROOT for architecture-dependent files)
#
GCC=yes
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
#
#
DEFS=-DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1
CC=gcc
CXX=c++
CXXFLAGS= -fPIC -O3 -fomit-frame-pointer -Wall -O2 -mieee -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../../.. -I$(srcdir)/../../../os -I$(srcdir)/../../../include  -I/usr/include -I/usr/pkg/include -I/usr/pkg/include
LDFLAGS=-Wl,--export-dynamic -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -L$(abs_top_builddir) -Wl,-R,$(LIBDIR)
#
#
# 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
#4.1VPATH=.:./OPTYap
CWD=$(PWD)
#

HEADERS= \
	$(srcdir)/Alg.h \
	$(srcdir)/BasicHeap.h \
	$(srcdir)/BoxedVec.h  \
	$(srcdir)/Heap.h \
	$(srcdir)/Map.h \
	$(srcdir)/Queue.h  \
	$(srcdir)/Solver.h \
	$(srcdir)/SolverTypes.h \
	$(srcdir)/Sort.h \
	$(srcdir)/Vec.h
C_SOURCES=$(srcdir)/pl-minisat.C $(srcdir)/Solver.C

OBJS = \
	Solver.o \
	pl-minisat.o

SOBJS=pl-minisat.so

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

all: $(SOBJS) 

# default rule
Solver.o : $(srcdir)/Solver.C
	$(CXX) -c $(CXXFLAGS) $(srcdir)/Solver.C -o Solver.o

pl-minisat.o : $(srcdir)/pl-minisat.C
	$(CXX) -c $(CXXFLAGS) $(srcdir)/pl-minisat.C -o pl-minisat.o

pl-minisat.so: $(OBJS)
	c++ -shared -Wl,-export-dynamic $(LDFLAGS) -o pl-minisat.so $(OBJS)  -L$(abs_top_builddir) -Wl,-R,$(YAPLIBDIR) -lpthread

install: all
	$(INSTALL_PROGRAM) $(SOBJS) $(DESTDIR)$(YAPLIBDIR)

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


depend: $(HEADERS) $(C_SOURCES)
	-@if test "$(GCC)" = yes; then\
	  $(CC) -MM -MG $(CFLAGS) -I$(srcdir) -I$(srcdir)/../../../include -I$(srcdir)/../../../H $(C_SOURCES) >> Makefile;\
	else\
          makedepend -f - -- $(CFLAGS) -I$(srcdir)/../../../H -I$(srcdir)/../../../include -- $(C_SOURCES) |\
          sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
	fi

# DO NOT DELETE THIS LINE -- make depend depends on it.
