Files
klammertext/sks/document/Makefile
T
ackandClaude Fable 5.1 715d939727 What a Windows editor saves, and a standard user's Windows install (from dev 9d6f66456a3d)
- CRLF line endings are read as newlines on every system (the reader used
  to delete the pair, collapsing a Notepad++ file into one line on Linux
  and macOS); a leading UTF-8 byte-order mark is ignored; a UTF-16 or
  Windows-1252 source is refused with the encoding, the place and the
  remedy named. .gitattributes pins LF in every clone.
- Windows source install: the repository path must hold no space (GNU
  Make), accented letters are fine (every linker input is relative now);
  python.org's Python is selected ahead of an MSYS2 one that poppler pulls
  in; TeX Live goes to its Windows default C:\texlive\2026.
- The Python binding needs an ASCII installation path on Windows, and its
  suite says so there.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:17:59 +02:00

66 lines
2.1 KiB
Makefile

# Klammertext sks/document/ Makefile
# Improved version with automatic header dependency tracking
K := $(KLAMMERTEXT_HOME)
KS := $(K)/sks
KM := $(K)/mac
include $(K)/env/makefile.env
# Additional include paths for sks components
LOCAL_CPPFLAGS := -I$(KM) -I$(KS)/kutil -I$(KS)/target
# Shared library location
# Relative, never $(K)/...: the mingw linker cannot open a path holding a
# non-ASCII letter (C:/Übungen/...), while the compiler can (2026-09-26).
LIBDIR := ../../lib
LIBRARY := $(LIBDIR)/$(KLAMMERTEXT_LIBFILE)
# The product: document.so, on Windows document.dll (makefile.env's DSO)
DOCUMENT := document$(DSO)
# Linker flags for the DSO
DOC_LDFLAGS := $(SHARED) $(EXPORT_DYNAMIC) -Wl,-rpath,'$(ORIGIN)/../../lib' -L$(LIBDIR)
# Local object files
LOCAL_OBJECTS := document_class.o document_html.o document_latex.o heading.o reference.o
LOCAL_DEPFILES := document_class.d document_html.d document_latex.d heading.d reference.d document.d
# External object files from sks/ (mac/*.o now in the shared library)
SKS_OBJECTS := ../kutil/kutil.o ../kutil/klammer_base.o \
../target/html_util.o ../target/latex_util.o
ALL_OBJECTS := $(LOCAL_OBJECTS) $(SKS_OBJECTS)
# Compiler flags for dependency generation
DEPFLAGS = -MMD -MP -MF $(@:.o=.d)
.PHONY: all clean deps
# Default target
all : $(DOCUMENT)
# Build external dependencies first
deps :
$(MAKE) -C $(KS)/kutil
$(MAKE) -C $(KS)/target
# Pattern rule for object files
%.o : %.cpp
@echo Compiling $<
$(CXX) -c $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $< -o $@
# Shared object - link against the library
$(DOCUMENT) : $(LOCAL_OBJECTS) $(SKS_OBJECTS) $(LIBRARY) document.cpp | deps
$(CXX) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CXXFLAGS) $(DOC_LDFLAGS) $(LDFLAGS) \
document.cpp -o $@ $(ALL_OBJECTS) $(KLAMMERTEXT_LIB) $(LDLIBS)
clean :
rm -f $(LOCAL_OBJECTS) $(LOCAL_DEPFILES) *.so *.dll *~
# document_txt.py is imported at render time (2026-09-18), so this
# directory now exists here; rm -f refused it and failed every clean.
rm -rf __pycache__
# Include generated dependency files (if they exist)
-include $(LOCAL_DEPFILES)