Rewrite the Installer app on the Montauk Toolkit (Canvas + gui/mtk widgets, theme, hover states, scrollbar) replacing the hand-rolled px_* renderer and bespoke TrueType usage. Add a new "Software" step: an expandable checkbox tree for optional components (Montauk SDK with gcc/g++, binutils, tcc, lua sub-items; Games; Office; Internet apps; Printing; experimental httpd and SDR). Unchecked components' paths are excluded from the install copy, with a longest-path ownership rule so e.g. sdk/tcc installs even when the rest of the SDK is deselected. The update flow refreshes only the components the target already has. Add tri-state checkbox and disclosure-arrow widgets to the MTK toolkit (anti-aliased, supersampled). Merge tcc and lua into 0:/sdk (0:/sdk/tcc, 0:/sdk/lua) and drop 0:/lib: update tcc config.h, lua luaconf.h, both Makefiles, the devkit clean scope, man pages and montaukos.org notices. Make printing optional: init skips printd when 0:/os/printd.elf is absent. Co-Authored-By: Claude Opus 4.8 <[email protected]>
137 lines
3.2 KiB
Makefile
137 lines
3.2 KiB
Makefile
# Makefile for TCC on MontaukOS
|
|
# Copyright (c) 2026 Daniel Hammer
|
|
|
|
MAKEFLAGS += -rR
|
|
.SUFFIXES:
|
|
|
|
# ---- Toolchain ----
|
|
|
|
TOOLCHAIN_PREFIX := $(shell cd ../../.. && pwd)/toolchain/local/bin/x86_64-montauk-
|
|
ifeq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
|
|
CC = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
|
CXX = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
|
AR = $(error x86_64-montauk toolchain not found. Run ./toolchain/build-montauk-toolchain.sh first)
|
|
else
|
|
CC := $(TOOLCHAIN_PREFIX)gcc
|
|
CXX := $(TOOLCHAIN_PREFIX)g++
|
|
AR := $(TOOLCHAIN_PREFIX)ar
|
|
endif
|
|
|
|
# ---- Paths ----
|
|
|
|
PROG_INC := ../../include
|
|
LIBDIR := ../../lib
|
|
OBJDIR := obj
|
|
BINDIR := ../../bin/os
|
|
|
|
# ---- Compiler flags ----
|
|
|
|
CFLAGS := \
|
|
-std=gnu11 \
|
|
-g -O2 -pipe \
|
|
-Wall \
|
|
-Wno-unused-parameter \
|
|
-Wno-unused-function \
|
|
-Wno-sign-compare \
|
|
-Wno-misleading-indentation \
|
|
-Wno-implicit-fallthrough \
|
|
-Wno-stringop-truncation \
|
|
-Wno-format-truncation \
|
|
-ffreestanding \
|
|
-fno-stack-protector \
|
|
-fno-stack-check \
|
|
-ffunction-sections \
|
|
-fdata-sections \
|
|
-msse \
|
|
-msse2 \
|
|
-fno-tree-loop-distribute-patterns \
|
|
-D__MONTAUKOS__=1 \
|
|
-DONE_SOURCE=0 \
|
|
-DTCC_TARGET_X86_64=1 \
|
|
-DCONFIG_TCC_STATIC=1 \
|
|
-I. \
|
|
-isystem $(PROG_INC)/libc \
|
|
-isystem $(shell $(CC) -print-file-name=include)
|
|
|
|
LDFLAGS := \
|
|
-nostdlib \
|
|
-Wl,--gc-sections \
|
|
-T ../../link.ld
|
|
|
|
# ---- Sources ----
|
|
|
|
TCC_SRCS := \
|
|
libtcc.c \
|
|
tccpp.c \
|
|
tccgen.c \
|
|
tccelf.c \
|
|
tccasm.c \
|
|
tccdbg.c \
|
|
x86_64-gen.c \
|
|
x86_64-link.c \
|
|
i386-asm.c \
|
|
tcc.c
|
|
|
|
COMPAT_SRCS := \
|
|
montauk_main.c
|
|
|
|
ASM_SRCS := \
|
|
setjmp.S
|
|
|
|
TCC_OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(TCC_SRCS))
|
|
COMPAT_OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(COMPAT_SRCS))
|
|
ASM_OBJS := $(patsubst %.S,$(OBJDIR)/%.o,$(ASM_SRCS))
|
|
|
|
ALL_OBJS := $(TCC_OBJS) $(COMPAT_OBJS) $(ASM_OBJS)
|
|
|
|
TARGET := $(BINDIR)/tcc.elf
|
|
|
|
# ---- CRT objects (staged from shared libc) ----
|
|
|
|
SHARED_CRT_DIR := $(LIBDIR)/libc
|
|
CRT_DIR := ../../bin/sdk/tcc/lib
|
|
CRT_OBJS := $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtn.o
|
|
|
|
# ---- Rules ----
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(TARGET) $(CRT_OBJS) $(CRT_DIR)/libc.a
|
|
|
|
$(TARGET): $(ALL_OBJS) $(LIBDIR)/libc/liblibc.a
|
|
@mkdir -p $(BINDIR)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(ALL_OBJS) $(LIBDIR)/libc/liblibc.a -lgcc -o $@
|
|
|
|
$(OBJDIR)/%.o: %.c Makefile config.h montauk_compat.h
|
|
@mkdir -p $(OBJDIR)
|
|
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
|
|
|
$(OBJDIR)/%.o: %.S Makefile
|
|
@mkdir -p $(OBJDIR)
|
|
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
|
|
|
$(SHARED_CRT_DIR)/liblibc.a $(SHARED_CRT_DIR)/crt1.o $(SHARED_CRT_DIR)/crti.o $(SHARED_CRT_DIR)/crtn.o:
|
|
$(MAKE) -C $(SHARED_CRT_DIR)
|
|
|
|
$(CRT_DIR)/crt1.o: $(SHARED_CRT_DIR)/crt1.o
|
|
@mkdir -p $(CRT_DIR)
|
|
cp $< $@
|
|
|
|
$(CRT_DIR)/crti.o: $(SHARED_CRT_DIR)/crti.o
|
|
@mkdir -p $(CRT_DIR)
|
|
cp $< $@
|
|
|
|
$(CRT_DIR)/crtn.o: $(SHARED_CRT_DIR)/crtn.o
|
|
@mkdir -p $(CRT_DIR)
|
|
cp $< $@
|
|
|
|
$(CRT_DIR)/libc.a: $(LIBDIR)/libc/liblibc.a
|
|
@mkdir -p $(CRT_DIR)
|
|
cp $< $@
|
|
|
|
clean:
|
|
rm -rf $(OBJDIR) $(TARGET)
|
|
|
|
# Auto-generated header dependency tracking (-MMD -MP).
|
|
-include $(TCC_OBJS:.o=.d) $(COMPAT_OBJS:.o=.d)
|