Adopts the Swift/LLVM model: Apache License 2.0 with the Runtime Library Exception text used verbatim by the Swift project. SPDX identifier: Apache-2.0 WITH Swift-exception. Apache 2.0 brings an explicit patent grant and patent-retaliation clause that BSD-3 lacks. The Runtime Library Exception ensures binaries produced by the Blaise compiler do not inherit attribution obligations from the linked-in RTL. * LICENSE — full Apache 2.0 + RLE text (replaces the deleted LICENCE). * NOTICE — project header plus QBE attribution (MIT, vendored). * docs/language-rationale.adoc — new Project Governance section capturing the decision, alternatives considered, and rationale. * SPDX headers updated across all .pas, .pp, .inc, .c source files, build scripts, PasBuild plugins, and the Makefile. * project.xml license field updated. * tools/migrate_full.py HEADER template updated so generated self-hosting source carries the new licence.
106 lines
3.4 KiB
Makefile
106 lines
3.4 KiB
Makefile
#
|
|
# Blaise — An Object Pascal Compiler
|
|
# Copyright (c) 2026 Graeme Geldenhuys
|
|
# SPDX-License-Identifier: Apache-2.0 WITH Swift-exception
|
|
# Licensed under the Apache License v2.0 with Runtime Library Exception.
|
|
# See LICENSE file in the project root for full license terms.
|
|
#
|
|
CC = gcc
|
|
CFLAGS = -O2 -Wall -Wextra -std=c11
|
|
|
|
SRC_DIR = src/main/c
|
|
PAS_SRC_DIR = src/main/pascal
|
|
OBJ_DIR = target
|
|
LIB = $(OBJ_DIR)/blaise_rtl.a
|
|
|
|
# Where the compiler binary lives — install copies the RTL there so the
|
|
# driver finds it automatically next to itself.
|
|
COMPILER_BIN = ../compiler/target
|
|
BLAISE = $(COMPILER_BIN)/blaise
|
|
QBE = ../vendor/qbe/qbe
|
|
|
|
# C sources (blaise_str.pas replaces blaise_str.c; blaise_str_fmt.c keeps
|
|
# the variadic _StringFormat which cannot be expressed in Pascal).
|
|
C_SRCS = $(SRC_DIR)/blaise_arc_class.c \
|
|
$(SRC_DIR)/blaise_exc.c \
|
|
$(SRC_DIR)/blaise_weak.c \
|
|
$(SRC_DIR)/blaise_str_fmt.c \
|
|
$(SRC_DIR)/blaise_io.c \
|
|
$(SRC_DIR)/blaise_process.c \
|
|
$(SRC_DIR)/blaise_sys_posix.c
|
|
C_OBJS = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS))
|
|
|
|
# Pascal RTL units compiled via the Blaise compiler.
|
|
# Each unit is compiled by a thin driver program; the program section is
|
|
# stripped from the IR so only the unit's exported functions are archived.
|
|
PAS_OBJS = $(OBJ_DIR)/blaise_str.o \
|
|
$(OBJ_DIR)/blaise_arc.o \
|
|
$(OBJ_DIR)/blaise_sys.o
|
|
|
|
OBJS = $(C_OBJS) $(PAS_OBJS)
|
|
|
|
.PHONY: all install clean
|
|
|
|
all: $(LIB)
|
|
|
|
$(LIB): $(OBJS)
|
|
ar rcs $@ $^
|
|
|
|
# --- C rules ---
|
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
|
|
@mkdir -p $(OBJ_DIR)
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
# --- Pascal unit rules ---
|
|
# Compile via a build driver, strip everything from '# Generated by Blaise'
|
|
# onward (the program section), assemble the unit-only IR, then compile to .o.
|
|
$(OBJ_DIR)/blaise_str.ssa: $(PAS_SRC_DIR)/blaise_str.pas \
|
|
$(PAS_SRC_DIR)/blaise_str_build_driver.pas
|
|
@mkdir -p $(OBJ_DIR)
|
|
$(BLAISE) --source $(PAS_SRC_DIR)/blaise_str_build_driver.pas \
|
|
--unit-path $(PAS_SRC_DIR) \
|
|
--emit-ir \
|
|
| sed '/^# Generated by Blaise/,$$d' > $@
|
|
|
|
$(OBJ_DIR)/blaise_str.s: $(OBJ_DIR)/blaise_str.ssa
|
|
$(QBE) -o $@ $<
|
|
|
|
$(OBJ_DIR)/blaise_str.o: $(OBJ_DIR)/blaise_str.s
|
|
$(CC) -c -o $@ $<
|
|
|
|
$(OBJ_DIR)/blaise_arc.ssa: $(PAS_SRC_DIR)/blaise_arc.pas \
|
|
$(PAS_SRC_DIR)/blaise_arc_build_driver.pas
|
|
@mkdir -p $(OBJ_DIR)
|
|
$(BLAISE) --source $(PAS_SRC_DIR)/blaise_arc_build_driver.pas \
|
|
--unit-path $(PAS_SRC_DIR) \
|
|
--emit-ir \
|
|
| sed '/^# Generated by Blaise/,$$d' > $@
|
|
|
|
$(OBJ_DIR)/blaise_arc.s: $(OBJ_DIR)/blaise_arc.ssa
|
|
$(QBE) -o $@ $<
|
|
|
|
$(OBJ_DIR)/blaise_arc.o: $(OBJ_DIR)/blaise_arc.s
|
|
$(CC) -c -o $@ $<
|
|
|
|
$(OBJ_DIR)/blaise_sys.ssa: $(PAS_SRC_DIR)/blaise_sys.pas \
|
|
$(PAS_SRC_DIR)/blaise_sys_build_driver.pas
|
|
@mkdir -p $(OBJ_DIR)
|
|
$(BLAISE) --source $(PAS_SRC_DIR)/blaise_sys_build_driver.pas \
|
|
--unit-path $(PAS_SRC_DIR) \
|
|
--emit-ir \
|
|
| sed '/^# Generated by Blaise/,$$d' > $@
|
|
|
|
$(OBJ_DIR)/blaise_sys.s: $(OBJ_DIR)/blaise_sys.ssa
|
|
$(QBE) -o $@ $<
|
|
|
|
$(OBJ_DIR)/blaise_sys.o: $(OBJ_DIR)/blaise_sys.s
|
|
$(CC) -c -o $@ $<
|
|
|
|
install: $(LIB)
|
|
@mkdir -p $(COMPILER_BIN)
|
|
cp $(LIB) $(COMPILER_BIN)/blaise_rtl.a
|
|
@echo "Installed blaise_rtl.a → $(COMPILER_BIN)/blaise_rtl.a"
|
|
|
|
clean:
|
|
rm -f $(OBJ_DIR)/*.o $(OBJ_DIR)/*.s $(OBJ_DIR)/*.ssa $(LIB)
|