# Released under the MIT License. See LICENSE for details.


all: sources

PROJ_DIR = ../..
TOOLS_DIR = $(PROJ_DIR)/tools
PROJ_SRC_DIR = $(PROJ_DIR)/src

PCOMMAND = $(TOOLS_DIR)/pcommand

# Blow away 'mgen' dirs in Python, C++, and meta-source dirs. We use wildcards
# here instead of using our exact feature-set list so that we clean out
# orphaned generated files from featuresets that have since been removed or
# renamed; otherwise those files can hang around and break builds.
clean:
	rm -rf $(PROJ_SRC_DIR)/ballistica/*/mgen
	rm -rf $(PROJ_SRC_DIR)/meta/*/mgen
	rm -rf $(PROJ_SRC_DIR)/assets/ba_data/python/*/_mgen

# This section is generated by batools.metamakefile; do not edit by hand.
# __AUTOGENERATED_PUBLIC_BEGIN__

sources: \
  $(PROJ_SRC_DIR)/assets/ba_data/python/babase/_mgen/__init__.py \
  $(PROJ_SRC_DIR)/assets/ba_data/python/babase/_mgen/enums.py \
  $(PROJ_SRC_DIR)/ballistica/base/mgen/pyembed/binding_base.inc \
  $(PROJ_SRC_DIR)/ballistica/classic/mgen/pyembed/binding_classic.inc \
  $(PROJ_SRC_DIR)/ballistica/core/mgen/pyembed/binding_core.inc \
  $(PROJ_SRC_DIR)/ballistica/core/mgen/pyembed/env.inc \
  $(PROJ_SRC_DIR)/ballistica/core/mgen/python_modules_monolithic.h \
  $(PROJ_SRC_DIR)/ballistica/scene_v1/mgen/pyembed/binding_scene_v1.inc \
  $(PROJ_SRC_DIR)/ballistica/template_fs/mgen/pyembed/binding_template_fs.inc \
  $(PROJ_SRC_DIR)/ballistica/ui_v1/mgen/pyembed/binding_ui_v1.inc

$(PROJ_SRC_DIR)/ballistica/core/mgen/python_modules_monolithic.h : $(PROJ_DIR)/config/featuresets/featureset_base.py $(PROJ_DIR)/config/featuresets/featureset_classic.py $(PROJ_DIR)/config/featuresets/featureset_core.py $(PROJ_DIR)/config/featuresets/featureset_plus.py $(PROJ_DIR)/config/featuresets/featureset_scene_v1.py $(PROJ_DIR)/config/featuresets/featureset_template_fs.py $(PROJ_DIR)/config/featuresets/featureset_ui_v1.py
	@$(PCOMMAND) gen_monolithic_register_modules $@

$(PROJ_SRC_DIR)/ballistica/base/mgen/pyembed/binding_base.inc : babasemeta/pyembed/binding_base.py
	@$(PCOMMAND) gen_binding_code $< $@

$(PROJ_SRC_DIR)/ballistica/classic/mgen/pyembed/binding_classic.inc : baclassicmeta/pyembed/binding_classic.py
	@$(PCOMMAND) gen_binding_code $< $@

$(PROJ_SRC_DIR)/ballistica/core/mgen/pyembed/binding_core.inc : bacoremeta/pyembed/binding_core.py
	@$(PCOMMAND) gen_binding_code $< $@

$(PROJ_SRC_DIR)/ballistica/core/mgen/pyembed/env.inc : bacoremeta/pyembed/env.py
	@$(PCOMMAND) gen_flat_data_code $< $@ env_code

$(PROJ_SRC_DIR)/ballistica/scene_v1/mgen/pyembed/binding_scene_v1.inc : bascenev1meta/pyembed/binding_scene_v1.py
	@$(PCOMMAND) gen_binding_code $< $@

$(PROJ_SRC_DIR)/ballistica/template_fs/mgen/pyembed/binding_template_fs.inc : batemplatefsmeta/pyembed/binding_template_fs.py
	@$(PCOMMAND) gen_binding_code $< $@

$(PROJ_SRC_DIR)/ballistica/ui_v1/mgen/pyembed/binding_ui_v1.inc : bauiv1meta/pyembed/binding_ui_v1.py
	@$(PCOMMAND) gen_binding_code $< $@

$(PROJ_SRC_DIR)/assets/ba_data/python/babase/_mgen/__init__.py : $(TOOLS_DIR)/batools/pcommand.py
	@$(PCOMMAND) gen_python_init_module $@

$(PROJ_SRC_DIR)/assets/ba_data/python/babase/_mgen/enums.py : $(PROJ_DIR)/src/ballistica/shared/foundation/types.h $(TOOLS_DIR)/batools/pythonenumsmodule.py
	@$(PCOMMAND) gen_python_enums_module $< $@

# __AUTOGENERATED_PUBLIC_END__

# This section is generated by batools.metamakefile; do not edit by hand.
# __AUTOGENERATED_PRIVATE_BEGIN__

# Note: we include our public targets in efrocache even
# though they are buildable in public. This allows us to
# fetch them to bootstrap binary builds in cases where
# we can't use our full Makefiles (like Windows CI).

efrocache-list:
	@echo "$(PROJ_SRC_DIR)/assets/ba_data/python/babase/_mgen/__init__.py" \
        "$(PROJ_SRC_DIR)/assets/ba_data/python/babase/_mgen/enums.py" \
        "$(PROJ_SRC_DIR)/ballistica/base/mgen/pyembed/binding_base.inc" \
        "$(PROJ_SRC_DIR)/ballistica/classic/mgen/pyembed/binding_classic.inc" \
        "$(PROJ_SRC_DIR)/ballistica/core/mgen/pyembed/binding_core.inc" \
        "$(PROJ_SRC_DIR)/ballistica/core/mgen/pyembed/env.inc" \
        "$(PROJ_SRC_DIR)/ballistica/core/mgen/python_modules_monolithic.h" \
        "$(PROJ_SRC_DIR)/ballistica/scene_v1/mgen/pyembed/binding_scene_v1.inc" \
        "$(PROJ_SRC_DIR)/ballistica/template_fs/mgen/pyembed/binding_template_fs.inc" \
        "$(PROJ_SRC_DIR)/ballistica/ui_v1/mgen/pyembed/binding_ui_v1.inc"

efrocache-build: sources

# __AUTOGENERATED_PRIVATE_END__
