<commit_before>include ../../Makefile.defs

ifeq ($(CILIUM_VERSION),)
    CILIUM_VERSION = "$(shell cat ../../VERSION)"
endif

K8S_VERSIONS = 1.7 1.8 1.9 1.10 1.11

# make_concat creates a concatenated YAML file specific for a K8s version.
# $(1) is the K8s version. $(2) is the concatenated file.
define make_concat
all: $(1)/$(2)
$(1)/$(2):
	@$(ECHO_GEN)$$@
	-$(QUIET)for f in $$^ ; do cat "$$$${f}"; echo "---" ; done >$$@
endef

# make_yaml creates a YAML specific for a K8s version.
# $(1) is the K8s version. $(2) is the source file.
define make_yaml
$(1)/$(patsubst templates/v1/%,%,$(patsubst %.yaml.sed,%.yaml,$(2))):
	@$(ECHO_GEN)$$@
	-$(QUIET)sed -f $(1)/transforms2sed.sed -e s+__CILIUM_VERSION__+$$(CILIUM_VERSION)+ <$$< >$$@
endef

SOURCES = $(wildcard templates/v1/*.yaml*)
YAMLS = $(patsubst templates/v1/%,%,$(patsubst %.yaml.sed,%.yaml,$(SOURCES)))
NON_DAEMONSET_YAMLS = $(filter-out %-ds.yaml,$(YAMLS))
DAEMONSET_YAMLS = $(filter %-ds.yaml,$(YAMLS))
CONCAT_FILES = $(patsubst %-ds.yaml,%.yaml,$(DAEMONSET_YAMLS))

# Add the concatenated files as a dependency of all.
# Build the concatenated files.
$(foreach K8S_VERSION,$(K8S_VERSIONS), \
	$(foreach CONCAT_FILE,$(CONCAT_FILES), \
		$(eval $(call make_concat,$(K8S_VERSION),$(CONCAT_FILE)))))

# Add all YAML files as dependencies of concatenated files.
$(foreach K8S_VERSION,$(K8S_VERSIONS), \
	$(foreach CONCAT_FILE,$(CONCAT_FILES), \
		$(eval $(K8S_VERSION)/$(CONCAT_FILE): $(sort    $(patsubst %,$(K8S_VERSION)/%,$(NON_DAEMONSET_YAMLS)) \
														$(K8S_VERSION)/$(patsubst %.yaml,%-ds.yaml,$(CONCAT_FILE)))) \
	))<commit_msg>kubernetes: Fix generation of DaemonSet files to include v image tag prefix<commit_after>include ../../Makefile.defs

ifeq ($(CILIUM_VERSION),)
    CILIUM_VERSION = "v$(shell cat ../../VERSION)"
endif

K8S_VERSIONS = 1.7 1.8 1.9 1.10 1.11

# make_concat creates a concatenated YAML file specific for a K8s version.
# $(1) is the K8s version. $(2) is the concatenated file.
define make_concat
all: $(1)/$(2)
$(1)/$(2):
	@$(ECHO_GEN)$$@
	-$(QUIET)for f in $$^ ; do cat "$$$${f}"; echo "---" ; done >$$@
endef

# make_yaml creates a YAML specific for a K8s version.
# $(1) is the K8s version. $(2) is the source file.
define make_yaml
$(1)/$(patsubst templates/v1/%,%,$(patsubst %.yaml.sed,%.yaml,$(2))):
	@$(ECHO_GEN)$$@
	@echo "$(CILIUM_VERSION)" | egrep -Eq 'v\d+\.\d+\.\d+(-.+)?' || \
	echo "\"$(CILIUM_VERSION)\" is not a valid version. Must match regexp 'v\d+\.\d+\.\d+(-.+)?'. Please fix VERSION file" && false
	-$(QUIET)sed -f $(1)/transforms2sed.sed -e s+__CILIUM_VERSION__+$$(CILIUM_VERSION)+ <$$< >$$@
endef

SOURCES = $(wildcard templates/v1/*.yaml*)
YAMLS = $(patsubst templates/v1/%,%,$(patsubst %.yaml.sed,%.yaml,$(SOURCES)))
NON_DAEMONSET_YAMLS = $(filter-out %-ds.yaml,$(YAMLS))
DAEMONSET_YAMLS = $(filter %-ds.yaml,$(YAMLS))
CONCAT_FILES = $(patsubst %-ds.yaml,%.yaml,$(DAEMONSET_YAMLS))

# Add the concatenated files as a dependency of all.
# Build the concatenated files.
$(foreach K8S_VERSION,$(K8S_VERSIONS), \
	$(foreach CONCAT_FILE,$(CONCAT_FILES), \
		$(eval $(call make_concat,$(K8S_VERSION),$(CONCAT_FILE)))))

# Add all YAML files as dependencies of concatenated files.
$(foreach K8S_VERSION,$(K8S_VERSIONS), \
	$(foreach CONCAT_FILE,$(CONCAT_FILES), \
		$(eval $(K8S_VERSION)/$(CONCAT_FILE): $(sort    $(patsubst %,$(K8S_VERSION)/%,$(NON_DAEMONSET_YAMLS)) \
														$(K8S_VERSION)/$(patsubst %.yaml,%-ds.yaml,$(CONCAT_FILE)))) \
	))
{'fraction_non_alphanumeric': 0.21245315652925914, 'fraction_numerical': 0.02306140098010954, 'mean_word_length': 4.642276422764228, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2733721', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1407, 'n_words': 308}