2026-07-18 18:48:23 +02:00
|
|
|
# Klammertext com/ Makefile
|
|
|
|
|
# Improved version with automatic header dependency tracking
|
|
|
|
|
|
|
|
|
|
K := $(KLAMMERTEXT_HOME)
|
|
|
|
|
KS := $(K)/sks
|
|
|
|
|
KM := $(K)/mac
|
|
|
|
|
|
Typed arguments, calculated tables, spans, closed-world fonts, top-level fnt/ and env/
Sync with klammertext-dev through b90b0e09:
- Argument types end to end: :python_cast values are applied (Python
@eval receives real bools/numbers/lists), argument values are
validated against their argtype patterns with the argtype's
description as the error message, argtypes can declare :default
(overridable per declaration), and parameterized type families are
supported: rest(N) casts a rest argument to an N-dimensional list
(bar-count = dimension).
- Unified indexed_range syntax (selector with parenthesized subsets,
composable mnemonic names) for table lines and spans.
- Table klammer: caption fonts fixed in both targets, :column_width /
:leading / :colsep wired, :colspan and :rowspan render (HTML
attributes; \multicolumn / \multirow), calculated cell values (:calc)
with prefix operators, display-precision semantics, :calc_format and
:decimal period|comma.
- Fonts: closed-world resolution on the Klammertext font store
(infrastructure in mac/font_store; no Google Fonts links or fetch).
Default fonts live in the top-level fnt/; additional fonts install
into KLAMMERTEXT_FONTS directories via kdesc --font (list, samples,
preview, install — classification by font metadata). CSS font family
names are quoted (digit-initial families were silently lost).
- Environment files moved from mac/env/ to the top-level env/; shell
profiles source env/runtime.env. Dead per-host variants removed.
- Container: fnt/ ships in the image; curl removed (no network use).
2026-07-22 18:17:43 +02:00
|
|
|
include $(K)/env/makefile.env
|
2026-07-18 18:48:23 +02:00
|
|
|
|
|
|
|
|
# Commands to build
|
|
|
|
|
COMMANDS := kdiag kdesc ktext
|
|
|
|
|
|
|
|
|
|
# Build output directory: commands are linked directly into ../bin, so there is
|
|
|
|
|
# exactly one copy of each (no redundant executables in com/) and make still
|
|
|
|
|
# tracks them by path for incremental builds.
|
|
|
|
|
BINDIR := ../bin
|
|
|
|
|
BINCOMMANDS := $(addprefix $(BINDIR)/,$(COMMANDS))
|
|
|
|
|
|
|
|
|
|
# System install location (out-of-tree). Override on the command line, e.g.
|
|
|
|
|
# make install PREFIX=/opt DESTDIR=/tmp/stage
|
|
|
|
|
PREFIX ?= /usr/local
|
|
|
|
|
DESTDIR ?=
|
|
|
|
|
|
|
|
|
|
# Shared library location
|
|
|
|
|
LIBDIR := ../lib
|
|
|
|
|
LIBRARY := $(LIBDIR)/libklammertext.so
|
|
|
|
|
|
|
|
|
|
# Linker flags for commands
|
|
|
|
|
COM_LDFLAGS := $(EXPORT_DYNAMIC) -Wl,-rpath,'$(ORIGIN)/../lib' -L$(LIBDIR)
|
|
|
|
|
|
|
|
|
|
# Dependency files for command sources
|
|
|
|
|
DEPFILES := $(addsuffix .d,$(COMMANDS))
|
|
|
|
|
|
|
|
|
|
# Compiler flags for dependency generation ($(@F) keeps the .d files in com/,
|
|
|
|
|
# not in the ../bin output directory).
|
|
|
|
|
DEPFLAGS = -MMD -MP -MF $(@F).d
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean redo clang mac sks install
|
|
|
|
|
|
|
|
|
|
# Default target: build dependencies first, then commands
|
|
|
|
|
all : | mac sks
|
|
|
|
|
$(MAKE) commands
|
|
|
|
|
|
|
|
|
|
# Separate target to build commands (called after dependencies are ready)
|
|
|
|
|
.PHONY: commands
|
|
|
|
|
commands : $(BINCOMMANDS)
|
|
|
|
|
|
|
|
|
|
# Ensure the output directory exists before linking into it.
|
|
|
|
|
$(BINDIR) :
|
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
|
|
# Build mac/ objects
|
|
|
|
|
mac :
|
|
|
|
|
$(MAKE) -C $(KM) -j
|
|
|
|
|
|
|
|
|
|
# Build sks/ components (depends on mac)
|
|
|
|
|
sks : | mac
|
|
|
|
|
$(MAKE) -C $(KS)/kutil -j
|
|
|
|
|
$(MAKE) -C $(KS)/target -j
|
|
|
|
|
$(MAKE) -C $(KS)/document
|
|
|
|
|
|
|
|
|
|
# Explicit rules for each command - link against shared library, output to bin/
|
|
|
|
|
$(BINDIR)/kdiag : kdiag.cpp $(LIBRARY) | $(BINDIR)
|
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< -o $@ -lklammertext $(LDLIBS)
|
|
|
|
|
|
|
|
|
|
$(BINDIR)/kdesc : kdesc.cpp $(LIBRARY) | $(BINDIR)
|
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< -o $@ -lklammertext $(LDLIBS)
|
|
|
|
|
|
|
|
|
|
$(BINDIR)/ktext : ktext.cpp $(LIBRARY) | $(BINDIR)
|
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $(COM_LDFLAGS) $(LDFLAGS) $< -o $@ -lklammertext $(LDLIBS)
|
|
|
|
|
|
|
|
|
|
# Out-of-tree system install (copies; the build tree stays intact). The
|
|
|
|
|
# installed commands still need KLAMMERTEXT_HOME pointing at a Klammertext tree
|
|
|
|
|
# for sks/ and the Python modules; their rpath finds libklammertext.so in
|
|
|
|
|
# $(PREFIX)/lib.
|
|
|
|
|
install : all
|
|
|
|
|
install -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/lib
|
|
|
|
|
install -m755 $(BINCOMMANDS) $(DESTDIR)$(PREFIX)/bin
|
|
|
|
|
install -m755 $(LIBRARY) $(DESTDIR)$(PREFIX)/lib
|
|
|
|
|
|
|
|
|
|
clean :
|
|
|
|
|
rm -f $(BINCOMMANDS) $(DEPFILES) *~
|
|
|
|
|
|
|
|
|
|
redo :
|
|
|
|
|
ifneq ($(filter clang,$(MAKECMDGOALS)),)
|
|
|
|
|
@:
|
|
|
|
|
else
|
|
|
|
|
$(MAKE) -C $(KM) clean
|
|
|
|
|
$(MAKE) -C $(KS)/kutil clean
|
|
|
|
|
$(MAKE) -C $(KS)/target clean
|
|
|
|
|
$(MAKE) -C $(KS)/document clean
|
|
|
|
|
$(MAKE) clean
|
|
|
|
|
$(MAKE) all
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# "make clang" = incremental build; "make clang redo" = full clean rebuild
|
|
|
|
|
clang :
|
|
|
|
|
$(MAKE) $(or $(filter-out clang,$(MAKECMDGOALS)),all) COMPILER=clang
|
|
|
|
|
|
|
|
|
|
# Include generated dependency files (if they exist)
|
|
|
|
|
-include $(DEPFILES)
|