162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci# Makefile for bootconfig command
362306a36Sopenharmony_ciinclude ../scripts/Makefile.include
462306a36Sopenharmony_ci
562306a36Sopenharmony_cibindir ?= /usr/bin
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciifeq ($(srctree),)
862306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR)))
962306a36Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree)))
1062306a36Sopenharmony_ciendif
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciLIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
1362306a36Sopenharmony_ciCFLAGS = -Wall -g -I$(CURDIR)/include
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciALL_TARGETS := bootconfig
1662306a36Sopenharmony_ciALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciall: $(ALL_PROGRAMS) test
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci$(OUTPUT)bootconfig: main.c include/linux/bootconfig.h $(LIBSRC)
2162306a36Sopenharmony_ci	$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_citest: $(ALL_PROGRAMS) test-bootconfig.sh
2462306a36Sopenharmony_ci	./test-bootconfig.sh $(OUTPUT)
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciinstall: $(ALL_PROGRAMS)
2762306a36Sopenharmony_ci	install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciclean:
3062306a36Sopenharmony_ci	$(RM) -f $(OUTPUT)*.o $(ALL_PROGRAMS)
31