tools/windows/ .ps1 (pwsh, so usable from Linux and macOS too)
tools/posix/ .sh
tools/python/ .py
tools/ .c and .pl
The .c and .pl files stay at the top level because they are not
host-specific: the build compiles or invokes them on every platform.
Call sites updated in the Makefile, ports/mk/port.mk, docs and the
project memory. The one thing that does not survive a move on its own is
a script deriving the repo root from its own location -- all nine
PowerShell tools used Split-Path $PSScriptRoot -Parent, and memory-sync.sh
used dirname/.., both of which quietly become tools/ one level deeper.
Two levels now.
Two pre-existing Windows failures surfaced while verifying, both real and
neither caused by the move:
- schfs_fsck.c did not compile under mingw at all: --extract uses
POSIX mkdir(path,mode), symlink() and link(), none of which mingw
has. That took the whole tool with it, and `make schfs-check` with
it. mkdir maps to _mkdir; symlink and link fail loudly rather than
writing a regular file in their place, because an extracted tree
that differs from the image while reporting success defeats the
point of --extract.
- the round-trip test then failed at `ln -s`, since Git Bash cannot
create symlinks without developer mode. It skips with a message now.
Not a fudge: mkschfs's mingw build cannot see a symlink either, so
the test would have compared a tree with none against an image with
none and called it a pass -- coverage reporting itself as present
while being absent.
Verified on Windows: build clean, all seven bootcheck suites green,
make schfs-check passes.
53 lines
1.8 KiB
Makefile
53 lines
1.8 KiB
Makefile
# 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/<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
|
|
|
|
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 $@
|