Files
klammertext/ref/Makefile
T
ack ee8bcf5300 Windows: product names, the editors, WSL; the Linux page's image step
Assembled from development commit c3c40f6c8fca. Since 830b193: on Windows the
products carry Windows names (ktext.exe, klammertext.dll, document.dll,
reflect.dll) and the console's output code page is UTF-8 for a run; the
editor tooling works on Windows (VS Code, Sublime Text, Vim, with the
interpreter's name chosen by platform) and Notepad++ joins it
(doc/edit/notepadpp: a User Defined Language and two Run-menu commands);
a sixth install page, doc/install/windows_wsl_install.md, for Linux
inside WSL; the Windows page opens with the three routes and gains its
editor section, the PowerShell quoting and Path notes; the Linux page
installs OpenImageIO from the python3-openimageio package and verifies
with kdiag --machine; the README lists all six install pages. Linux and
macOS behaviour is unchanged.
2026-09-25 18:43:22 +02:00

59 lines
2.2 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 the shared library: reflect.so, on
# Windows reflect.dll (makefile.env's DSO).
#
# 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)/$(KLAMMERTEXT_LIBFILE)
REFLECT := reflect$(DSO)
# "../lib", not "../../lib": the DSO sits in $(K)/ref, so one level up
# reaches $(K)/lib. (sks/document's 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)
%.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) : $(OBJECTS) $(LIBRARY)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(REF_LDFLAGS) $(LDFLAGS) \
-o $@ $(OBJECTS) $(KLAMMERTEXT_LIB) $(LDLIBS)
clean :
rm -f $(OBJECTS) $(DEPFILES) *.so *.dll *~
-include $(DEPFILES)