PKG_CFLAGS = -pthread
PKG_LIBS = -pthread

# The R-side sources (including the first-class view layer: view.o and
# serialize.o) plus the vendored libmizu core (the transport + region layer).
# Vendored files come from tools/vendor-libmizu.sh — never edited in place.
OBJECTS = arrow.o bounded.o codec.o condition.o entity.o init.o interop.o liveness.o map.o \
          notify_r.o payload.o preamble.o rng.o serialize.o stage_r.o verbs.o \
          verbs_channel.o verbs_pool.o view.o wrap.o zc.o \
          vendor/libmizu/api.o vendor/libmizu/arrow.o \
          vendor/libmizu/channel.o vendor/libmizu/interop.o \
          vendor/libmizu/morsel.o vendor/libmizu/notify.o vendor/libmizu/stage_raw.o \
          vendor/libmizu/err.o vendor/libmizu/err_tls.o \
          vendor/libmizu/liveness.o \
          vendor/libmizu/parker.o vendor/libmizu/pool.o vendor/libmizu/preamble.o \
          vendor/libmizu/rng_jump.o vendor/libmizu/shm.o vendor/libmizu/shm_rw.o \
          vendor/libmizu/spill.o vendor/libmizu/tune.o vendor/libmizu/wait_linux.o \
          vendor/libmizu/wait_macos.o vendor/libmizu/wait_win32.o

.PHONY: all clean

all: $(SHLIB)

# R's makefiles track no header dependencies: without this, editing a header
# recompiles nothing and one mizu.so links objects built from two headers.
$(OBJECTS): mizu.h arrow.h view.h vendor/libmizu/mizu.h vendor/libmizu/mizu_ext.h \
            vendor/libmizu/internal.h

clean:
	@rm -f $(OBJECTS) $(SHLIB)
