<commit_before>include ../Makefile.defs

.PHONY: all subdirs $(SUBDIRS) check preprocess assembly install clean

SUBDIRS = sockops

BPF_SIMPLE = bpf_netdev.o bpf_overlay.o bpf_xdp.o
BPF = bpf_lxc.o bpf_lb.o $(BPF_SIMPLE)
SCRIPTS = init.sh join_ep.sh run_probes.sh spawn_netns.sh

TARGET=cilium-map-migrate

include ./Makefile.bpf

ifeq ("$(PKG_BUILD)","")
all: $(BPF) $(TARGET) $(SUBDIRS)

$(BPF_SIMPLE): %.o: %.ll
	@$(ECHO_CC)
	$(QUIET) ${LLC} ${LLC_FLAGS} -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

# Hack to get make to replace : with a space
space :=
space += 

# The following option combinations are compile tested
LB_OPTIONS = \
	-DSKIP_DEBUG \
	-DENABLE_IPV4:-DLB_L3 \
	-DENABLE_IPV4:-DLB_L4 \
	-DENABLE_IPV4:-DLB_L3:-DLB_L4 \
	-DENABLE_IPV6:-DLB_L3 \
	-DENABLE_IPV6:-DLB_L4 \
	-DENABLE_IPV6:-DLB_L3:-DLB_L4 \
	-DENABLE_IPV4:-DENABLE_IPV6:-DLB_L3 \
	-DENABLE_IPV4:-DENABLE_IPV6:-DLB_L4 \
	-DENABLE_IPV4:-DENABLE_IPV6:-DLB_L3:-DLB_L4

# These options are intended to max out the BPF program complexity. it is load
# tested as well.
MAX_LB_OPTIONS = -DENABLE_IPV4 -DENABLE_IPV6 -DLB_L3 -DLB_L4

bpf_lb.ll: bpf_lb.c $(LIB)
	$(QUIET) set -e; \
	$(foreach OPTS,$(LB_OPTIONS), \
		$(ECHO_CC) " [$(subst :,$(space),$(OPTS))]"; \
		${CLANG} $(subst :,$(space),$(OPTS)) ${CLANG_FLAGS} -c $< -o $@; \
		${LLC} ${LLC_FLAGS} -o /dev/null $@; )
	@$(ECHO_CC)
	$(QUIET) ${CLANG} ${MAX_LB_OPTIONS} ${CLANG_FLAGS} -c $< -o $@

bpf_lb.o: bpf_lb.ll
	@$(ECHO_CC)
	$(QUIET) ${LLC} ${LLC_FLAGS} -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

# The following option combinations are compile tested
LXC_OPTIONS = \
	 -DSKIP_DEBUG \
	 -DHAVE_LPM_MAP_TYPE \
	 -DHAVE_LRU_MAP_TYPE \
	 -DENABLE_IPV4 \
	 -DENABLE_IPV4:-DHAVE_LPM_MAP_TYPE \
	 -DENABLE_IPV4:-DHAVE_LPM_MAP_TYPE:-DHAVE_LRU_MAP_TYPE \
	 -DENABLE_IPV6 \
	 -DENABLE_IPV6:-DHAVE_LPM_MAP_TYPE \
	 -DENABLE_IPV6:-DHAVE_LPM_MAP_TYPE:-DHAVE_LRU_MAP_TYPE \
	 -DENABLE_IPV6:-DENABLE_IPV4 \
	 -DENABLE_IPV4:-DENABLE_IPV6:-DHAVE_LPM_MAP_TYPE:-DHAVE_LRU_MAP_TYPE \
	 -DENABLE_HOST_REDIRECT:-DENABLE_IPV4:-DENABLE_IPV6:-DENABLE_NAT46

# These options are intended to max out the BPF program complexity. it is load
# tested as well.
MAX_LXC_OPTIONS = "-DENABLE_IPV4 -DENABLE_IPV6"

bpf_lxc.ll: bpf_lxc.c $(LIB)
	$(QUIET) set -e; \
	$(foreach OPTS,$(LXC_OPTIONS), \
		$(ECHO_CC) " [$(subst :,$(space),$(OPTS))]"; \
		${CLANG} $(subst :,$(space),$(OPTS)) ${CLANG_FLAGS} -c $< -o $@; \
		${LLC} ${LLC_FLAGS} -o /dev/null $@; )
	@$(ECHO_CC)
	$(QUIET) ${CLANG} ${MAX_LXC_OPTIONS} ${CLANG_FLAGS} -c $< -o $@

bpf_lxc.o: bpf_lxc.ll
	@$(ECHO_CC)
	$(QUIET) ${LLC} ${LLC_FLAGS} -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

subdirs: $(SUBDIRS)
$(SUBDIRS):
	@$(MAKE) -C $@
else
all: $(TARGET)
endif

$(TARGET): $(TARGET).c<commit_msg>bpf: unquote MAX_LXC_OPTIONS in build test<commit_after>include ../Makefile.defs

.PHONY: all subdirs $(SUBDIRS) check preprocess assembly install clean

