2026-07-18 18:48:23 +02:00
|
|
|
# Klammertext sks/ Makefile
|
2026-09-25 18:43:22 +02:00
|
|
|
# Builds all the DSOs (document$(DSO): .so, on Windows .dll) in sks/
|
|
|
|
|
# subdirectories
|
2026-07-18 18:48:23 +02:00
|
|
|
|
|
|
|
|
K := $(KLAMMERTEXT_HOME)
|
|
|
|
|
KS := $(K)/sks
|
|
|
|
|
KM := $(K)/mac
|
|
|
|
|
|
2026-09-25 18:43:22 +02:00
|
|
|
include $(K)/env/makefile.env
|
|
|
|
|
|
|
|
|
|
# Shared library that all the DSOs depend on
|
|
|
|
|
LIBRARY := $(K)/lib/$(KLAMMERTEXT_LIBFILE)
|
2026-07-18 18:48:23 +02:00
|
|
|
|
|
|
|
|
# Support directories (build .o files used by other sks/ components)
|
|
|
|
|
SUPPORT_DIRS := kutil target
|
|
|
|
|
|
|
|
|
|
# Excluded directories:
|
2026-09-25 18:43:22 +02:00
|
|
|
# kutil, target - support directories that build .o files, not a DSO
|
|
|
|
|
# book, phase - obsolete, not updated for the shared library
|
2026-07-18 18:48:23 +02:00
|
|
|
|
2026-09-25 18:43:22 +02:00
|
|
|
# Directories that build a DSO (excluding support and obsolete directories):
|
|
|
|
|
# every subdirectory whose Makefile names its product with makefile.env's
|
|
|
|
|
# $(DSO) suffix ("document$(DSO) :", "all : document$(DSO)").
|
2026-07-18 18:48:23 +02:00
|
|
|
SO_DIRS := $(shell for dir in $(KS)/*/; do \
|
2026-09-25 18:43:22 +02:00
|
|
|
if [ -f "$${dir}Makefile" ] && grep -qE '\$$\(DSO\)' "$${dir}Makefile" 2>/dev/null; then \
|
2026-07-18 18:48:23 +02:00
|
|
|
basename "$$dir"; \
|
|
|
|
|
fi; done | grep -v -E '^(kutil|target|book|phase)$$')
|
|
|
|
|
|
|
|
|
|
.PHONY: all clean support $(SUPPORT_DIRS) $(SO_DIRS)
|
|
|
|
|
|
2026-09-25 18:43:22 +02:00
|
|
|
# Default target: build support first, then every DSO
|
2026-07-18 18:48:23 +02:00
|
|
|
all : support $(SO_DIRS)
|
|
|
|
|
|
|
|
|
|
# Build support directories
|
|
|
|
|
support : $(SUPPORT_DIRS)
|
|
|
|
|
|
|
|
|
|
kutil :
|
|
|
|
|
$(MAKE) -j -C $(KS)/kutil
|
|
|
|
|
|
|
|
|
|
target : kutil
|
|
|
|
|
$(MAKE) -j -C $(KS)/target
|
|
|
|
|
|
2026-09-25 18:43:22 +02:00
|
|
|
# Pattern rule for the DSO directories
|
2026-07-18 18:48:23 +02:00
|
|
|
# Each depends on the library and support directories
|
|
|
|
|
$(SO_DIRS) : support $(LIBRARY)
|
|
|
|
|
$(MAKE) -j -C $(KS)/$@
|
|
|
|
|
|
|
|
|
|
# Clean all subdirectories
|
|
|
|
|
clean :
|
|
|
|
|
@for dir in $(SUPPORT_DIRS) $(SO_DIRS); do \
|
|
|
|
|
echo "Cleaning $$dir..."; \
|
|
|
|
|
$(MAKE) -C $(KS)/$$dir clean; \
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Rebuild everything
|
|
|
|
|
redo : clean all
|