# Klammertext sks/kutil/ Makefile
# Improved version with automatic header dependency tracking

K := $(KLAMMERTEXT_HOME)
KM := $(K)/mac

include $(KM)/env/makefile.env

# Source files
SOURCES := kutil.cpp klammer_base.cpp
OBJECTS := kutil.o klammer_base.o
DEPFILES := kutil.d klammer_base.d

# Additional include paths
LOCAL_CPPFLAGS := -I$(KM)

# Compiler flags for dependency generation
DEPFLAGS = -MMD -MP -MF $(@:.o=.d)

.PHONY: all clean

# Default target
all : $(OBJECTS)

# Pattern rule for object files
%.o : %.cpp
	$(CXX) -c $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CXXFLAGS) $(DEPFLAGS) $< -o $@

clean :
	rm -f $(OBJECTS) $(DEPFILES) *.so *~

# Include generated dependency files (if they exist)
-include $(DEPFILES)
