A character written in the ^...^ mnemonic form -- ^oe^, ^zz^, ^hello^ --
used to kill ktext outright: no message, no output, and an exit status
that looked like a crash because it was one. Only the forms that happen
to spell hexadecimal digits escaped, and they were right by luck rather
than by reading. Any caret form that names no character is now a located
error that quotes what was written.
A klammer may now sit inside square brackets and braces as it already
could inside parentheses, and may be followed by the punctuation that
ends a sentence: [@i word@], {@b word@}, @i word@'s. The rule is a fixed
list of characters, because none of them can occur inside a klammer name
and so none of them is ambiguous next to a delimiter. A letter still
cannot: "x@" is the named closing delimiter, so a letter before "@" has
two readings and no rule can separate them.
The abbreviations an author writes -- the hyphen form @i-word, a klammer
glued to its neighbouring punctuation -- are now recognised as author
conveniences only. They are not applied to @@ definitions or @@@ system
commands, which are written by someone who needs no such shorthand and
whose forms are already whole.
Also fixed, each of them silent: an exported shell function in the
environment broke every @eval in the document; a line break written with
@nl was destroyed when it passed through a klammer that generates a
table, printing as \textbackslash{}newline in the finished PDF; and
"kdesc --coverage" shortened its file column by comparing the spelling of
a path rather than the path, so a klammer set reached by a symbolic link
showed a full path where its neighbours showed a short one.
New in the distribution: ref/, a small klammerset that describes the
Klammermachine's own tables in Klammertext. It currently provides the
character tables -- the diacritics and the extended Latin letters -- as
klammers that render to any target, so the documentation of what can be
written cannot drift from what the machine accepts. It is early, and
will grow.
The Klammertext taxonomy now has a section on targets, describes the
@@@klammerset system command alongside the other three, and states the
precedence of "^" -- what a caret means before a letter, a digit, a
punctuation character, and a quote, in one ordered list.
(from dev 6594c7ff8c1f)
109 lines
3.4 KiB
Makefile
109 lines
3.4 KiB
Makefile
# Klammertext com/ Makefile
|
|
# Improved version with automatic header dependency tracking
|
|
|
|
K := $(KLAMMERTEXT_HOME)
|
|
KS := $(K)/sks
|
|
KM := $(K)/mac
|
|
|
|
include $(K)/env/makefile.env
|
|
|
|
# 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. The commands are
|
|
# three independent links against the finished library, so they run in
|
|
# parallel (as mac/ and the sks/ components already do) rather than one after
|
|
# another -- the serial links were about a quarter of a clean rebuild.
|
|
all : | mac sks
|
|
$(MAKE) -j 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
|
|
# ref/reflect.so links against libklammertext.so and is dlopened, so
|
|
# it shares the class layouts: a stale one after a header change is
|
|
# the same memory-corruption hazard as a stale sks/document.so.
|
|
$(MAKE) -C $(K)/ref 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)
|