SUBDIRS = sockops

BPF_SIMPLE = bpf_netdev.o bpf_overlay.o bpf_xdp.o
BPF = bpf_lxc.o bpf_lb.o $(BPF_SIMPLE)
SCRIPTS = init.sh join_ep.sh run_probes.sh spawn_netns.sh

TARGET=cilium-map-migrate

include ./Makefile.bpf

ifeq ("$(PKG_BUILD)","")
all: $(BPF) $(TARGET) $(SUBDIRS)

$(BPF_SIMPLE): %.o: %.ll
	@$(ECHO_CC)
	$(QUIET) ${LLC} ${LLC_FLAGS} -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

# Hack to get make to replace : with a space
space :=
space += 

# The following option combinations are compile tested
LB_OPTIONS = \
	-DSKIP_DEBUG \
	-DENABLE_IPV4:-DLB_L3 \
	-DENABLE_IPV4:-DLB_L4 \
	-DENABLE_IPV4:-DLB_L3:-DLB_L4 \
	-DENABLE_IPV6:-DLB_L3 \
	-DENABLE_IPV6:-DLB_L4 \
	-DENABLE_IPV6:-DLB_L3:-DLB_L4 \
	-DENABLE_IPV4:-DENABLE_IPV6:-DLB_L3 \
	-DENABLE_IPV4:-DENABLE_IPV6:-DLB_L4 \
	-DENABLE_IPV4:-DENABLE_IPV6:-DLB_L3:-DLB_L4

# These options are intended to max out the BPF program complexity. it is load
# tested as well.
MAX_LB_OPTIONS = -DENABLE_IPV4 -DENABLE_IPV6 -DLB_L3 -DLB_L4

bpf_lb.ll: bpf_lb.c $(LIB)
	$(QUIET) set -e; \
	$(foreach OPTS,$(LB_OPTIONS), \
		$(ECHO_CC) " [$(subst :,$(space),$(OPTS))]"; \
		${CLANG} $(subst :,$(space),$(OPTS)) ${CLANG_FLAGS} -c $< -o $@; \
		${LLC} ${LLC_FLAGS} -o /dev/null $@; )
	@$(ECHO_CC)
	$(QUIET) ${CLANG} ${MAX_LB_OPTIONS} ${CLANG_FLAGS} -c $< -o $@

bpf_lb.o: bpf_lb.ll
	@$(ECHO_CC)
	$(QUIET) ${LLC} ${LLC_FLAGS} -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

# The following option combinations are compile tested
LXC_OPTIONS = \
	 -DSKIP_DEBUG \
	 -DHAVE_LPM_MAP_TYPE \
	 -DHAVE_LRU_MAP_TYPE \
	 -DENABLE_IPV4 \
	 -DENABLE_IPV4:-DHAVE_LPM_MAP_TYPE \
	 -DENABLE_IPV4:-DHAVE_LPM_MAP_TYPE:-DHAVE_LRU_MAP_TYPE \
	 -DENABLE_IPV6 \
	 -DENABLE_IPV6:-DHAVE_LPM_MAP_TYPE \
	 -DENABLE_IPV6:-DHAVE_LPM_MAP_TYPE:-DHAVE_LRU_MAP_TYPE \
	 -DENABLE_IPV6:-DENABLE_IPV4 \
	 -DENABLE_IPV4:-DENABLE_IPV6:-DHAVE_LPM_MAP_TYPE:-DHAVE_LRU_MAP_TYPE \
	 -DENABLE_HOST_REDIRECT:-DENABLE_IPV4:-DENABLE_IPV6:-DENABLE_NAT46

# These options are intended to max out the BPF program complexity. it is load
# tested as well.
MAX_LXC_OPTIONS = -DENABLE_IPV4 -DENABLE_IPV6

bpf_lxc.ll: bpf_lxc.c $(LIB)
	$(QUIET) set -e; \
	$(foreach OPTS,$(LXC_OPTIONS), \
		$(ECHO_CC) " [$(subst :,$(space),$(OPTS))]"; \
		${CLANG} $(subst :,$(space),$(OPTS)) ${CLANG_FLAGS} -c $< -o $@; \
		${LLC} ${LLC_FLAGS} -o /dev/null $@; )
	@$(ECHO_CC)
	$(QUIET) ${CLANG} ${MAX_LXC_OPTIONS} ${CLANG_FLAGS} -c $< -o $@

bpf_lxc.o: bpf_lxc.ll
	@$(ECHO_CC)
	$(QUIET) ${LLC} ${LLC_FLAGS} -filetype=obj -o $@ $(patsubst %.o,%.ll,$@)

subdirs: $(SUBDIRS)
$(SUBDIRS):
	@$(MAKE) -C $@
else
all: $(TARGET)
endif

$(TARGET): $(TARGET).c
{'fraction_non_alphanumeric': 0.18610960390667391, 'fraction_numerical': 0.015916078856936154, 'mean_word_length': 4.3071017274472165, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '3542745', 'n_tokens_mistral': 2773, 'n_tokens_neox': 2642, 'n_words': 452}