opnsense-deps/fastpath/cmm/Makefile.cross
Jeremy Karst 87893ded3e Build 26.7 for FreeBSD 15 only; port caam and cdx to its kernel
- caam: the bus activate, deactivate and release resource methods take
  no type and rid in FreeBSD 15.
- cdx: sys/cdefs.h defines __maybe_unused now; define it only if missing.
- 26.1 is end of life and no longer built: remove patches/26.1 and
  make-26.1.conf, default to 26.7 and FreeBSD 15.1 throughout, and move
  the build examples in README.md and RELEASE.md to 26.7.9. The 26.1
  tree on the mirror stays, for gateways that still have to upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:26:41 -05:00

65 lines
1.7 KiB
Text

# CMM cross-compilation Makefile for arm64
#
# Usage:
# make -f /usr/deps/fastpath/cmm/Makefile.cross
#
# Builds in the current directory (use /tmp/cmm-build or similar).
# Requires OPNsense base build first:
# sudo make -C /usr/tools base DEVICE=GATEWAY SETTINGS=26.7 TOOLSDIR=/usr/tools
#
# Copyright 2026 Mono Technologies Inc.
# SPDX-License-Identifier: GPL-2.0+
SYSROOT?= /usr/obj/usr/src/arm64.aarch64/tmp
CC?= cc
TARGET?= --target=aarch64-unknown-freebsd15.1
SRCDIR= ${MAKEFILE:H}/..
CMM_DIR= ${SRCDIR}/cmm
FCI_DIR= ${SRCDIR}/fci_lib
FCI_HDR= ${SRCDIR}/fci
CMM_SRCS= cmm.c cmm_conn.c cmm_route.c cmm_neigh.c \
cmm_itf.c cmm_rtsock.c cmm_fe.c \
cmm_lagg.c cmm_vlan.c cmm_ipsec.c cmm_tunnel.c cmm_deny.c \
cmm_socket.c cmm_bridge.c cmm_ctrl.c cmm_l2tp.c \
cmm_wifi.c cmm_pppoe.c cmm_mcast.c
CMM_OBJS= ${CMM_SRCS:.c=.o}
PROG= cmm
CFLAGS= -O2 -pipe -Wall -Wextra -Wno-unused-parameter
CFLAGS+= --sysroot=${SYSROOT} ${TARGET}
KSRCDIR?= /usr/src
CFLAGS+= -isystem ${KSRCDIR}/sys
CFLAGS+= -I${FCI_DIR} -I${FCI_HDR} -I${SRCDIR}/include -I${CMM_DIR} \
-I${SRCDIR}/auto_bridge -I${SRCDIR}/pf_notify
CFLAGS+= -DLS1043
CFLAGS+= -DWIFI_ENABLE
LDFLAGS= ${TARGET} --sysroot=${SYSROOT}
LIBS= -lnetgraph -lutil
all: ${PROG}
# Build libfci from source
libfci.o: ${FCI_DIR}/libfci_freebsd.c
${CC} ${CFLAGS} -c -o libfci.o ${FCI_DIR}/libfci_freebsd.c
libfci.a: libfci.o
ar rcs libfci.a libfci.o
# CMM objects — source lives on NFS, objects written locally
.for src in ${CMM_SRCS}
${src:.c=.o}: ${CMM_DIR}/${src}
${CC} ${CFLAGS} -c -o ${.TARGET} ${CMM_DIR}/${src}
.endfor
# Link
${PROG}: ${CMM_OBJS} libfci.a
${CC} ${LDFLAGS} -o ${.TARGET} ${CMM_OBJS} libfci.a ${LIBS}
clean:
rm -f ${CMM_OBJS} libfci.o libfci.a ${PROG}
.PHONY: all clean