#
# default base directory for YAP installation
# (EROOT for architecture-dependent files)
#
GCC=@GCC@
prefix = @prefix@
exec_prefix = @exec_prefix@
ROOTDIR = $(prefix)
EROOTDIR = @exec_prefix@
abs_top_builddir = @abs_top_builddir@
#
# where the binary should be
#
BINDIR = $(EROOTDIR)/bin
#
# where YAP should look for libraries
#
LIBDIR=@libdir@
YAPLIBDIR=@libdir@/Yap
#
#
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1
CC=@CC@
CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include  @CPPFLAGS@
#
#
# You shouldn't need to change what follows.
#
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
SHELL=/bin/sh
RANLIB=@RANLIB@
srcdir=@srcdir@
SO=@SO@
#4.1VPATH=@srcdir@:@srcdir@/OPTYap
CWD=$(PWD)
#

HEADERS=$(srcdir)/atoms.h $(srcdir)/pl-buffer.h $(srcdir)/pl-ctype.h  \
	$(srcdir)/pl-incl.h \
	$(srcdir)/pl-mswchar.h \
	$(srcdir)/pl-opts.h  \
	$(srcdir)/pl-os.h \
	$(srcdir)/pl-privitf.h \
	$(srcdir)/pl-stream.h \
	$(srcdir)/pl-table.h \
	$(srcdir)/pl-text.h $(srcdir)/pl-utf8.h \
	$(srcdir)/pl-yap.h @ENABLE_WINCONSOLE@ $(srcdir)/uxnt/dirent.h $(srcdir)/uxnt/utf8.h $(srcdir)/pl-utf8.c $(srcdir)/uxnt/uxnt.h
C_SOURCES=$(srcdir)/pl-buffer.c $(srcdir)/pl-ctype.c \
	$(srcdir)/pl-error.c  \
	$(srcdir)/pl-file.c $(srcdir)/pl-files.c  \
	$(srcdir)/pl-glob.c  \
	$(srcdir)/pl-os.c \
	$(srcdir)/pl-privitf.c \
	$(srcdir)/pl-stream.c $(srcdir)/pl-string.c \
	$(srcdir)/pl-table.c \
	$(srcdir)/pl-text.c \
	$(srcdir)/pl-util.c \
	$(srcdir)/pl-yap.c @ENABLE_WINCONSOLE@ $(srcdir)/popen.c $(srcdir)/uxnt/uxnt.c
OBJS=pl-buffer.o pl-ctype.o pl-error.o  \
	pl-file.o pl-files.o pl-glob.o pl-os.o pl-privitf.o \
	pl-stream.o pl-string.o pl-table.o \
	pl-text.o pl-util.o pl-utf8.o \
	pl-yap.o @ENABLE_WINCONSOLE@ uxnt.o
SOBJS=libplstream.@SO@

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

all: $(SOBJS) 

uxnt.o: $(srcdir)/uxnt/uxnt.c
	$(CC) -c $(CFLAGS) $(srcdir)/uxnt/uxnt.c -o uxnt.o

# default rule
%.o : $(srcdir)/%.c
	$(CC) -c $(CFLAGS) $< -o $@

@DO_SECOND_LD@%.@SO@: %.o
@DO_SECOND_LD@	@SHLIB_LD@ -o $@ $<  @EXTRA_LIBS_FOR_DLLS@

@DO_SECOND_LD@libplstream.@SO@: $(OBJS)
@DO_SECOND_LD@	@SHLIB_LD@ -o libplstream.@SO@ $(OBJS) @EXTRA_LIBS_FOR_DLLS@

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.