From 8830892c7b61187b352c07ab35be2d0dddb713cc Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Thu, 1 Oct 2020 22:32:18 +1000 Subject: secvar: Clean up makefiles and fix out of tree builds The secvar makefiles use $(SRC) in a few places they shouldn't and don't use it in a few places they should. Also drop the _SRCS rules and the pattern substuituion that turns them into _OBJS rules because chaining dependent rules is infuriating at the best of times. Signed-off-by: Oliver O'Halloran --- libstb/crypto/Makefile.inc | 2 +- libstb/secvar/Makefile.inc | 16 ++++++---------- libstb/secvar/backend/Makefile.inc | 5 ++--- libstb/secvar/storage/Makefile.inc | 9 ++++----- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/libstb/crypto/Makefile.inc b/libstb/crypto/Makefile.inc index ed2387e..4bc1a64 100644 --- a/libstb/crypto/Makefile.inc +++ b/libstb/crypto/Makefile.inc @@ -42,7 +42,7 @@ MBEDTLS_SRCS = $(addprefix mbedtls/library/,$(MBED_CRYPTO_SRCS) $(MBED_X509_SRCS MBEDTLS_OBJS = $(MBEDTLS_SRCS:%.c=%.o) -include $(CRYPTO_DIR)/pkcs7/Makefile.inc +include $(SRC)/$(CRYPTO_DIR)/pkcs7/Makefile.inc CRYPTO = $(CRYPTO_DIR)/built-in.a diff --git a/libstb/secvar/Makefile.inc b/libstb/secvar/Makefile.inc index b40bfc2..57c7cfb 100644 --- a/libstb/secvar/Makefile.inc +++ b/libstb/secvar/Makefile.inc @@ -1,16 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # -*-Makefile-*- -SECVAR_DIR = $(SRC)/libstb/secvar +SUBDIRS += libstb/secvar -SUBDIRS += $(SECVAR_DIR) +SECVAR_OBJS = secvar_main.o secvar_util.o secvar_devtree.o secvar_api.o +SECVAR = libstb/secvar/built-in.a -include $(SECVAR_DIR)/storage/Makefile.inc -include $(SECVAR_DIR)/backend/Makefile.inc +include $(SRC)/libstb/secvar/storage/Makefile.inc +include $(SRC)/libstb/secvar/backend/Makefile.inc -SECVAR_SRCS = secvar_main.c secvar_util.c secvar_devtree.c -SECVAR_SRCS = secvar_main.c secvar_util.c secvar_devtree.c secvar_api.c -SECVAR_OBJS = $(SECVAR_SRCS:%.c=%.o) -SECVAR = $(SECVAR_DIR)/built-in.a - -$(SECVAR): $(SECVAR_OBJS:%=$(SECVAR_DIR)/%) $(SECVAR_STORAGE) $(SECVAR_BACKEND) +$(SECVAR): $(SECVAR_OBJS:%=libstb/secvar/%) $(SECVAR_STORAGE) $(SECVAR_BACKEND) diff --git a/libstb/secvar/backend/Makefile.inc b/libstb/secvar/backend/Makefile.inc index bc987f6..436f9fa 100644 --- a/libstb/secvar/backend/Makefile.inc +++ b/libstb/secvar/backend/Makefile.inc @@ -1,12 +1,11 @@ # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # -*-Makefile-*- -SECVAR_BACKEND_DIR = $(SRC)/libstb/secvar/backend +SECVAR_BACKEND_DIR = libstb/secvar/backend SUBDIRS += $(SECVAR_BACKEND_DIR) -SECVAR_BACKEND_SRCS = edk2-compat.c edk2-compat-process.c edk2-compat-reset.c -SECVAR_BACKEND_OBJS = $(SECVAR_BACKEND_SRCS:%.c=%.o) +SECVAR_BACKEND_OBJS = edk2-compat.o edk2-compat-process.o edk2-compat-reset.o SECVAR_BACKEND = $(SECVAR_BACKEND_DIR)/built-in.a $(SECVAR_BACKEND): $(SECVAR_BACKEND_OBJS:%=$(SECVAR_BACKEND_DIR)/%) diff --git a/libstb/secvar/storage/Makefile.inc b/libstb/secvar/storage/Makefile.inc index dc5353f..50156fe 100644 --- a/libstb/secvar/storage/Makefile.inc +++ b/libstb/secvar/storage/Makefile.inc @@ -1,19 +1,18 @@ # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # -*-Makefile-*- -SECVAR_STORAGE_DIR = $(SRC)/libstb/secvar/storage +SECVAR_STORAGE_DIR = libstb/secvar/storage SUBDIRS += $(SECVAR_STORAGE_DIR) # Swap the comment on these two lines to use the fake TPM NV # implementation hardware without a TPM -SECVAR_STORAGE_SRCS = secboot_tpm.c tpmnv_ops.c -#SECVAR_STORAGE_SRCS = secboot_tpm.c fakenv_ops.c +SECVAR_STORAGE_OBJS = secboot_tpm.o tpmnv_ops.o +#SECVAR_STORAGE_OBJS = secboot_tpm.o fakenv_ops.o -SECVAR_STORAGE_OBJS = $(SECVAR_STORAGE_SRCS:%.c=%.o) SECVAR_STORAGE = $(SECVAR_STORAGE_DIR)/built-in.a $(SECVAR_STORAGE): $(SECVAR_STORAGE_OBJS:%=$(SECVAR_STORAGE_DIR)/%) gen_tpmnv_public_name: $@ - gcc -o $@ $(SECVAR_STORAGE_DIR)/$@.c -I $(SRC)/libstb/tss2/ibmtpm20tss/utils/ -lmbedcrypto + $(HOSTCC) -o $@ $(SECVAR_STORAGE_DIR)/$@.c -I $(SRC)/libstb/tss2/ibmtpm20tss/utils/ -lmbedcrypto -- cgit v1.1