summaryrefslogtreecommitdiffstats
path: root/tools/bootconfig/Makefile
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2020-03-03 12:24:40 +0100
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-03-03 23:38:42 +0100
commit306b69dce9269df116bfa94319b1b827c22d5794 (patch)
tree5fc44f601a2889ad1ad46cbcead6210858f23613 /tools/bootconfig/Makefile
parenttracing: Remove unused TRACE_BUFFER bits (diff)
downloadlinux-306b69dce9269df116bfa94319b1b827c22d5794.tar.xz
linux-306b69dce9269df116bfa94319b1b827c22d5794.zip
bootconfig: Support O=<builddir> option
Support O=<builddir> option to build bootconfig tool in the other directory. As same as other tools, if you specify O=<builddir>, bootconfig command is build under <builddir>. Link: http://lkml.kernel.org/r/158323468033.10560.14661631369326294355.stgit@devnote2 Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools/bootconfig/Makefile')
-rw-r--r--tools/bootconfig/Makefile27
1 files changed, 17 insertions, 10 deletions
diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
index a6146ac64458..da5975775337 100644
--- a/tools/bootconfig/Makefile
+++ b/tools/bootconfig/Makefile
@@ -1,23 +1,30 @@
# SPDX-License-Identifier: GPL-2.0
# Makefile for bootconfig command
+include ../scripts/Makefile.include
bindir ?= /usr/bin
-HEADER = include/linux/bootconfig.h
-CFLAGS = -Wall -g -I./include
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(CURDIR)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+endif
-PROGS = bootconfig
+LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
+CFLAGS = -Wall -g -I$(CURDIR)/include
-all: $(PROGS)
+ALL_TARGETS := bootconfig
+ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
-bootconfig: ../../lib/bootconfig.c main.c $(HEADER)
+all: $(ALL_PROGRAMS)
+
+$(OUTPUT)bootconfig: main.c $(LIBSRC)
$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
-install: $(PROGS)
- install bootconfig $(DESTDIR)$(bindir)
+test: $(ALL_PROGRAMS) test-bootconfig.sh
+ ./test-bootconfig.sh $(OUTPUT)
-test: bootconfig
- ./test-bootconfig.sh
+install: $(ALL_PROGRAMS)
+ install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
clean:
- $(RM) -f *.o bootconfig
+ $(RM) -f $(OUTPUT)*.o $(ALL_PROGRAMS)