#Makefile for DansGuardian
#
#A configure script is not yet used so you will have to manually edit this
#file.  Uncomment the appropriate section for your distribution.
#Please email me (daniel@jadeb.com) if you have modified this file for any
#particular distribution or if I have got anything wrong.
#Don't forget the trailing /
 
 
# RedHat 6.2 + 7.0
CONFFILELOCATION = /etc/dansguardian/
BINARYLOCATION = /usr/sbin/
SYSVLOCATION = /etc/rc.d/init.d/
# for RedHat 7.1 this needs to be /var/www/cgi-bin/
# # # das folgende directory muss nicht verwendet werden. dansguardian kopiert dort 
# # # das cgi-script hin, das die DENYs berarbeitet. mwe
CGIBINLOCATION = /var/apache/cgi-bin/
LOGLOCATION = /var/log/dansguardian/
PROXYUSER = squid
#CHKCONFIG = /sbin/chkconfig --add dansguardian
#CHKCONFIGDEL = /sbin/chkconfig --del dansguardian
#If your distro does not come with chkconfig, comment out the above 2 lines
 
 
# Some other standard (which means you'll need to edit the SysV file
# and the logrotation file)
#CONFFILELOCATION = /usr/local/etc/dansguardian/
#BINARYLOCATION = /usr/local/sbin/
#SYSVLOCATION = /etc/init.d/
#CGIBINLOCATION = /var/www/cgi-bin/
#LOGLOCATION = /var/log/dansguardian/
#PROXYUSER = proxy
#CHKCONFIG =
#CHKCONFIGDEL =
#
# If you edit the above, be sure to do a make clean before make
 
 
 
 
 
 
# Unless you know what you are doing, don't edit below this line
 
CPP = c++
OBJ = DataBuffer.o HTTPHeader.o NaughtyFilter.o OptionContainer.o SSLTunnel.o \
      String.o
LIBS =
PROG = dansguardian
INSTALLFILES = dansguardian dansguardian.conf dansguardian.sysv \
               bannedphraselist exceptionsitelist dansguardian.pl \
               bannedextensionlist bannedmimetypelist exceptioniplist
 
CFLAGS = $(OPTIMISE) $(WARNING)
PASSVARS = -DPROXYUSER=\"${PROXYUSER}\"
PASSVARS += -DLOGLOCATION=\"${LOGLOCATION}access.log\"
PASSVARS += -DCONFFILELOCATION=\"${CONFFILELOCATION}dansguardian.conf\"
 
DGCFLAGS = $(PASSVARS) -pthread -lnb++ -Wl,--rpath -Wl,/usr/local/lib
WARNING = -Wall
#WARNING = -Wall -pedantic
OPTIMISE = -O2
.cpp.o:
        $(CPP) $(CFLAGS) -c $<
 
all:    $(OBJ)
        $(CPP) -o dansguardian $(DGCFLAGS) $(OBJ) $(LIBS) dansguardian.cpp
 
install:
        cp -f ./dansguardian $(BINARYLOCATION)dansguardian
        @test -d $(CONFFILELOCATION) || mkdir $(CONFFILELOCATION)
        cp -f ./dansguardian.conf $(CONFFILELOCATION)dansguardian.conf
        cp -f ./bannedphraselist $(CONFFILELOCATION)bannedphraselist
        cp -f ./bannedextensionlist $(CONFFILELOCATION)bannedextensionlist
        cp -f ./bannedmimetypelist $(CONFFILELOCATION)bannedmimetypelist
        cp -f ./exceptionsitelist $(CONFFILELOCATION)exceptionsitelist
        cp -f ./exceptioniplist $(CONFFILELOCATION)exceptioniplist
        cp -f ./logrotation $(CONFFILELOCATION)logrotation
        cp -f ./dansguardian.sysv $(SYSVLOCATION)dansguardian
        cp -f ./dansguardian.pl $(CGIBINLOCATION)dansguardian.pl
        chmod o+x $(CGIBINLOCATION)dansguardian.pl
        @test -d $(LOGLOCATION) || mkdir $(LOGLOCATION)
        chown -R $(PROXYUSER).nogroup $(LOGLOCATION)
        chmod -R u+wr $(LOGLOCATION)
        $(CHKCONFIG)
 
uninstall:
        $(CHKCONFIGDEL)
        rm -f $(BINARYLOCATION)dansguardian
        rm -f $(SYSVLOCATION)dansguardian
        rm -f $(CGIBINLOCATION)dansguardian.pl
        rm -fr /etc/dansguardian
        rm -fr $(LOGLOCATION)
 
clean:
        rm -f $(OBJ) $(PROG)
