MAKE_SOCKETS_OBJS    = @MAKE_SOCKETS_OBJS@
MAKE_LE_INTERF_OBJS  = @MAKE_LE_INTERF_OBJS@
LIB_BIPS_PL          = @LIB_BIPS_PL@
GPLC                 = @GPLC@
RANLIB               = @RANLIB@
CC                    = @CC@
CFLAGS               = @CFLAGS@
CFLAGS_UNSIGNED_CHAR = @CFLAGS_UNSIGNED_CHAR@
EXEEXT               = @EXEEXT@

SOCKETS_OBJS      = sockets.o sockets_c.o
NO_SOCKETS_OBJS   = no_sockets.o


LE_INTERF_OBJS    = le_interf.o le_interf_c.o
NO_LE_INTERF_OBJS = no_le_interf.o


LIBNAME = $(LIB_BIPS_PL)
OBJLIB  = error_supp.o \
          c_supp.o \
          foreign_supp.o \
          pred_supp.o \
          term_supp.o \
          stream_supp.o \
          scan_supp.o \
          parse_supp.o \
          write_supp.o \
          dynam_supp.o \
          callinf_supp.o \
          bc_supp.o \
          foreign.o \
          pl_error.o \
          utils.o \
          unify.o \
          assert.o assert_c.o \
          read.o read_c.o \
          write.o write_c.o print.o \
          const_io.o const_io_c.o \
          oper.o oper_c.o \
          pred.o pred_c.o \
          atom.o atom_c.o \
          control.o control_c.o \
          call.o \
          call_args.o call_args_c.o \
          catch.o throw.o throw_c.o \
          flag.o flag_c.o \
          arith_inl.o arith_inl_c.o \
          type_inl.o type_inl_c.o \
          term_inl.o term_inl_c.o \
	  g_var_inl.o g_var_inl_c.o \
          all_solut.o all_solut_c.o \
          sort.o sort_c.o \
          list.o \
          stat.o stat_c.o \
          stream.o stream_c.o \
          file.o file_c.o \
          char_io.o char_io_c.o \
          dec10io.o \
          format.o format_c.o \
          os_interf.o os_interf_c.o \
          expand.o expand_c.o \
          consult.o consult_c.o \
          pretty.o pretty_c.o \
          random.o random_c.o \
          top_level.o top_level_c.o \
          debugger.o debugger_c.o \
          all_pl_bips.o \
          $(MAKE_SOCKETS_OBJS) \
	  $(MAKE_LE_INTERF_OBJS)


.SUFFIXES:
.SUFFIXES: .o .wam .pl $(SUFFIXES)


.pl.wam:
	$(GPLC) -W $(GPLCFLAGS) --no-redef-error $*.pl
.wam.o:
	$(GPLC) -c $*.wam

.c.o:
	$(GPLC) -c -C '$(CFLAGS) $(CFLAGS_UNSIGNED_CHAR)' $*.c 

$(LIBNAME): $(OBJLIB) no_sockets.wam no_le_interf.wam
	rm -f $(LIBNAME) 
	ar rc $(LIBNAME) $(OBJLIB)
	$(RANLIB) $(LIBNAME)



clean:
	rm -f *.o $(LIBNAME)


distclean: clean


# for test

t.wam: t.pl

t$(EXEEXT): t.o t_c.o ../EnginePl/libengine_pl.a $(LIBNAME) \
            ../Linedit/liblinedit.a 
	$(GPLC) -o t$(EXEEXT) t.o t_c.o --no-fd-lib


# depending on ../EnginePl/config.h

error_supp.o: ../EnginePl/config.h
stream_supp.o: ../EnginePl/config.h
flag_c.o: ../EnginePl/config.h


# depending on dynam_supp.h

dynam_supp.o: dynam_supp.h
bc_supp.o:    dynam_supp.h
assert_c.o:   dynam_supp.h

foreign.wam:     foreign.pl

all_pl_bips.wam: all_pl_bips.pl
all_solut.wam:   all_solut.pl
arith_inl.wam:   arith_inl.pl
assert.wam:      assert.pl
atom.wam:        atom.pl
call.wam:        call.pl
call_args.wam:   call_args.pl
catch.wam:       catch.pl
char_io.wam:     char_io.pl
const_io.wam:	 const_io.pl
consult.wam:     consult.pl
control.wam:     control.pl
expand.wam:      expand.pl
debugger.wam:    debugger.pl
	$(GPLC) -W $(GPLCFLAGS) --no-redef-error --fast-math debugger.pl
dec10io.wam:     dec10io.pl
file.wam:        file.pl
flag.wam:        flag.pl
format.wam:      format.pl
g_var_inl.wam:   g_var_inl.pl
le_interf.wam:   le_interf.pl
list.wam:        list.pl
stat.wam:        stat.pl
no_le_interf.wam:no_le_interf.pl
no_sockets.wam:	 no_sockets.pl
oper.wam:        oper.pl
os_interf.wam:   os_interf.pl
pl_error.wam:    pl_error.pl
pred.wam:        pred.pl
pretty.wam:      pretty.pl
random.wam:	 random.pl
print.wam:       print.pl
read.wam:        read.pl
reg_alloc.wam:   reg_alloc.pl
sockets.wam:	 sockets.pl
sort.wam:        sort.pl
stream.wam:      stream.pl
term_inl.wam:    term_inl.pl
throw.wam:       throw.pl
top_level.wam:   top_level.pl
type_inl.wam:    type_inl.pl
unify.wam:       unify.pl
utils.wam:       utils.pl
write.wam:       write.pl

