Files
makronix/Makefile
T
lotherkandClaude Opus 5.5 870676e771 make binaries: the binary packages built in the build VM, as a repository for the media
The project's binaries need X in the base, Makronix has X from pkgsrc.
userland.sh binaries (make binaries; BINARIES=... before the lists name
them) builds packages.binary*.list in the build VM, vm-pkgbuild.sh repo packs
them with their run-time closure and pkg_summary.gz, and the host unpacks the
repository into build/packages/ARCH/All, where tools/cd3.sh takes it from.
The VM's mk.conf gets DEPENDS_TARGET=package-install (every dependency as a
binary package); a dependency installed before gets its package from its
PKGPATH.  vmprep() is the VM preparation that vm() and binaries() share.
The lists name PKGPATHs (still paused); cd3.sh, pkg-binaries.sh and the
tests' wanted() take the last part as the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 17:18:20 +00:00

154 lines
5.6 KiB
Makefile

# Makronix -- the tree, and the three ways in.
#
# NetBSD's own mechanisms, nothing invented:
# make build the distribution (no medium, no release)
# make release ARCH=... build through to a finished release
# make install install over a running Makronix (installworld)
#
# ARCH is the name a person types (amd64, sparc64, evbarm); MACHINE is
# NetBSD's internal name for the same thing. When the host is NetBSD and ARCH
# is not given, the host decides; otherwise amd64.
TOP := $(CURDIR)
SRC := $(TOP)/src
OBJ := $(TOP)/build/obj
JOBS ?= $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)
ARCH ?= $(shell uname -m 2>/dev/null | sed -e 's/x86_64/amd64/' -e 's/aarch64/evbarm/' || echo amd64)
# build.sh wants NetBSD's machine name. For the architectures where the two
# names differ, this is the mapping; everything else is passed through.
MACHINE := $(ARCH)
ifeq ($(ARCH),amd64)
MACHINE := amd64
endif
ifeq ($(ARCH),i386)
MACHINE := i386
endif
BUILD_SH := cd $(SRC) && ./build.sh \
-U -u -j $(JOBS) -m $(MACHINE) \
-M $(OBJ) -O $(OBJ)
.PHONY: all build release install tools kernel clean-sanity stamp test compress binaries
sourcesets isosrc cdtest userland usb mcde-linux
# Where tools/msrc-stage.sh assembles the msrc set.
SRCSTAGE := $(TOP)/build/msrc
# Before every build: drop the derived artefacts whose content depends on the
# sources. Without this, an incremental run keeps an old INSTALL ramdisk and
# the test measures the previous code (measured 2026-11-03). See
# tools/build-stamp.sh.
stamp:
@tools/build-stamp.sh
# The default: everything the system consists of, no medium.
all: build
build: stamp
$(BUILD_SH) distribution
release: stamp
$(BUILD_SH) release
# The installation CD that carries the sets. `release' is not it: for a
# medium with CDRELEASE=true (distrib/common/Makefile.bootcd:341-352) the
# release target is empty by design and the image target is iso_image, which
# writes RELEASEDIR/images/Makronix-<ver>-<arch>.iso (src/BUILDING:410-412,
# "iso-image Create a NetBSD installation CD-ROM image in the RELEASEDIR/
# images directory"). One build.sh operation, not a chain.
# It only packages what `make release' built, so it checks that nothing has
# changed since (tools/build-stamp.sh -c) instead of discarding the release.
iso:
@tools/build-stamp.sh -c
tools/cd3.sh stage
$(BUILD_SH) iso-image
tools/cd2.sh
tools/cd3.sh
# the bootable installation image for a USB stick (GPT, MBR and EFI), built from
# what `make release' made: images/Makronix-*-amd64-install.img.gz
usb:
@tools/build-stamp.sh -c
$(BUILD_SH) install-image
@tools/images.sh unpack
# pack the install images for a download (tools/images.sh): nothing is
# compressed by the other steps
compress:
@tools/images.sh pack
# the tests of a release (tools/test.sh): the media hold the DVD's files, one
# full installation (the DVD), smoke tests for the other media
test:
@tools/test.sh
# The source sets, RELEASEDIR/source/sets: NetBSD's own (src, gnusrc, syssrc,
# sharesrc: `build.sh sourcesets', src/BUILDING) and msrc, which carries the
# rest a system needs to rebuild itself offline -- pkgsrc, tools, the Makefile,
# docs, the archives of the Makronix packages only, and the pins (tools/
# msrc-stage.sh, patch 0010 for makesrctars -m). Needs the distfiles
# (tools/makronix-distfiles.sh fetch).
sourcesets:
tools/makronix-pins.sh check
tools/makronix-distfiles.sh check
tools/msrc-stage.sh $(SRCSTAGE)
$(BUILD_SH) -V MSRCDIR=$(SRCSTAGE) -V MAKESRCTARS_KEEPGIT=yes sourcesets
# The DVD that carries the source sets too (distrib/common/Makefile.bootcd:
# CDSOURCE copies RELEASEDIR/source onto the medium). A CD does not hold them,
# and upstream skips the CD when CDSOURCE is defined (distrib/amd64/cdroms/
# Makefile), so this writes the DVD only, over the one `make iso' made.
# Run `make release ARCH=...' and `make sourcesets' first.
isosrc:
@tools/build-stamp.sh -c
tools/cd3.sh stage
$(BUILD_SH) -V CDSOURCE=true iso-image
# The pkgsrc userland of the "makronix" set, cross-built on this host and
# built natively in the build VM, in one command (tools/userland.sh).
userland:
tools/userland.sh all
# The binary packages beside the sets (packages.binary*.list): built in the
# build VM with this tree's X, as a repository in build/packages/ARCH/All that
# `make iso' puts on the media (tools/cd3.sh). BINARIES="www/firefox ..."
# builds packages the lists do not name yet.
binaries:
BINARIES="$(BINARIES)" tools/userland.sh binaries
# The short way to a tested installer: the release, the three CDs, and the
# installation from them in the simple mode (about 15 minutes on 16 cores,
# measured 2026-11-07: release 8, iso 2, test 5). Not the DVD, not encryption,
# not UEFI: tools/install-cgd.sh and `make isosrc' for those.
cdtest:
$(MAKE) release ARCH=$(ARCH)
$(MAKE) iso
tools/install-simple.sh
# installworld over a running system. Refused anywhere but Makronix/NetBSD:
# a cross host has no business writing its own /usr from another system's
# distribution, and refusing is cheaper than explaining afterwards.
install:
@uname -s | grep -qx NetBSD || { \
echo "make install: this installs over the running system,"; \
echo "make install: which only makes sense on Makronix/NetBSD."; \
echo "make install: on $(shell uname -s), build with 'make' instead."; \
exit 1; }
$(BUILD_SH) installworld
tools:
$(BUILD_SH) tools
kernel:
$(BUILD_SH) kernel=$(MACHINE)
clean-sanity:
rm -rf $(OBJ)
# MCDE built natively on this host, for development (tools/mcde-linux.sh); not
# how Makronix gets it (that is pkgsrc). MCDE_DIRS: only these subdirectories.
mcde-linux:
tools/mcde-linux.sh $(MCDE_DIRS)