OSDN Git Service

Ver.1.5.34 Fixed CLang warning and others
[opengate/opengate.git] / opengate / opengatesrv / Makefile
index d987a2c..d9eb978 100644 (file)
@@ -2,20 +2,32 @@
 ##  must be matched to descriptions in html files ########
 ##  some other parameters exist in opengatesrv.h  ########
 ##########################################################
-WWWTOP = /usr/local/www
+WWWTOP = /usr/local/www/apache24
 DOCDIR = /data
 CGIDIR = /cgi-bin
 OPENGATEDIR = /opengate
+CONFIGPATH = /etc/opengate
+LOCKFILE = /tmp/opengate.lock
 
 DOCUMENTROOT = ${WWWTOP}${DOCDIR}
 INSTALLDOCPATH = ${WWWTOP}${DOCDIR}${OPENGATEDIR}
 INSTALLCGIPATH = ${WWWTOP}${CGIDIR}${OPENGATEDIR}
+MAKEDIR != pwd
 
-CONFIGPATH = /etc/opengate
+CFLAGS= -g -O3 -Wall -I/usr/local/include
+
+.if exists(/usr/local/include/ldap.h)
+LIBLDAP = -lldap -llber
+.endif
+
+.if exists(/usr/local/include/sqlite3.h)
+LIBSQLITE = -lsqlite3 -lpthread
+.endif
 
-CFLAGS= -O4 -Wall
-LIBS = -lssl -lcrypto -lradius -lpam -lezxml -L../ezxml
-OBJS = utilities.o comm-auth.o comm-cgi.o watch-client.o comm-ipfw.o comm-ip6fw.c comm-arp.o comm-ndp.o error.o tcp_connect.o sock_ntop_host.o wrapper.o signal.o auth-pam.o auth-rad.o auth-pop3s.o comm-userdb.o get-param.o auth-ftps.o htmltemplate.o addr-convert.o get-mac.o ctrl-firewall.o ctrl-alarms.o
+LIBS = -lssl -lcrypto -lradius -lpam -lezxml ${LIBLDAP} ${LIBSQLITE} -L../ezxml -L/usr/local/lib
+
+
+OBJS = utilities.o comm-auth.o comm-cgi.o watch-client.o comm-ipfw.o comm-ip6fw.c comm-arp.o comm-ndp.o error.o tcp_connect.o sock_ntop_host.o wrapper.o signal.o auth-pam.o auth-rad.o auth-pop3s.o comm-userdb.o get-param.o auth-ftps.o auth-ldap.o htmltemplate.o addr-convert.o get-mac.o ctrl-firewall.o ctrl-alarms.o udp-client.o
 MAINPROGO = main.o
 HDRS = opengatesrv.h
 MAINPROG = opengatesrv
@@ -25,7 +37,7 @@ FWDPROGO = opengatefwd.o
 FWDPROG = opengatefwd
 LIBOPT = ezxml
 
-TESTPROGS = test-get-param test-comm-auth test-comm-ipfw test-watch-client test-cgi
+TESTPROGS = test-get-param test-comm-auth test-comm-ipfw test-watch-client test-cgi test-comm-userdb
 CLEANFILES = *.o *~ *.core 
 
 all:   ${MAINPROG} ${AUTHPROG} ${FWDPROG} ${TESTPROGS} ${LIBOPT}
@@ -54,14 +66,23 @@ test-watch-client:  ${OBJS} test-watch-client.o ${LIBOPT}
 test-cgi:      ${OBJS} test-cgi.o ${LIBOPT}
                ${CC} ${CFLAGS} -o $@ ${OBJS} test-cgi.o ${LIBS}
 
+test-comm-userdb:      ${OBJS} test-comm-userdb.o ${LIBOPT}
+               ${CC} ${CFLAGS} -o $@ ${OBJS} test-comm-userdb.o ${LIBS}
+
 ezxml: 
                ${MAKE} -C ../ezxml
 clean:
                rm -f ${MAINPROG} ${AUTHPROG} ${FWDPROG} ${TESTPROGS} ${CLEANFILES}
                ${MAKE} clean -C ../ezxml
