Makefile => Makefile.bsd

copy the right Makefile to "Makefile"

TODO : rename genconfig.sh to configure
This commit is contained in:
Thomas Bernard 2020-04-21 00:42:13 +02:00
parent 2a8368a2de
commit 69137442fb
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
3 changed files with 16 additions and 9 deletions

View File

@ -28,3 +28,4 @@ testminissdp
dox/ dox/
bsdmake.inc bsdmake.inc
upnpstun upnpstun
Makefile

View File

@ -75,8 +75,8 @@ LOG_MINIUPNPD="LOG_DAEMON"
# detecting the OS name and version # detecting the OS name and version
OS_NAME=`uname -s` OS_NAME=`uname -s`
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
# set BSDMAKE to 1 to use BSD make, to 0 to use GNU make # Makefile to use
BSDMAKE=0 MAKEFILE=
# pfSense special case # pfSense special case
if [ -f /etc/platform ]; then if [ -f /etc/platform ]; then
@ -158,7 +158,7 @@ echo "" >> ${CONFIGFILE}
# OS Specific stuff # OS Specific stuff
case $OS_NAME in case $OS_NAME in
OpenBSD) OpenBSD)
BSDMAKE=1 MAKEFILE=Makefile.bsd
MAJORVER=`echo $OS_VERSION | cut -d. -f1` MAJORVER=`echo $OS_VERSION | cut -d. -f1`
MINORVER=`echo $OS_VERSION | cut -d. -f2` MINORVER=`echo $OS_VERSION | cut -d. -f2`
#echo "OpenBSD majorversion=$MAJORVER minorversion=$MINORVER" #echo "OpenBSD majorversion=$MAJORVER minorversion=$MINORVER"
@ -194,7 +194,7 @@ case $OS_NAME in
fi fi
;; ;;
FreeBSD | GNU/kFreeBSD) FreeBSD | GNU/kFreeBSD)
BSDMAKE=1 MAKEFILE=Makefile.bsd
VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'` VER=`grep '#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'`
if [ $VER -ge 700049 ]; then if [ $VER -ge 700049 ]; then
echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE} echo "#define PFRULE_INOUT_COUNTS" >> ${CONFIGFILE}
@ -230,7 +230,7 @@ case $OS_NAME in
V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only` V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only`
;; ;;
pfSense) pfSense)
BSDMAKE=1 MAKEFILE=Makefile.bsd
# we need to detect if PFRULE_INOUT_COUNTS macro is needed # we need to detect if PFRULE_INOUT_COUNTS macro is needed
FW=pf FW=pf
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE} echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
@ -238,7 +238,7 @@ case $OS_NAME in
V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only` V6SOCKETS_ARE_V6ONLY=`sysctl -n net.inet6.ip6.v6only`
;; ;;
NetBSD) NetBSD)
BSDMAKE=1 MAKEFILE=Makefile.bsd
if [ -z $FW ] && [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then if [ -z $FW ] && [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
# source file with handy subroutines like checkyesno # source file with handy subroutines like checkyesno
. /etc/rc.subr . /etc/rc.subr
@ -258,7 +258,7 @@ case $OS_NAME in
OS_URL=http://www.netbsd.org/ OS_URL=http://www.netbsd.org/
;; ;;
DragonFly) DragonFly)
BSDMAKE=1 MAKEFILE=Makefile.bsd
if [ -z $FW ] && [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then if [ -z $FW ] && [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
# source file with handy subroutines like checkyesno # source file with handy subroutines like checkyesno
. /etc/rc.subr . /etc/rc.subr
@ -284,7 +284,7 @@ case $OS_NAME in
OS_URL=http://www.dragonflybsd.org/ OS_URL=http://www.dragonflybsd.org/
;; ;;
SunOS) SunOS)
BSDMAKE=1 MAKEFILE=Makefile.bsd
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE} echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
FW=ipf FW=ipf
echo "#define LOG_PERROR 0" >> ${CONFIGFILE} echo "#define LOG_PERROR 0" >> ${CONFIGFILE}
@ -390,6 +390,7 @@ case $OS_NAME in
FW=iptables FW=iptables
;; ;;
Darwin) Darwin)
MAKEFILE=Makefile.macosx
MAJORVER=`echo $OS_VERSION | cut -d. -f1` MAJORVER=`echo $OS_VERSION | cut -d. -f1`
echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE} echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
# OS X switched to pf since 10.7 Lion (Darwin 11.0) # OS X switched to pf since 10.7 Lion (Darwin 11.0)
@ -419,10 +420,12 @@ case $FW in
echo "#define USE_IPFW 1" >> ${CONFIGFILE} echo "#define USE_IPFW 1" >> ${CONFIGFILE}
;; ;;
iptables) iptables)
MAKEFILE=Makefile.linux
echo "#define USE_NETFILTER 1" >> ${CONFIGFILE} echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
echo "#define USE_IPTABLES 1" >> ${CONFIGFILE} echo "#define USE_IPTABLES 1" >> ${CONFIGFILE}
;; ;;
nftables) nftables)
MAKEFILE=Makefile.linux_nft
echo "#define USE_NETFILTER 1" >> ${CONFIGFILE} echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
echo "#define USE_NFTABLES 1" >> ${CONFIGFILE} echo "#define USE_NFTABLES 1" >> ${CONFIGFILE}
;; ;;
@ -433,9 +436,12 @@ case $FW in
;; ;;
esac esac
if [ $BSDMAKE -ne 0 ] || [ "$OS_NAME" = "Darwin" ] || [ "$OS_NAME" = "SunOS" ] ; then if [ "$MAKEFILE" = "Makefile.bsd" ] || [ "$OS_NAME" = "Darwin" ] || [ "$OS_NAME" = "SunOS" ] ; then
echo "FWNAME = $FW" > bsdmake.inc echo "FWNAME = $FW" > bsdmake.inc
fi fi
if [ "$MAKEFILE" ] ; then
cp -v $MAKEFILE Makefile
fi
# UUID API # UUID API
case $OS_NAME in case $OS_NAME in