############################################################################
# Tino Reichardt <milky dash squidwall at mcmilk dot de>
#
# 1. type make for building
# 2. type make install for installing
############################################################################

# your squiduser or squidgroup needs read/write access here:
LOGDIR	= ${DESTDIR}/var/log/squid

# redirectors should be placed @ /usr/sbin
SBINDIR	= ${DESTDIR}/usr/sbin

DIET	= $(shell test -x /opt/diet/bin/diet && echo /opt/diet/bin/diet)
CC	= $(DIET) gcc
CFLAGS	= -Os -Wall -pipe -I../libowfat
LDFLAGS	= ../libowfat/libowfat.a

# extraflags
CFLAGS += -W
#CFLAGS += -Wpointer-arith
#CFLAGS += -Wswitch
#CFLAGS += -Wmissing-prototypes
#CFLAGS += -Wchar-subscripts
#CFLAGS += -Wmissing-declarations -Wredundant-decls -Wunused

# strip
STRIP	= strip -R .note -R .comment

OBJS	= case_strstr.o debug.o md5.o sha1.o \
	  read_acls.o read_filters.o hextab.o \
	  env.o log.o redir_site.o timestamp.o \
	  check_user.o check_host.o check_redirect.o \
	  check_blist.o check_wlist.o check_banner.o \
	  check_cont.o check_clamav.o scan_url.o \
	  log_info.o log_panic.o
PRGS	= squidwall

all:	it

it:	$(PRGS)
setup:  it install
again:	clean setup

squidwall: $(OBJS) squidwall.o
	$(CC) -o $@ squidwall.o $(OBJS) $(LDFLAGS)
	$(STRIP) $@

dep:	clean
	$(CC) $(CFLAGS) -MM *.c > .depend

clean:
	rm -f $(OBJS) fget.o squidwall.o $(PRGS)

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

install:
	rm -f $(SBINDIR)/squidwall
	cp -f squidwall $(SBINDIR)/squidwall

include .depend
