#
# change the following lines to fit your needs
#
# debugging:
#CC = cc -DUSE_DEBUG
#OCFLAGS = -W -Wall -Werror -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wbad-function-cast -pedantic-errors -O2

SRCS = main.c print.c socket.c request.c http.c alloc.c filter.c db.c file.c dns.c signals.c access.c regex.c msg.c poll.c
OBJS = $(SRCS:.c=.o)

MANPAGES = ffproxy.8 ffproxy.conf.5 ffproxy.quick.7

PREFIX?=/usr/local
CC?=cc

DATADIR?=/var/ffproxy
SYSCONFDIR?=/etc
CFLAGS += ${OCFLAGS} -DCFGFILE="\"${SYSCONFDIR}/ffproxy.conf\"" -DDATADIR="\"${DATADIR}\""

all: proxy

lint:
	lint -aa -b -c -e -g -h -x -s ${SRCS}

install:
	install -c ffproxy ${PREFIX}/bin/ffproxy
	install -d ${PREFIX}/bin
	install -d ${PREFIX}/man
	install -d ${PREFIX}/man/man5
	install -d ${PREFIX}/man/man7
	install -d ${PREFIX}/man/man8
	install -c ffproxy.8 ${PREFIX}/man/man8/ffproxy.8
	install -c ffproxy.conf.5 ${PREFIX}/man/man5/ffproxy.conf.5
	install -c ffproxy.quick.7 ${PREFIX}/man/man7/ffproxy.quick.7

proxy: $(OBJS)
	@./sys-dep.sh "${CC}" "${CFLAGS}" "-o ffproxy" "$(OBJS)"
	strip ffproxy

clean:
	rm -f *.o ffproxy
