srcdir 		= @srcdir@
VPATH 		= @srcdir@
prefix	        = @prefix@
exec_prefix	= @exec_prefix@

CC  	        = @CC@
MAKED	        = @MAKED@
CDEBUG_FLAGS    = @CDEBUG_FLAGS@
EXTRA_CFLAGS 	= 
CFLAGS	        = -I../../include -I$(srcdir)/../../lib -I$(srcdir)/../../include @CFLAGS@ $(CDEBUG_FLAGS) $(SOCKSFLAGS) ${OTHER_CFLAGS}  $(EXTRA_CFLAGS)
INSTALL	        = @INSTALL@
BINRM           = @BINRM@
LIBS            = -L../../lib -lsocks5 @LDFLAGS@ @EXPORT_LDFLAGS@ @LIBS@ 
BINDIR  	= $(exec_prefix)/bin
MANDIR  	= $(prefix)/man

.SUFFIXES: .c .o
.c.o:
	$(CC) ${CFLAGS} -c $(srcdir)/$*.c

SRCS = $(scrdir)/rping.c $(srcdir)/rtrace.c $(srdir)/share.c
OBJS = rping.o rtrace.o share.o

all: Makefile rping rtraceroute

Makefile: $(srcdir)/Makefile.in ../../config.status
	(cd ../..; CONFIG_FILES=clients/pt/Makefile CONFIG_HEADERS= ./config.status)

rping: rping.o share.o ../../lib/libsocks5.a
	$(CC) $(CFLAGS) -o $@ rping.o share.o $(LIBS)

rtraceroute: rtrace.o share.o ../../lib/libsocks5.a
	$(CC) $(CFLAGS) -o $@ rtrace.o share.o $(LIBS)

install:  rping rtraceroute
	$(INSTALL) -m 111 rping $(BINDIR)
	$(INSTALL) -m 111 rtraceroute $(BINDIR)

clean: 
	-$(BINRM) $(OBJS) rping rtraceroute core

distclean: clean
	-$(BINRM) Makefile *~ \#*\# *.bak

depend:
	$(MAKED) -- $(CFLAGS) -- $(SRCS)
	mv Makefile Makefile.tmp; cat Makefile.tmp | sed s,\^$(srcdir)/,,g > Makefile; rm Makefile.tmp

rping.o: rping.c
rtrace.o: rtrace.c
share.o: share.c
