# SPDX-License-Identifier: Apache-2.0 # 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//Makefile required # ports//patches/* optional # # Everything generated goes under $(PORTDIR) = build/ports// : # # build/ports//src extracted upstream tarball # build/ports//obj out-of-tree build directory # build/ports//prefix install prefix (musl's headers/libs land here) # # If a file appears inside ports// 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 # 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 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 $@