- 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>
70 lines
2.3 KiB
Makefile
70 lines
2.3 KiB
Makefile
# kpy/ -- the Python binding of the Klammermachine.
|
|
#
|
|
# klammertext.cpp is a CPython extension module (see its header comment).
|
|
# Like ref/reflect$(DSO) and sks/document/document$(DSO) it links against
|
|
# the shared library and shares the engine's class layouts, so it is rebuilt
|
|
# whenever they are (mac/Makefile's "all" runs "make -C kpy"; com/Makefile's
|
|
# "redo" and dev/rebuild.sh clean it -- a clean that misses a directory is a
|
|
# mixed-object hazard, not a tidiness one).
|
|
#
|
|
# The module's filename carries the interpreter's ABI tag
|
|
# (klammertext.cpython-3XX-<arch>.so) from python3-config, the same tool
|
|
# makefile.env takes the include and link flags from: the module is bound to
|
|
# the ONE Python the library was built against, by decision. The library
|
|
# already links that libpython, so the link line is the commands' link line
|
|
# with $(SHARED) in place of $(EXPORT_DYNAMIC).
|
|
|
|
K := $(KLAMMERTEXT_HOME)
|
|
|
|
include $(K)/env/makefile.env
|
|
|
|
# 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)
|
|
|
|
EXT_SUFFIX := $(shell $(PYTHON) -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')
|
|
MODULE := klammertext$(EXT_SUFFIX)
|
|
|
|
# "../lib": the module sits in $(K)/kpy, one level below $(K).
|
|
KPY_LDFLAGS := $(SHARED) -Wl,-rpath,'$(ORIGIN)/../lib' -L$(LIBDIR)
|
|
|
|
OBJECTS := klammertext.o
|
|
DEPFILES := $(OBJECTS:.o=.d)
|
|
|
|
DEPFLAGS = -MMD -MP -MF $(@:.o=.d)
|
|
|
|
.PHONY: all clean
|
|
|
|
# Windows: the module's dependent DLLs sit beside it (Python loads an
|
|
# extension's dependencies from the extension's own directory, never from
|
|
# PATH or an rpath -- there is none on PE); see makefile.env.
|
|
ifneq (,$(filter MINGW% MSYS%,$(UNAME_S)))
|
|
BESIDE_DLLS := $(KLAMMERTEXT_LIBFILE) $(GCC_RUNTIME_DLLS)
|
|
else
|
|
BESIDE_DLLS :=
|
|
endif
|
|
|
|
all : $(MODULE) $(BESIDE_DLLS)
|
|
|
|
%.o : %.cpp
|
|
@echo Compiling $<
|
|
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $< -o $@
|
|
|
|
$(MODULE) : $(OBJECTS) $(LIBRARY)
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(KPY_LDFLAGS) $(LDFLAGS) \
|
|
-o $@ $(OBJECTS) $(KLAMMERTEXT_LIB) $(LDLIBS)
|
|
|
|
ifneq (,$(filter MINGW% MSYS%,$(UNAME_S)))
|
|
$(KLAMMERTEXT_LIBFILE) : $(LIBRARY)
|
|
cp $< $@
|
|
%.dll : $(GCC_BIN)%.dll
|
|
cp $< $@
|
|
endif
|
|
|
|
clean :
|
|
rm -f $(OBJECTS) $(DEPFILES) klammertext.*.so klammertext.*.pyd *.dll *~
|
|
rm -rf __pycache__
|
|
|
|
-include $(DEPFILES)
|