core/Makefile
Franco Fichtner 803af49280 interfaces: defang netgraph attach/detach for #1188
We don't particularly need this code and the utility as netgraph
is always attached on load as long as we don't detach and the
attach per interface is a custom feature that requires a kernel
patch we don't want to keep around for 17.1.

Only thing we need to measure is the performance impact of not
detaching netgraph.  This only pertains to ethernet devices
anyway.

We do, however, keep interface_netgraph_needed() around for
reference as it's harmless by default.
2016-09-16 15:27:30 +02:00

319 lines
8.6 KiB
Makefile

# Copyright (c) 2014-2016 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
PKG!= which pkg || echo true
GIT!= which git || echo true
PAGER?= less
all:
@cat ${.CURDIR}/README.md | ${PAGER}
force:
WANTS= git pear-PHP_CodeSniffer phpunit
.for WANT in ${WANTS}
want-${WANT}: force
@${PKG} info ${WANT} > /dev/null
.endfor
.if ${GIT} != true
CORE_COMMIT!= ${.CURDIR}/scripts/version.sh
CORE_VERSION= ${CORE_COMMIT:C/-.*$//1}
CORE_HASH= ${CORE_COMMIT:C/^.*-//1}
.endif
CORE_ABI?= 16.7
_FLAVOUR!= /usr/local/bin/openssl version
FLAVOUR?= ${_FLAVOUR:[1]}
.if "${FLAVOUR}" == OpenSSL || "${FLAVOUR}" == ""
CORE_REPOSITORY?= ${CORE_ABI}/latest
.elif "${FLAVOUR}" == LibreSSL
CORE_REPOSITORY?= ${CORE_ABI}/libressl
.else
CORE_REPOSITORY?= ${FLAVOUR}
.endif
CORE_PACKAGESITE?= http://pkg.opnsense.org
CORE_NAME?= opnsense-devel
CORE_FAMILY?= development
CORE_ORIGIN?= opnsense/${CORE_NAME}
CORE_COMMENT?= OPNsense ${CORE_FAMILY} package
CORE_MAINTAINER?= franco@opnsense.org
CORE_WWW?= https://opnsense.org/
CORE_MESSAGE?= Thanks for all the fish...
CORE_DEPENDS?= apinger \
beep \
bind910 \
bsdinstaller \
bsnmp-regex \
bsnmp-ucd \
ca_root_nss \
choparp \
cpustats \
dhcp6 \
dhcpleases \
dnsmasq \
expiretable \
filterdns \
filterlog \
ifinfo \
flock \
flowd \
igmpproxy \
isc-dhcp43-client \
isc-dhcp43-relay \
isc-dhcp43-server \
lighttpd \
miniupnpd \
mpd5 \
ntp \
openssh-portable \
openvpn \
opnsense-lang \
opnsense-update \
p7zip \
pam_opnsense \
pecl-radius \
pftop \
phalcon \
php-suhosin \
php56 \
php56-ctype \
php56-curl \
php56-dom \
php56-filter \
php56-gettext \
php56-hash \
php56-json \
php56-ldap \
php56-mcrypt \
php56-openssl \
php56-pdo \
php56-session \
php56-simplexml \
php56-sockets \
php56-sqlite3 \
php56-xml \
php56-zlib \
py27-Jinja2 \
py27-netaddr \
py27-requests \
py27-sqlite3 \
py27-ujson \
python27 \
radvd \
rate \
relayd \
rrdtool12 \
samplicator \
squid \
sshlockout_pf \
strongswan \
sudo \
suricata \
syslogd \
unbound \
wol
WRKDIR?=${.CURDIR}/work
WRKSRC?=${WRKDIR}/src
PKGDIR?=${WRKDIR}/pkg
mount: want-git
@if [ ! -f ${WRKDIR}/.mount_done ]; then \
echo -n "Enabling core.git live mount..."; \
echo "${CORE_COMMIT}" > \
${.CURDIR}/src/opnsense/version/opnsense; \
mount_unionfs ${.CURDIR}/src /usr/local; \
touch ${WRKDIR}/.mount_done; \
echo "done"; \
service configd restart; \
fi
umount: force
@if [ -f ${WRKDIR}/.mount_done ]; then \
echo -n "Disabling core.git live mount..."; \
umount -f "<above>:${.CURDIR}/src"; \
rm ${.CURDIR}/src/opnsense/version/opnsense; \
rm ${WRKDIR}/.mount_done; \
echo "done"; \
service configd restart; \
fi
manifest: want-git
@echo "name: \"${CORE_NAME}\""
@echo "version: \"${CORE_VERSION}\""
@echo "origin: \"${CORE_ORIGIN}\""
@echo "comment: \"${CORE_COMMENT}\""
@echo "desc: \"${CORE_HASH}\""
@echo "maintainer: \"${CORE_MAINTAINER}\""
@echo "www: \"${CORE_WWW}\""
@echo "message: \"${CORE_MESSAGE}\""
@echo "categories: [ \"sysutils\", \"www\" ]"
@echo "licenselogic: \"single\""
@echo "licenses: [ \"BSD2CLAUSE\" ]"
@echo "prefix: /usr/local"
@echo "vital: true"
@echo "deps: {"
@for CORE_DEPEND in ${CORE_DEPENDS}; do \
if ! ${PKG} query ' %n: { version: "%v", origin: "%o" }' \
$${CORE_DEPEND}; then \
echo ">>> Missing dependency: $${CORE_DEPEND}" >&2; \
exit 1; \
fi; \
done
@echo "}"
name: force
@echo ${CORE_NAME}
depends: force
@echo ${CORE_DEPENDS}
PKG_SCRIPTS= +PRE_INSTALL +POST_INSTALL \
+PRE_UPGRADE +POST_UPGRADE \
+PRE_DEINSTALL +POST_DEINSTALL
scripts: want-git
.for PKG_SCRIPT in ${PKG_SCRIPTS}
@if [ -e ${.CURDIR}/${PKG_SCRIPT} ]; then \
cp -v -- ${.CURDIR}/${PKG_SCRIPT} ${DESTDIR}/; \
sed -i '' -e "s/%%CORE_COMMIT%%/${CORE_COMMIT}/g" \
-e "s/%%CORE_NAME%%/${CORE_NAME}/g" \
-e "s/%%CORE_ABI%%/${CORE_ABI}/g" \
${DESTDIR}/${PKG_SCRIPT}; \
fi
.endfor
install: force
@${MAKE} -C ${.CURDIR}/contrib install DESTDIR=${DESTDIR}
@${MAKE} -C ${.CURDIR}/src install DESTDIR=${DESTDIR} \
CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} \
CORE_PACKAGESITE=${CORE_PACKAGESITE} \
CORE_REPOSITORY=${CORE_REPOSITORY}
bootstrap: force
@${MAKE} -C ${.CURDIR}/src install_bootstrap DESTDIR=${DESTDIR} \
NO_SAMPLE=please CORE_PACKAGESITE=${CORE_PACKAGESITE} \
CORE_NAME=${CORE_NAME} CORE_ABI=${CORE_ABI} \
CORE_REPOSITORY=${CORE_REPOSITORY}
plist: force
@${MAKE} -C ${.CURDIR}/contrib plist
@${MAKE} -C ${.CURDIR}/src plist
metadata: force
@mkdir -p ${DESTDIR}
@${MAKE} DESTDIR=${DESTDIR} scripts
@${MAKE} DESTDIR=${DESTDIR} manifest > ${DESTDIR}/+MANIFEST
@${MAKE} DESTDIR=${DESTDIR} plist > ${DESTDIR}/plist
package-check: force
@if [ -f ${WRKDIR}/.mount_done ]; then \
echo ">>> Cannot continue with live mount. Please run 'make umount'." >&2; \
exit 1; \
fi
package: package-check
@rm -rf ${WRKSRC}
@${MAKE} DESTDIR=${WRKSRC} FLAVOUR=${FLAVOUR} metadata
@${MAKE} DESTDIR=${WRKSRC} FLAVOUR=${FLAVOUR} install
@PORTSDIR=${.CURDIR} ${PKG} create -v -m ${WRKSRC} -r ${WRKSRC} \
-p ${WRKSRC}/plist -o ${PKGDIR}
upgrade-check: force
@if ! ${PKG} info ${CORE_NAME} > /dev/null; then \
echo ">>> Cannot find package. Please run 'opnsense-update -t ${CORE_NAME}'" >&2; \
exit 1; \
fi
@rm -rf ${PKGDIR}
upgrade: upgrade-check package
@${PKG} delete -fy ${CORE_NAME}
@${PKG} add ${PKGDIR}/*.txz
@/usr/local/etc/rc.restart_webgui
lint: force
find ${.CURDIR}/src ${.CURDIR}/scripts \
-name "*.sh" -type f -print0 | xargs -0 -n1 sh -n
find ${.CURDIR}/src ${.CURDIR}/scripts \
-name "*.xml" -type f -print0 | xargs -0 -n1 xmllint --noout
find ${.CURDIR}/src \
! -name "*.xml" ! -name "*.xml.sample" ! -name "*.eot" \
! -name "*.svg" ! -name "*.woff" ! -name "*.woff2" \
! -name "*.otf" ! -name "*.png" ! -name "*.js" \
! -name "*.scss" ! -name "*.py" ! -name "*.ttf" \
! -name "*.tgz" ! -name "*.xml.dist" \
-type f -print0 | xargs -0 -n1 php -l
sweep: force
find ${.CURDIR}/src -type f -name "*.map" -print0 | \
xargs -0 -n1 rm
if grep -nr sourceMappingURL= ${.CURDIR}/src; then \
echo "Mentions of sourceMappingURL must be removed"; \
exit 1; \
fi
find ${.CURDIR}/src ! -name "*.min.*" ! -name "*.svg" \
! -name "*.ser" -type f -print0 | \
xargs -0 -n1 scripts/cleanfile
find ${.CURDIR}/scripts -type f -print0 | \
xargs -0 -n1 scripts/cleanfile
find ${.CURDIR} -type f -depth 1 -print0 | \
xargs -0 -n1 scripts/cleanfile
style: want-pear-PHP_CodeSniffer
@(phpcs --standard=ruleset.xml ${.CURDIR}/src/opnsense/mvc \
|| true) > ${.CURDIR}/.style.out
@echo -n "Total number of style warnings: "
@grep '| WARNING' ${.CURDIR}/.style.out | wc -l
@echo -n "Total number of style errors: "
@grep '| ERROR' ${.CURDIR}/.style.out | wc -l
@cat ${.CURDIR}/.style.out
@rm ${.CURDIR}/.style.out
stylefix: want-pear-PHP_CodeSniffer
phpcbf --standard=ruleset.xml ${.CURDIR}/src/opnsense/mvc || true
setup: force
${.CURDIR}/src/etc/rc.php_ini_setup
health: force
# check test script output and advertise a failure...
[ "`${.CURDIR}/src/etc/rc.php_test_run`" == "FCGI-PASSED PASSED" ]
test: want-phpunit
@cd ${.CURDIR}/src/opnsense/mvc/tests && \
phpunit --configuration PHPunit.xml
clean: want-git
${GIT} reset --hard HEAD && ${GIT} clean -xdqf .
.PHONY: force