
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
pixdir = ${libdir}/pix
includedir = @includedir@
mandir = @mandir@/man1
srcdir = @srcdir@
VPATH = @srcdir@

top_builddir = ..

PURELINK =
PURIFY =

# Libraries needed to link with Tcl & (optionally) Tk
TCLTK_LIBS = @TCLTKLIBS@
# Include directives needed to compile with Tcl & Tk, and
# -DTCL if Tcl is available, and
# -DTK if Tk is available.
TCLTK_FLAGS = @TCLTKFLAGS@

# Libraries needed to link with GNU readline
RLLIBS = @RLLIBS@
# Include directives needed to compile with GNU readline, and
# -DREADLINE_2_0 if GNU readline 2.0 is available, or 
# -DREADLINE_2_1 if GNU readline 2.1 (or later) is available.
RLDEFS = @RLDEFS@

CC = @CC@
CXX = @CXX@
CDEFS = -DLIBDIR=\"$(libdir)\" 
# -DDEBUG
CFLAGS = -I$(top_builddir)/include -I$(srcdir)/include @CFLAGS@ @CWFLAG@ $(RLDEFS) $(CDEFS) $(TCLTK_FLAGS)
CXXFLAGS = -I$(top_builddir)/include -I$(srcdir)/include @CXXFLAGS@ @CWFLAG@ $(RLDEFS) $(CDEFS) $(TCLTK_FLAGS)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
# -lefence
CXXLIBS = @CXXLIBS@

libcclib = @libcclib@
cclib = @cclib@

INSTALL = $(LIBTOOL) @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
YACC = @YACC@
RANLIB = @RANLIB@
RM = rm -f
STRIP = strip
SHELL = /bin/sh
CPLIB = @CPLIB@
EXT = @EXT@
SUBMAKE_COMM = @SUBMAKE_COMM@
SUBMAKE_COMM_CC = @SUBMAKE_COMM_CC@

LIBTOOL = @LIBTOOL@
LIBTOOLLINK = $(LIBTOOL) --mode=link

CCLINK = $(LIBTOOLLINK)  $(PURELINK) $(PURIFY) $(CC) $(LDFLAGS) $(CFLAGS)
CXXLINK = $(LIBTOOLLINK) $(PURELINK) $(PURIFY) $(CXX) $(LDFLAGS) $(CXXFLAGS)

.SUFFIXES: .out .o .cc .c .e .r .f .y .l .s .p

.c.o:
	$(CC) $(CFLAGS) -c $<

.cc.o:
	$(CXX) $(CXXFLAGS) -c $<


WITHTCL = $(TCLEXECS)
WITHCXX = $(CXXEXECS)
WITHPERL5 = $(PERLEXECS)

CEXECS = packers$(EXT)

CXXEXECS =

TCLEXECS =

PERLEXECS = 

EXECS = $(CEXECS) $(@WITHTCL@) $(@WITHCXX@) $(@WITHPERL5@)

WITHCXXLIB = ../libcc/libpicc.la
PILIB = ../libsock/libpisock.la
PICCLIB = $(@WITHCXX@LIB)

all: $(PILIB) $(PICCLIB) $(EXECS) 

$(PILIB): FORCE
	$(SUBMAKE_COMM)

$(WITHCXXLIB): FORCE
	$(SUBMAKE_COMM_CC)

tests test: $(EXECS)
	packers$(EXT)

packers$(EXT): $(PILIB) packers.o
	$(CCLINK) packers.o $(PILIB) -o $@ $(LIBS)

distclean: clean
	$(RM) Makefile

clean:
	$(RM) *.o *.a *.lo *.la core a.out test_s test_c install-prc$(EXT) pilot-debug$(EXT)
	$(RM) -rf .libs _libs
	$(RM) $(CEXECS) $(TCLEXECS) $(CXXEXECS) $(PERLEXECS)
	
FORCE:
