opnsense-tools/Makefile

163 lines
5.0 KiB
Makefile
Raw Normal View History

# Copyright (c) 2015-2019 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.
STEPS= arm base boot chroot clean compress confirm core distfiles \
download dvd fingerprint info kernel nano packages plugins \
ports prefetch print rebase release rename rewind serial sign \
2019-07-02 08:26:40 +02:00
skim test update upload verify vga vm xtools
SCRIPTS= batch hotfix nightly
2019-07-02 08:26:40 +02:00
.PHONY: ${STEPS} ${SCRIPTS}
PAGER?= less
.MAKE.JOB.PREFIX?= # tampers with some of our make invokes
all:
@cat ${.CURDIR}/README.md | ${PAGER}
lint-steps:
.for STEP in common ${STEPS}
2016-03-04 15:46:37 +01:00
@sh -n ${.CURDIR}/build/${STEP}.sh
.endfor
2018-10-12 08:33:47 +02:00
lint-composite:
.for SCRIPT in ${SCRIPTS}
2018-10-12 08:33:47 +02:00
@sh -n ${.CURDIR}/composite/${SCRIPT}.sh
.endfor
2018-10-12 08:33:47 +02:00
lint: lint-steps lint-composite
2016-03-04 15:46:37 +01:00
# Special vars to load early build.conf settings:
TOOLSDIR?= /usr/tools
TOOLSBRANCH?= master
2020-01-28 07:06:39 +01:00
SETTINGS?= 20.1
CONFIG?= ${TOOLSDIR}/config/${SETTINGS}/build.conf
.-include "${CONFIG}"
# Bootstrap the build options if not set:
NAME?= OPNsense
TYPE?= ${NAME:tl}
2016-07-12 07:22:57 +02:00
SUFFIX?= #-devel
FLAVOUR?= OpenSSL LibreSSL # first one is default
2016-07-21 21:40:28 +02:00
_ARCH!= uname -p
ARCH?= ${_ARCH}
KERNEL?= SMP
2018-01-15 21:38:52 +01:00
ADDITIONS?= os-dyndns${SUFFIX}
2019-05-07 10:02:53 +02:00
DEVICE?= A10
SPEED?= 115200
2016-07-11 08:50:39 +02:00
UEFI?= yes
GITBASE?= https://github.com/opnsense
2016-02-02 21:08:53 +01:00
MIRRORS?= https://opnsense.c0urier.net \
http://mirrors.nycbug.org/pub/opnsense \
http://mirror.wdc1.us.leaseweb.net/opnsense \
http://mirror.sfo12.us.leaseweb.net/opnsense \
http://mirror.fra10.de.leaseweb.net/opnsense \
http://mirror.ams1.nl.leaseweb.net/opnsense
2018-03-17 09:13:29 +01:00
SERVER?= user@does.not.exist
UPLOADDIR?= .
_VERSION!= date '+%Y%m%d%H%M'
VERSION?= ${_VERSION}
STAGEDIRPREFIX?=/usr/obj
2020-01-05 08:33:28 +01:00
PORTSREFURL?= https://git-01.md.hardenedbsd.org/HardenedBSD/hardenedbsd-ports.git
PORTSREFDIR?= /usr/hardenedbsd-ports
2017-01-12 08:22:37 +01:00
PORTSREFBRANCH?=master
PLUGINSENV?= PLUGIN_PHP=${PHP} PLUGIN_ABI=${SETTINGS} PLUGIN_PYTHON=${PYTHON}
PLUGINSDIR?= /usr/plugins
PLUGINSBRANCH?= master
PORTSDIR?= /usr/ports
PORTSBRANCH?= master
COREDIR?= /usr/core
COREBRANCH?= master
COREENV?= CORE_PHP=${PHP} CORE_ABI=${SETTINGS} CORE_PYTHON=${PYTHON}
SRCDIR?= /usr/src
SRCBRANCH?= master
# for ports and core
DEVELBRANCH?= #master
2016-02-02 16:47:06 +01:00
# A couple of meta-targets for easy use and ordering:
ports distfiles: base
2016-02-02 16:47:06 +01:00
plugins: ports
core: plugins
packages test: core
dvd nano serial vga vm: packages kernel
sets: distfiles packages kernel
images: dvd nano serial vga vm # arm
release: dvd nano serial vga
# Expand target arguments for the script append:
.for TARGET in ${.TARGETS}
_TARGET= ${TARGET:C/\-.*//}
.if ${_TARGET} != ${TARGET}
${_TARGET}_ARGS+= ${TARGET:C/^[^\-]*(\-|\$)//:S/,/ /g}
${TARGET}: ${_TARGET}
.endif
.endfor
.if "${VERBOSE}" != ""
VERBOSE_FLAGS= -x
.else
VERBOSE_HIDDEN= @
2015-08-21 11:07:49 +02:00
.endif
.for _VERSION in PERL PHP PYTHON RUBY
2018-04-05 08:23:30 +02:00
VERSIONS+= PRODUCT_${_VERSION}=${${_VERSION}}
.endfor
# Expand build steps to launch into the selected
# script with the proper build options set:
.for STEP in ${STEPS}
${STEP}: lint-steps
${VERBOSE_HIDDEN} cd ${.CURDIR}/build && \
sh ${VERBOSE_FLAGS} ./${.TARGET}.sh -a ${ARCH} -F ${KERNEL} \
-f "${FLAVOUR}" -n ${NAME} -v ${VERSION} -s ${SETTINGS} \
-S ${SRCDIR} -P ${PORTSDIR} -p ${PLUGINSDIR} -T ${TOOLSDIR} \
-C ${COREDIR} -R ${PORTSREFDIR} -t ${TYPE} -k "${PRIVKEY}" \
-K "${PUBKEY}" -l "${SIGNCHK}" -L "${SIGNCMD}" -d ${DEVICE} \
-m ${MIRRORS:Ox:[1]} -o "${STAGEDIRPREFIX}" -c ${SPEED} \
-b ${SRCBRANCH} -B ${PORTSBRANCH} -e ${PLUGINSBRANCH} \
2017-01-12 08:22:37 +01:00
-g ${TOOLSBRANCH} -E ${COREBRANCH} -G ${PORTSREFBRANCH} \
-H "${COREENV}" -u "${UEFI:tl}" -U "${SUFFIX}" \
-V "${ADDITIONS}" -O "${GITBASE}" -r "${SERVER}" \
-q "${VERSIONS}" -h "${PLUGINSENV}" -I "${UPLOADDIR}" \
-D "${DEVELBRANCH}" -A "${PORTSREFURL}" ${${STEP}_ARGS}
.endfor
.for SCRIPT in ${SCRIPTS}
2018-10-12 08:33:47 +02:00
${SCRIPT}: lint-composite
${VERBOSE_HIDDEN} cd ${.CURDIR} && FLAVOUR="${FLAVOUR}" \
sh ${VERBOSE_FLAGS} ./composite/${SCRIPT}.sh ${${SCRIPT}_ARGS}
.endfor