<commit_before># Makefile for the yeast build system

# TODO: Confirm we are using a sufficient version of GNU make

#
# Determine where yeast is installed
#

YEAST.MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
YEAST.HOME := $(dir $(YEAST.MAKEFILE))

#
# Include toolchain definitions
#

define Yeast.tool.help

Toolchain Settings
==================

Toolchain and target architecture settings are configured using the following options.

	YEAST.TOOL=$(YEAST.TOOL)
	YEAST.ARCH=$(YEAST.ARCH)

endef

# TODO: ARCH should really be a tool-specific setting

ifdef YEAST.TOOL
include $(YEAST.HOME)/toolchains/$(YEAST.TOOL).mk
YEAST.ARCH_TOOL.NAME = $(addprefix $(addsuffix .,$(YEAST.ARCH)),$(YEAST.TOOL))
else
include $(YEAST.HOME)/toolchains/default.mk
YEAST.ARCH_TOOL.NAME = $(YEAST.ARCH)
endif

#
# Define build tree structure
#

define Yeast.path.help

Path Settings
=============

A number of configuration variables exist for customizing the build paths used
to store object and product files.

	## Location where yeast is installed
	YEAST.HOME=$(YEAST.HOME)

	## Root directory of generated build tree
	YEAST.BUILD.TREE=$(YEAST.BUILD.TREE)

	## Root directory of generated object files
	YEAST.OBJECT.PATH=$(YEAST.OBJECT.PATH)

	YEAST.EXECUTABLE.PATH=$(YEAST.EXECUTABLE.PATH)

	YEAST.STATIC_LIB.PATH=$(YEAST.STATIC_LIB.PATH)

endef

YEAST.BUILD.TREE ?= yeast.build

ifneq ($(strip $(YEAST.BUILD.TREE)),)
YEAST.OBJECT.PATH = $(YEAST.BUILD.TREE)/obj/$(YEAST.ARCH_TOOL.NAME)/
YEAST.EXECUTABLE.PATH = $(YEAST.BUILD.TREE)/bin/$(YEAST.ARCH_TOOL.NAME)/
YEAST.STATIC_LIB.PATH = $(YEAST.BUILD.TREE)/lib/$(YEAST.ARCH_TOOL.NAME)/
YEAST.SPORE.SUFFIX = $(addprefix .,$(YEAST.ARCH_TOOL.NAME)).spore
YEAST.SPORE.PATH = $(YEAST.BUILD.TREE)/
else
YEAST.SPORE.SUFFIX = .spore
endif

#
# Top-level phony targets
#

.PHONY: all clean

all: $(YEAST.SPORES)
clean: $(addsuffix _clean, $(YEAST.SPORES))

#
# Create spore definitions
#

define YEAST_SPORE_RULES

.PHONY: $1
.PHONY: $1_clean

$1.name ?= $1
$1.spore = $(YEAST.SPORE.PATH).$$($1.name)$(YEAST.SPORE.SUFFIX)

$1.object = $$(addsuffix $(TOOL.OBJECT.SUFFIX), $$(basename $$($1.source)))
$1.object := $$(addprefix $(YEAST.OBJECT.PATH), $$($1.object))

$1.depend = $$(addsuffix $(TOOL.DEPEND.SUFFIX), $$(basename $$($1.source)))
$1.depend := $$(addprefix $(YEAST.OBJECT.PATH), $$($1.depend))

.PRECIOUS: $$($1.object)

$1.path.object = $$(sort $$(dir $$($1.object)))

$$($1.object): | $$($1.path.object)

YEAST.OBJECT.DIRS += $$($1.path.object)

$1: $$($1.spore)

$$($1.spore):
	touch $$@

$1_clean:
	rm -f $$($1.products) $$($1.object) $$($1.spore)

-include $$($1.depend)

endef

$(foreach t, $(YEAST.SPORES), $(eval $(call YEAST_SPORE_RULES,$t)))

#
# Create build tree structure
#

$(YEAST.EXECUTABLE.PATH) $(YEAST.STATIC_LIB.PATH):
	mkdir -p $@


$(sort $(YEAST.OBJECT.PATH) $(YEAST.OBJECT.DIRS)):
	mkdir -p $@

#
# Include source language-specific rules
#

