Files
2026-08-09 10:47:07 +02:00

90 lines
2.8 KiB
Makefile

# Makefile - MontaukOS ports tree
#
# make Build every port into out/apps/<name>/
# make doom Build a single port (shorthand for its category path)
# make games-fps/doom Same, by full path
# make install Copy built bundles into the MontaukOS ramdisk tree
# make clean Remove build artifacts
#
# Ports build against a MontaukOS checkout; override its location with
# MONTAUKOS=/path/to/MontaukOS (default ~/dev/MontaukOS).
MAKEFLAGS += -rR
.SUFFIXES:
MTKPORTS_ROOT := $(CURDIR)
export MTKPORTS_ROOT
MONTAUKOS ?= $(HOME)/dev/MontaukOS
export MONTAUKOS
OUTDIR := $(MTKPORTS_ROOT)/out
export OUTDIR
# Ports to build, as <category>/<port>, in dependency order: library ports
# come before the applications that link them. Categories follow Gentoo
# naming (dev-libs, media-libs, net-libs, www-client, games-fps, ...).
PORTS := \
dev-libs/zlib \
dev-libs/libwapcaplet \
dev-libs/libparserutils \
dev-libs/libnsutils \
dev-libs/libnslog \
dev-libs/libutf8proc \
net-libs/libhubbub \
net-libs/libcss \
net-libs/libdom \
net-libs/libnspsl \
media-libs/libnsgif \
media-libs/libnsbmp \
www-client/netsurf \
games-fps/doom \
dev-vcs/git
# Bundle directories are keyed by port name, not category path.
PORT_NAMES := $(notdir $(PORTS))
# Ports that install themselves rather than producing an app bundle: command
# line tools, which land in 0:/os/ with no manifest and no launcher icon.
# `install` below delegates to their own install target.
#
# www-client/netsurf is deliberately NOT here: it also has an install target,
# but it drops a resource tree next to the binary and is not something every
# image should carry, so it stays a manual `make -C www-client/netsurf install`.
SELF_INSTALL_PORTS := dev-vcs/git
.PHONY: all clean install $(PORTS) $(PORT_NAMES)
all: $(PORTS)
$(PORTS):
$(MAKE) -C $@
# Shorthand target per port name, so `make doom` works as well as
# `make games-fps/doom`.
define PORT_ALIAS
$(notdir $(1)): $(1)
endef
$(foreach p,$(PORTS),$(eval $(call PORT_ALIAS,$(p))))
# Drop finished bundles into the OS ramdisk staging tree. install_apps.sh
# builds in-tree app bundles at the same path; ports simply add to it.
install: all
@mkdir -p $(MONTAUKOS)/programs/bin/apps
@for p in $(PORTS); do \
n=$$(basename $$p); \
if [ -d "$(OUTDIR)/apps/$$n" ]; then \
cp -r "$(OUTDIR)/apps/$$n" "$(MONTAUKOS)/programs/bin/apps/"; \
echo "installed port: $$p"; \
fi; \
done
@for p in $(SELF_INSTALL_PORTS); do \
$(MAKE) -C $$p install; \
done
@echo "ports: installed into $(MONTAUKOS)/programs/bin/apps/"
@echo "ports: run 'make ramdisk' (or 'make') in $(MONTAUKOS) to rebuild the image"
clean:
@for p in $(PORTS); do $(MAKE) -C $$p clean; done
rm -rf $(OUTDIR)