forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (28 loc) · 781 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
# Copyright Authors of Cilium
include ../../Makefile.defs
.PHONY: all clean
BASE_PROG := bpf_custom.c
ifneq ("$(BPF_CUSTOM_PROG_FILE)", "")
PROGS = $(patsubst %.h,%.o,$(BPF_CUSTOM_PROG_FILE))
else
# If no header file was passed, compile for all header files found in the
# directory.
PROGS = $(patsubst %.h,%.o,$(wildcard *.h))
endif
ifneq ("$(BPF_CUSTOM_PROG_NAME)","")
sec_name = $(BPF_CUSTOM_PROG_NAME)
else
sec_name = $(basename $(1))
endif
include ../Makefile.bpf
all: $(PROGS)
%.o: %.h $(BASE_PROG) $(LIB)
@$(ECHO_CC)
$(QUIET) ${CLANG} ${CLANG_FLAGS} \
-DBPF_CUSTOM_PROG_FILE=$< \
-DBPF_CUSTOM_PROG_NAME=$(call sec_name,$<) \
-c $(BASE_PROG) -o $@
clean:
@$(ECHO_CLEAN)
$(QUIET)rm -fr *.o *.ll *.i