include $(YEAST.HOME)/languages/*.mk

#
# Include build product-specific rules
#

include $(YEAST.HOME)/products/*.mk

#<commit_msg>Use spore touch files as containers for generated dependencies<commit_after># Makefile for the yeast build system

# TODO: Confirm we are using a sufficient version of GNU make

#
# Determine where yeast is installed
#

YEAST.MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
YEAST.HOME := $(dir $(YEAST.MAKEFILE))

#
# Include toolchain definitions
#

define Yeast.tool.help

Toolchain Settings
==================

Toolchain and target architecture settings are configured using the following options.

	YEAST.TOOL=$(YEAST.TOOL)
	YEAST.ARCH=$(YEAST.ARCH)

endef

# TODO: ARCH should really be a tool-specific setting

ifdef YEAST.TOOL
include $(YEAST.HOME)/toolchains/$(YEAST.TOOL).mk
YEAST.ARCH_TOOL.NAME = $(addprefix $(addsuffix .,$(YEAST.ARCH)),$(YEAST.TOOL))
else
include $(YEAST.HOME)/toolchains/default.mk
YEAST.ARCH_TOOL.NAME = $(YEAST.ARCH)
endif

#
# Define build tree structure
#

define Yeast.path.help

Path Settings
=============

A number of configuration variables exist for customizing the build paths used
to store object and product files.

	## Location where yeast is installed
	YEAST.HOME=$(YEAST.HOME)

	## Root directory of generated build tree
	YEAST.BUILD.TREE=$(YEAST.BUILD.TREE)

	## Root directory of generated object files
	YEAST.OBJECT.PATH=$(YEAST.OBJECT.PATH)

	YEAST.EXECUTABLE.PATH=$(YEAST.EXECUTABLE.PATH)

	YEAST.STATIC_LIB.PATH=$(YEAST.STATIC_LIB.PATH)

endef

YEAST.BUILD.TREE ?= yeast.build

ifneq ($(strip $(YEAST.BUILD.TREE)),)
YEAST.OBJECT.PATH = $(YEAST.BUILD.TREE)/obj/$(YEAST.ARCH_TOOL.NAME)/
YEAST.EXECUTABLE.PATH = $(YEAST.BUILD.TREE)/bin/$(YEAST.ARCH_TOOL.NAME)/
YEAST.STATIC_LIB.PATH = $(YEAST.BUILD.TREE)/lib/$(YEAST.ARCH_TOOL.NAME)/
YEAST.SPORE.SUFFIX = $(addprefix .,$(YEAST.ARCH_TOOL.NAME)).spore
YEAST.SPORE.PATH = $(YEAST.BUILD.TREE)/
else
YEAST.SPORE.SUFFIX = .spore
endif

#
# Top-level phony targets
#

.PHONY: all clean

all: $(YEAST.SPORES)
clean: $(addsuffix _clean, $(YEAST.SPORES))

#
# Create spore definitions
#

define YEAST_SPORE_RULES

.PHONY: $1
.PHONY: $1_clean

$1.name ?= $1
$1.spore = $(YEAST.SPORE.PATH).$$($1.name)$(YEAST.SPORE.SUFFIX)

$1.object = $$(addsuffix $(TOOL.OBJECT.SUFFIX), $$(basename $$($1.source)))
$1.object := $$(addprefix $(YEAST.OBJECT.PATH), $$($1.object))

$1.depend = $$(addsuffix $(TOOL.DEPEND.SUFFIX), $$(basename $$($1.source)))
$1.depend := $$(addprefix $(YEAST.OBJECT.PATH), $$($1.depend))

.PRECIOUS: $$($1.object)

$1.path.object = $$(sort $$(dir $$($1.object)))

$$($1.object): | $$($1.path.object)

YEAST.OBJECT.DIRS += $$($1.path.object)

$1: $$($1.spore)

$$($1.spore): $$($1.object)
	cat $$($1.depend) > $$@

$1_clean:
	rm -f $$($1.products) $$($1.object) $$($1.spore)

-include $$($1.spore)

endef

$(foreach t, $(YEAST.SPORES), $(eval $(call YEAST_SPORE_RULES,$t)))


#
# Create build tree structure
#

$(YEAST.EXECUTABLE.PATH) $(YEAST.STATIC_LIB.PATH):
	mkdir -p $@


$(sort $(YEAST.OBJECT.PATH) $(YEAST.OBJECT.DIRS)):
	mkdir -p $@

#
# Include source language-specific rules
#

include $(YEAST.HOME)/languages/*.mk

#
# Include build product-specific rules
#

include $(YEAST.HOME)/products/*.mk

#
{'fraction_non_alphanumeric': 0.1920637502032851, 'fraction_numerical': 0.0094324280370792, 'mean_word_length': 4.774647887323944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4748697', 'n_tokens_mistral': 2519, 'n_tokens_neox': 2295, 'n_words': 488}