xref: /linux/tools/bootconfig/Makefile (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1# SPDX-License-Identifier: GPL-2.0
2# Makefile for bootconfig command
3include ../scripts/Makefile.include
4
5bindir ?= /usr/bin
6
7ifeq ($(srctree),)
8srctree := $(patsubst %/,%,$(dir $(CURDIR)))
9srctree := $(patsubst %/,%,$(dir $(srctree)))
10endif
11
12LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
13CFLAGS = -Wall -g -I$(CURDIR)/include
14
15ALL_TARGETS := bootconfig
16ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
17
18all: $(ALL_PROGRAMS) test
19
20$(OUTPUT)bootconfig: main.c include/linux/bootconfig.h $(LIBSRC)
21	$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
22
23test: $(ALL_PROGRAMS) test-bootconfig.sh
24	./test-bootconfig.sh $(OUTPUT)
25
26install: $(ALL_PROGRAMS)
27	install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
28
29clean:
30	$(RM) -f $(OUTPUT)*.o $(ALL_PROGRAMS)
31