xref: /aosp_15_r20/external/gsc-utils/boot_param/Makefile (revision 4f2df630800bdcf1d4f0decf95d8a1cb87344f5f)
1# Copyright 2024 The ChromiumOS Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5CC ?= gcc
6PROGRAM := test_boot_param
7LIBS    := -lcrypto
8CFLAGS  += -std=gnu99 \
9	-g \
10	-Wall \
11	-Werror \
12	-Wpointer-arith \
13	-Wcast-align \
14	-Wundef \
15	-Wsign-compare \
16	-Wredundant-decls \
17	-Wmissing-declarations
18RESULT_FILES := test_boot_param.cbor test_dice_chain.cbor
19PCR0_OPTION := normal
20PROGRAM_OPTIONS := $(RESULT_FILES) $(PCR0_OPTION)
21
22ifneq ($(DEBUG),)
23CFLAGS += -O0
24else
25CFLAGS += -O3
26endif
27
28ifneq ($(DICE_DEBUG),)
29CFLAGS += -DDICE_DEBUG
30endif
31
32all: test
33
34test: $(PROGRAM)
35	./$(PROGRAM) $(PROGRAM_OPTIONS)
36
37SOURCES := test.c boot_param.c boot_param_platform_host.c
38OBJS := $(patsubst %.c,%.o,$(SOURCES))
39DEPS := $(patsubst %.c,%.d,$(SOURCES))
40
41$(PROGRAM): $(OBJS) Makefile
42	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
43
44%.o: %.c Makefile
45	$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MF $(basename $@).d -o $@ $<
46
47.PHONY: clean
48clean:
49	rm -rf $(PROGRAM) *~ *.o *.d $(RESULT_FILES)
50
51-include $(DEPS)
52