CC = gcc
CXX = g++
AR = ar
RANLIB = ranlib
HPATH = $(shell pwd)
INCLUDES = -I/usr/include/pcap -I$(HPATH)/../include -I$(HPATH) -I/usr/local/include -I$(HPATH)/.. -I./md5 -I. -I$(HPATH)/../pdb -I$(HPATH)/../lib
CPPFLAGS = -DDEBUG -Wall  -g  -Wall -DLINUX $(INCLUDE)

# this is where -pg is added (changes both compiler and linker flags)
PROFILE = 

#CXXFLAGS += -O6
#CXXFLAGS += -Wno-aggregate-return
CXXFLAGS += $(PROFILE) $(INCLUDES)
CFLAGS += $(INCLUDES) -g

LDFLAGS = -L. -L/usr/local/lib -L/lib -L/usr/lib -Lmd5 -L../lib -lron -L/usr/local/lib -lm $(PROFILE)

CLASSES = forw static_router latency_router broadcast_membership flood_protocol packet ping_protocol policy_classifier scheduler plumber ../pdb/pdb_client ../lib/socket ../lib/debug ../lib/interface
# static_membership

OBJS = $(CLASSES:%=%.o)

all: ronlib.a

ronlib.a: $(OBJS)
#	$(CXX) -c $(OBJS) $(LDFLAGS)
	${AR} cru $@ ${OBJS}
	${RANLIB} $@

clean:
	-$(RM) *.o *.a *~ core $(BINS) a.out ../pdb/pdb_client.o ../lib/socket.o ../lib/debug.o ../lib/interface.o

spotless: clean
	-$(RM) .depend tags

tags: $(wildcard *.c *.cpp *.h *.hpp *.C)
	ctags -x $(wildcard *.c *.cpp *.h *.hpp *.C) > tags

wc:
	@wc $(wildcard $(SRC_DIRS:%=%/*.?pp)) | sort -n

dep depend:
	-makedepend $(INCLUDES) -f- \
	$(wildcard $(CLASSES:%=%.C)) > .depend  2> /dev/null

#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif
# DO NOT DELETE
