18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# Makefile for bootconfig command
38c2ecf20Sopenharmony_ciinclude ../scripts/Makefile.include
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cibindir ?= /usr/bin
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciifeq ($(srctree),)
88c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(CURDIR)))
98c2ecf20Sopenharmony_cisrctree := $(patsubst %/,%,$(dir $(srctree)))
108c2ecf20Sopenharmony_ciendif
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciLIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h
138c2ecf20Sopenharmony_ciCFLAGS = -Wall -g -I$(CURDIR)/include
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciALL_TARGETS := bootconfig
168c2ecf20Sopenharmony_ciALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciall: $(ALL_PROGRAMS)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci$(OUTPUT)bootconfig: main.c $(LIBSRC)
218c2ecf20Sopenharmony_ci	$(CC) $(filter %.c,$^) $(CFLAGS) -o $@
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_citest: $(ALL_PROGRAMS) test-bootconfig.sh
248c2ecf20Sopenharmony_ci	./test-bootconfig.sh $(OUTPUT)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciinstall: $(ALL_PROGRAMS)
278c2ecf20Sopenharmony_ci	install $(OUTPUT)bootconfig $(DESTDIR)$(bindir)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciclean:
308c2ecf20Sopenharmony_ci	$(RM) -f $(OUTPUT)*.o $(ALL_PROGRAMS)
31