SchOS/ports/mk/port.mk
Nexoniarz 26bca020b6 licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0
Nexoniarz is the sole author and SchOS was never published under
Apache-2.0, so this is a straight relicence. LICENSE is the FSF GPLv2 text,
every first-party SPDX header moves to GPL-2.0-or-later, and NOTICE,
README.md, docs/licensing.md and the site say so. projects/schfs-linux
follows the rest of the tree.

The GPL gives copyleft: a fork has to ship its source. It also lifts the
old "Linux drivers, never" rule, since GPL-2.0-only code combines with
GPL-2.0-or-later. "Or later" leaves room for GPLv3, but one binary still
has to pick one version, so docs/licensing.md now keeps Apache-2.0 and
GPLv3 code out of the kernel to keep Linux code possible there. BSD
4-clause code goes from "avoid" to "no", because the advertising clause
is GPL-incompatible.

LDLS still ships no .ko. That boundary is now project policy rather than
a legal requirement, and ldls.md, devices.md and licensing.md section 6
say so. refmod declares license=GPL, and ldls-check passes (27 checks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:48:45 +02:00

58 lines
2.1 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0-or-later
# Shared definitions for all SchOS ports.
# Include this at the top of each port's Makefile: include ../mk/port.mk
#
# Layout contract — a port directory contains ONLY hand-written files:
#
# ports/<name>/Makefile required
# ports/<name>/patches/* optional
#
# Everything generated goes under $(PORTDIR) = build/ports/<name>/ :
#
# build/ports/<name>/src extracted upstream tarball
# build/ports/<name>/obj out-of-tree build directory
# build/ports/<name>/prefix install prefix (musl's headers/libs land here)
#
# If a file appears inside ports/<name>/ that you did not write by hand,
# it is in the wrong place. `make clean` deletes $(PORTDIR) and nothing else.
PORTSDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)
TOPDIR := $(abspath $(PORTSDIR)/..)
SYSROOT := $(TOPDIR)/sysroot
DISTDIR := $(TOPDIR)/dist
BUILDROOT := $(TOPDIR)/build/ports
# Verifying a downloaded tarball. Not `sha256sum -c -`: that command does not
# exist on macOS or the BSDs, and each of them spells it differently. The
# helper picks whichever of the five possibilities the host actually has.
SHA256CHECK := $(TOPDIR)/tools/posix/sha256check.sh
# Port name is the directory name — no per-port boilerplate needed.
PORT := $(notdir $(CURDIR))
PORTDIR := $(BUILDROOT)/$(PORT)
SRCDIR := $(PORTDIR)/src
BUILDDIR := $(PORTDIR)/obj
PREFIX := $(PORTDIR)/prefix
# musl is the libc every other port links against; its install prefix is a
# fixed location so ports don't need to know where musl's own source lives.
MUSL := $(BUILDROOT)/musl/prefix
# ncurses is the second library other ports link against, so its prefix is
# fixed for the same reason musl's is. Unlike every other port it installs
# nothing into sysroot/ -- a static library is not a file the OS ships.
NCURSES := $(BUILDROOT)/ncurses/prefix
CC := clang
# FS register belongs to the kernel; never let the compiler touch %fs directly.
CFLAGS_BT := -fno-stack-protector
.PHONY: all download extract build install clean distclean
all: install
$(DISTDIR):
mkdir -p $(DISTDIR)
$(SYSROOT)/bin:
mkdir -p $@