#!/do/not/make # to help out emacs
# To be included from subdir GNU Makefiles.
TOP_DIR := $(patsubst %/,%,$(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))))
#$(error TOP_DIR=$(TOP_DIR))
include $(TOP_DIR)/config.make
include $(TOP_DIR)/shakenmake.make

########################################################################
# These amalgamation-related targets are used by client binaries which
# link to libfossil.o (amalgamation) instead of libfossil.so/a.
ifeq (,$(wildcard fsl.c))
# ^^^^ don't include these rules in the main lib dir
LIBF_O := $(TOP_DIR)/libfossil.o
SQLITE3_O := $(TOP_DIR)/src/sqlite3.o
$(TOP_DIR)/libfossil.h: $(TOP_DIR)/libfossil-config.h $(wildcard $(TOP_DIR)/include/fossil-scm/*.h)
$(TOP_DIR)/libfossil.c: $(TOP_DIR)/libfossil.h $(wildcard $(TOP_DIR)/src/*.c)
$(LIBF_O): $(TOP_DIR)/libfossil.c
$(LIBF_O) $(TOP_DIR)/libfossil.h $(TOP_DIR)/libfossil-config.h:
	$(MAKE) -C $(TOP_DIR) amal
$(SQLITE3_O):
	$(MAKE) -C $(TOP_DIR)/src $@
# Client .o files should have these as deps:
LIBF_STATIC_CLIENT_OBJ_DEPS := $(LIBF_O) $(SQLITE3_O)
# Client .o files should link with:
LIBF_STATIC_CLIENT_LDFLAGS := $(LIBF_O) $(SQLITE3_O) -lz -lm
endif
