Assembled from klammertext-dev f344a37d772c. 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.
68 lines
2.2 KiB
Makefile
68 lines
2.2 KiB
Makefile
# kpy/ -- the Python binding of the Klammermachine.
|
|
#
|
|
# klammertext.cpp is a CPython extension module (see its header comment).
|
|
# Like ref/reflect.so and sks/document/document.so it links against
|
|
# libklammertext.so 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
|
|
|
|
LIBDIR := $(K)/lib
|
|
LIBRARY := $(LIBDIR)/libklammertext.so
|
|
|
|
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 := libklammertext.so $(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)))
|
|
libklammertext.so : $(LIBRARY)
|
|
cp $< $@
|
|
%.dll : $(GCC_BIN)%.dll
|
|
cp $< $@
|
|
endif
|
|
|
|
clean :
|
|
rm -f $(OBJECTS) $(DEPFILES) klammertext.*.so klammertext.*.pyd libklammertext.so *.dll *~
|
|
rm -rf __pycache__
|
|
|
|
-include $(DEPFILES)
|