Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # Makefile for bootconfig command |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 3 | include ../scripts/Makefile.include |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 4 | |
| 5 | bindir ?= /usr/bin |
| 6 | |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 7 | ifeq ($(srctree),) |
| 8 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) |
| 9 | srctree := $(patsubst %/,%,$(dir $(srctree))) |
| 10 | endif |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 11 | |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 12 | LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h |
| 13 | CFLAGS = -Wall -g -I$(CURDIR)/include |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 14 | |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 15 | ALL_TARGETS := bootconfig |
| 16 | ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 17 | |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 18 | all: $(ALL_PROGRAMS) |
| 19 | |
| 20 | $(OUTPUT)bootconfig: main.c $(LIBSRC) |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 21 | $(CC) $(filter %.c,$^) $(CFLAGS) -o $@ |
| 22 | |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 23 | test: $(ALL_PROGRAMS) test-bootconfig.sh |
| 24 | ./test-bootconfig.sh $(OUTPUT) |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 25 | |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 26 | install: $(ALL_PROGRAMS) |
| 27 | install $(OUTPUT)bootconfig $(DESTDIR)$(bindir) |
Masami Hiramatsu | 081c653 | 2020-01-11 01:04:07 +0900 | [diff] [blame] | 28 | |
Masami Hiramatsu | 950313e | 2020-01-11 01:03:56 +0900 | [diff] [blame] | 29 | clean: |
Masami Hiramatsu | 306b69d | 2020-03-03 20:24:40 +0900 | [diff] [blame] | 30 | $(RM) -f $(OUTPUT)*.o $(ALL_PROGRAMS) |