Files
klammertext/ref/Makefile
T
ack fe475e774a Klammertext runs natively on Windows; a Windows source-install guide; the bundled sh for @eval :shell
Assembled from klammertext-dev f344a37d0f6e. The commands, the library,
the Standard Klammer Set, the reflection klammerset and the Python
binding build and run natively on Windows (MSYS2 UCRT64 gcc, python.org
Python), and both test tiers pass there. doc/install/windows_source_install.md
is the fifth install guide: a source install parallel to the Linux and
macOS ones, verified by following it on a pristine Windows 11.

Behaviour on every system: paths Klammertext prints use forward slashes;
output is LF; the command line is UTF-8 on Windows; @eval :shell is a
POSIX shell command everywhere -- on Windows it runs the sh Klammertext
ships, BusyBox for Windows (win/busybox/, GPLv2, with its licence and the
source pointer). KLAMMERTEXT_FONTS and KLAMMERTEXT_KLAMMERSETS are lists in
the system's PATH convention (';' on Windows). On Linux and macOS nothing
observable changes.
2026-09-25 00:32:55 +02:00

57 lines
2.1 KiB
Makefile

# ref/ -- the reflection library.
#
# reflect.cpp holds C++ functions that read the engine's OWN registries and
# character tables and return Klammertext (a "@table" call and such), which
# the .kt fragments in this directory then render for whichever target is
# in force. They are reached through "@eval :cpp", so this builds a DSO
# loaded at run time, not part of libklammertext.so.
#
# Adapted from sks/document/Makefile. Two things differ and both matter:
# ref/ has no sks dependencies (a generator returns Klammertext, so it
# needs none of kutil/target's markup helpers), and it sits ONE level below
# $(KLAMMERTEXT_HOME) rather than two, which changes the rpath.
K := $(KLAMMERTEXT_HOME)
include $(K)/env/makefile.env
# CPPFLAGS already carries -I$(KLAMMERTEXT_HOME)/mac, which is every header
# reflect.cpp includes (machine, character, error, show). No local -I.
LIBDIR := $(K)/lib
LIBRARY := $(LIBDIR)/libklammertext.so
# "../lib", not "../../lib": reflect.so sits in $(K)/ref, so one level up
# reaches $(K)/lib. (sks/document.so needs two, which is what this was
# copied from -- a wrong rpath here shows up only at dlopen time, and only
# where the loading process does not already have the library.)
REF_LDFLAGS := $(SHARED) $(EXPORT_DYNAMIC) -Wl,-rpath,'$(ORIGIN)/../lib' -L$(LIBDIR)
OBJECTS := reflect.o
DEPFILES := $(OBJECTS:.o=.d)
DEPFLAGS = -MMD -MP -MF $(@:.o=.d)
.PHONY: all clean
all : reflect.so
%.o : %.cpp
@echo Compiling $<
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $< -o $@
# The objects are LINKED here, never recompiled. sks/document/Makefile
# names document.cpp on its link line as well, which is correct THERE only
# because document.o is the one object not in its LOCAL_OBJECTS; doing both
# for the same file -- compiling reflect.cpp inline AND linking reflect.o --
# defines every symbol in it twice. Building through the pattern rule also
# gets reflect.d, so a header change rebuilds it.
reflect.so : $(OBJECTS) $(LIBRARY)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(REF_LDFLAGS) $(LDFLAGS) \
-o $@ $(OBJECTS) $(KLAMMERTEXT_LIB) $(LDLIBS)
clean :
rm -f $(OBJECTS) $(DEPFILES) *.so *~
-include $(DEPFILES)