Makefile
impl/xlt/Makefile · 39 line(s) · makefile
# Makefile for the XLT (.xlt) CPU-model front-end: lexer + parser + resolver +
# the `xltc` CLI. Self-contained (no dependency on the Nordshrift build), mirrors
# its structure. Build: make -C impl/xlt -> impl/xlt/build/xltc
CXX ?= g++
CXXFLAGS ?= -std=c++17 -O2 -Wall -Wextra
# Automatic header-dependency tracking (parity with impl/Makefile): -MMD writes
# a .d per object, -MP guards against removed headers; the .d files are
# -included below so editing any xlt_*.h recompiles exactly the dependents.
DEPFLAGS := -MMD -MP
BUILD := build
ifeq ($(OS),Windows_NT)
EXE := .exe
else
EXE :=
endif
BIN := $(BUILD)/xltc$(EXE)
SRC := xlt_lexer.cpp xlt_parser.cpp xlt_resolve.cpp xltc.cpp
OBJ := $(SRC:%.cpp=$(BUILD)/%.o)
.PHONY: all check clean
all: $(BIN)
$(BIN): $(OBJ)
$(CXX) $(CXXFLAGS) $(OBJ) -o $@
$(BUILD)/%.o: %.cpp
@mkdir -p $(BUILD)
$(CXX) $(CXXFLAGS) $(DEPFLAGS) -c $< -o $@
-include $(wildcard $(BUILD)/*.d)
# Smoke-check the bundled example: a congruent model builds, exit 0.
check: $(BIN)
./$(BIN) ../../lib/xlt/examples/epyc-ddr2.xlt
clean:
@rm -rf $(BUILD)