github.com/cilium/cilium@v1.16.2/pkg/bpf/testdata/Makefile (about)

     1  include ../../../Makefile.defs
     2  
     3  CLANG := clang
     4  STRIP := llvm-objcopy
     5  CFLAGS := -O2 -g -Wall -Werror -I -I/usr/include -I$(ROOT_DIR)/bpf -I$(ROOT_DIR)/bpf/include $(CFLAGS)
     6  
     7  TESTDATA_DIR := $(ROOT_DIR)/pkg/bpf/testdata
     8  UIDGID := $(shell stat -c '%u:%g' ${ROOT_DIR})
     9  
    10  TARGETS := \
    11  	unreachable-tailcall
    12  
    13  .PHONY: docker build clean
    14  
    15  .DEFAULT_GOAL: docker
    16  docker: ## Build the testdata binaries using the cilium-builder Docker image.
    17  	docker run --rm -u "$(UIDGID)" -v "$(ROOT_DIR):/cilium" $(CILIUM_BUILDER_IMAGE) make -C /cilium/pkg/bpf/testdata clean build
    18  
    19  clean: ## Remove testdata artifacts.
    20  	find "$(TESTDATA_DIR)" -name "*.o" -delete
    21  
    22  ## Build the testdata binaries using the host's toolchain.
    23  build: $(addsuffix .o,$(TARGETS))
    24  
    25  %.o: %.c
    26  	$(CLANG) $(CFLAGS) -target bpfel -c $< -o $@
    27  	$(STRIP) -g $@