1 # SPDX-License-Identifier: GPL-2.0-only
2 include ..
/..
/scripts
/Makefile.
include
3 include ..
/..
/scripts
/Makefile.arch
6 srctree
:= $(patsubst %/,%,$(dir $(CURDIR
)))
7 srctree
:= $(patsubst %/,%,$(dir $(srctree
)))
8 srctree
:= $(patsubst %/,%,$(dir $(srctree
)))
16 msg
= @printf
' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
17 MAKEFLAGS
=--no-print-directory
20 # always use the host compiler
26 OUTPUT ?
= $(srctree
)/tools
/bpf
/resolve_btfids
/
28 LIBBPF_SRC
:= $(srctree
)/tools
/lib
/bpf
/
29 SUBCMD_SRC
:= $(srctree
)/tools
/lib
/subcmd
/
31 BPFOBJ
:= $(OUTPUT
)/libbpf.a
32 SUBCMDOBJ
:= $(OUTPUT
)/libsubcmd.a
34 BINARY
:= $(OUTPUT
)/resolve_btfids
35 BINARY_IN
:= $(BINARY
)-in.o
41 $(Q
)mkdir
-p
$(OUTPUT
)
43 $(SUBCMDOBJ
): fixdep FORCE
44 $(Q
)$(MAKE
) -C
$(SUBCMD_SRC
) OUTPUT
=$(OUTPUT
)
46 $(BPFOBJ
): $(wildcard $(LIBBPF_SRC
)/*.
[ch
] $(LIBBPF_SRC
)/Makefile
) |
$(OUTPUT
)
47 $(Q
)$(MAKE
) $(submake_extras
) -C
$(LIBBPF_SRC
) OUTPUT
=$(abspath
$(dir $@
))/ $(abspath
$@
)
50 -I
$(srctree
)/tools
/include \
51 -I
$(srctree
)/tools
/include/uapi \
57 export srctree OUTPUT CFLAGS Q
58 include $(srctree
)/tools
/build
/Makefile.
include
60 $(BINARY_IN
): fixdep FORCE
61 $(Q
)$(MAKE
) $(build
)=resolve_btfids
63 $(BINARY
): $(BPFOBJ
) $(SUBCMDOBJ
) $(BINARY_IN
)
65 $(Q
)$(CC
) $(BINARY_IN
) $(LDFLAGS
) -o
$@
$(BPFOBJ
) $(SUBCMDOBJ
) $(LIBS
)
68 $(Q
)$(MAKE
) -C
$(SUBCMD_SRC
) OUTPUT
=$(OUTPUT
) clean
71 $(Q
)$(MAKE
) -C
$(LIBBPF_SRC
) OUTPUT
=$(OUTPUT
) clean
73 clean: libsubcmd-clean libbpf-clean fixdep-clean
74 $(call msg
,CLEAN
,$(BINARY
))
75 $(Q
)$(RM
) -f
$(BINARY
); \
76 $(RM
) -rf
$(if
$(OUTPUT
),$(OUTPUT
),.
)/feature
; \
77 find
$(if
$(OUTPUT
),$(OUTPUT
),.
) -name \
*.o
-or
-name \
*.o.cmd
-or
-name \
*.o.d | xargs
$(RM
)
81 $(Q
)ctags
-R .
$(LIBBPF_SRC
) $(SUBCMD_SRC
)
85 .PHONY
: all FORCE
clean tags