# Synlog Makfile
# Just edit where applicable
# shadows@whitefang.com (Thamer Al-Herbish)
#
# Set the compiler name
CC = gcc
#
# If you do not have a worldwide libpcap library installed
# Along with pcap.h in the usual include dir, just tweak the following
#
#PCAP_PATH=-L/usr/local/lib -I/usr/local/include 
#
# If your compiling this on Linux, you'll need this to get around it's
# gruesome data structures.
#
#LINUX = -DSYS_LINUX
#
#
# You need one of the following, depending on your data link type.
# I'll add as many as I get access to, or get patches for.
# For ethernet on BSDish systems
#
LINK_TYPE = -DETHERTYPE_LINK
#
# Or for PPP on FreeBSD 2.1.x (only tested on that so far)
#LINK_TYPE = -DPPPTYPE_LINK
#
#
# Flags on the c compiler for compilation
CFLAGS = -Wall -I. -O2 -c
#
# Additional Libraries (apart from libpcap)
#LIBS = -lsocket -lnsl
# 
# Additional Library Paths?
#
#LIB_PATH = -L/usr/local/lib
#
# What syslog facility do you want to use?
#
FACILITY = -DLOG_FACILITY=LOG_LOCAL7
#
#############################################################################
# Thats all the configuring you'll need to do.
#############################################################################


OBJECTS = sniff.o store.o log.o main.o
LINK = $(CC) -o
COMPILE = $(CC) $(PCAP_PATH) $(FACILITY) $(LINK_TYPE) $(LINUX) $(CFLAGS) 
TARGETS = synlog
LIBS += -lpcap 

all: $(TARGETS) man

man: synlog.1

synlog.1: synlog.0
	nroff -man synlog.0 > synlog.1

synlog: $(OBJECTS)
	$(LINK) synlog $(OBJECTS) $(LIB_PATH) $(PCAP_PATH) $(LIBS)
.c.o:
	$(COMPILE) $<

clean:
	rm -rf *~ \#*\# $(OBJECTS) $(TARGETS) synlog.1
# DO NOT DELETE

log.o: ./config.h
main.o: ./config.h ./common.h
sniff.o: ./config.h ./common.h ./log.h
store.o: ./common.h ./config.h ./log.h