+               rm -f ../*/*~  ../*~ ../*/*/*~
 
-install:       install-cgi install-html install-conf
+install:       del-lockfile install-cgi install-html install-conf
 
+del-lockfile:
+.if exists(${LOCKFILE})
+               # remove lockfile
+               rm ${LOCKFILE}
+.endif
 
 install-cgi:   ${MAINPROG} ${AUTHPROG} ${FWDPROG}
                ## Copy main CGI program and Set S bit ##
@@ -77,11 +98,15 @@ install-cgi:        ${MAINPROG} ${AUTHPROG} ${FWDPROG}
                #
 
 install-html:
-               ## Copy HTML documents and java ##
+               ## Copy HTML documents and etc ##
 .if !exists(${INSTALLDOCPATH})
                mkdir ${INSTALLDOCPATH}
 .endif
                cp -R ../javahtml/* ${INSTALLDOCPATH}
+               # Make dummy page for network connectivity check of iOS
+               mkdir -p ${DOCUMENTROOT}/library/test/
+               cp ../javahtml/success.html ${DOCUMENTROOT}/library/test/
+
                #
                # Replace index.html.var
 .if exists(${DOCUMENTROOT}/index.html.var) && !exists(${DOCUMENTROOT}/index.html.var.original)
@@ -89,6 +114,11 @@ install-html:
 .endif
                mv ${INSTALLDOCPATH}/index.html.var ${DOCUMENTROOT}/index.html.var
                #
+               # Remove favicon.ico
+.if exists(${DOCUMENTROOT}/favicon.ico)
+               mv ${DOCUMENTROOT}/favicon.ico ${DOCUMENTROOT}/favicon.ico.original
+.endif
+               #
                # Remove index.html
 .if exists(${DOCUMENTROOT}/index.html) && !exists(${DOCUMENTROOT}/index.html.original)
                mv ${DOCUMENTROOT}/index.html ${DOCUMENTROOT}/index.html.original
@@ -101,9 +131,8 @@ install-conf:
 .endif
                cp  ../conf/opengatesrv.conf.sample ${CONFIGPATH}
                cp  ../conf/rc.firewall.sample ${CONFIGPATH}
-               cp  ../conf/rc.firewall6.sample ${CONFIGPATH}
                cp ../conf/ipfwctrl.pl.sample  ${CONFIGPATH}
-               sed 's|<DocumentRoot>.*</DocumentRoot>|<DocumentRoot>${DOCUMENTROOT}</DocumentRoot>|' ../conf/opengatesrv.conf.sample | sed 's|<CgiDir>.*</CgiDir>|<CgiDir>${CGIDIR}</CgiDir>|' | sed 's|<OpengateDir>.*</OpengateDir>|<OpengateDir>${OPENGATEDIR}</OpengateDir>|' > ${CONFIGPATH}/opengatesrv.conf.sample
+               sed 's|<DocumentRoot>.*</DocumentRoot>|<DocumentRoot>${DOCUMENTROOT}</DocumentRoot>|' ../conf/opengatesrv.conf.sample | sed 's|<CgiDir>.*</CgiDir>|<CgiDir>${CGIDIR}</CgiDir>|' | sed 's|<OpengateDir>.*</OpengateDir>|<OpengateDir>${OPENGATEDIR}</OpengateDir>|' | sed 's|<LockFile>.*</LockFile>|<LockFile>${LOCKFILE}</LockFile>|'  > ${CONFIGPATH}/opengatesrv.conf.sample
                #
                #------------------------------------------------------#
                # COPY above x.sample to x and EDIT it, if you need.   #
@@ -112,6 +141,7 @@ install-conf:
 
 
 main.o:                ${HDRS}
+               ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
 
 utilities.o:   ${HDRS}
 
@@ -128,7 +158,9 @@ comm-arp.o: ${HDRS}
 comm-ndp.o:    ${HDRS}
 
 comm-userdb.o: ${HDRS}
-
+.if !exists(/usr/local/include/sqlite3.h)
+               ${CC} ${CFLAGS} -DSQLITE3_NOT_INSTALLED -c $<
+.endif
 ctrl-firewall.o:       ${HDRS}
 
 ctrl-alarms.o: ${HDRS}
@@ -139,18 +171,29 @@ auth-rad.o:       ${HDRS}
 
 auth-pop3s.o:  ${HDRS}
 
+auth-ftps.o:   ${HDRS}
+
+auth-ldap.o:   ${HDRS}
+.if !exists(/usr/local/include/ldap.h)
+               ${CC} ${CFLAGS} -DLDAP_NOT_INSTALLED -c $<
+.endif
+
 get-param.o:   ${HDRS}
 
 get-mac.o:     ${HDRS}
 
 opengateauth.o:        ${HDRS}
+               ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
 
 opengatefwd.o: ${HDRS}
+               ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
 
 htmltemplate.o:        ${HDRS}
 
 addr-convert.o:        ${HDRS}
 
+udp-client.o:  ${HDRS}
+
 test-get-param.o:      ${HDRS}
 
 test-comm-auth.o:      ${HDRS}
@@ -161,4 +204,9 @@ test-watch-client.o:        ${HDRS}
 
 test-cgi.o:    ${HDRS}
 
+test-comm-userdb.o:    ${HDRS}
+
+
+
+