Skip to content

Commit

Permalink
Refine the spdm_responder's build directories
Browse files Browse the repository at this point in the history
All the files produced in the build process go to a common build
directory and the subfolders for the different target platforms
follow a similar hierarchy.
  • Loading branch information
andrestt committed Nov 19, 2023
1 parent 12cabc6 commit 70928e8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
36 changes: 19 additions & 17 deletions examples/apps/spdm_responder/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
SHELL := /bin/bash

GENERATED = build/generated/rflx-spdm.ads
BUILD_DIR = build

GENERATED = $(BUILD_DIR)/generated/rflx-spdm.ads

SOURCE_SPECIFICATIONS = \
specs/spdm_responder.rflx \
Expand Down Expand Up @@ -33,44 +35,44 @@ check_spec: $(SPECIFICATIONS) | $(INTEGRATION_FILES) $(RFLX)

test: test_cross test_binary_size lib

test_cross: build/arm/example/main build/riscv64/example/main libarm libriscv64
test_cross: $(BUILD_DIR)/arm/example/main $(BUILD_DIR)/riscv64/example/main libarm libriscv64

test_binary_size: build/arm/example/main build/riscv64/example/main
tools/check_size.py arm build/arm/example/main .text 46000
tools/check_size.py riscv64 build/riscv64/example/main .text 38000
test_binary_size: $(BUILD_DIR)/arm/example/main $(BUILD_DIR)/riscv64/example/main
tools/check_size.py arm $(BUILD_DIR)/arm/example/main .text 46000
tools/check_size.py riscv64 $(BUILD_DIR)/riscv64/example/main .text 38000

build/lib/libspdm.a: $(GENERATED)
$(BUILD_DIR)/lib/libspdm.a: $(GENERATED)
gprbuild -j0 -P spdm

build/%/lib/libspdm.a: $(GENERATED)
$(BUILD_DIR)/%/lib/libspdm.a: $(GENERATED)
gprbuild -j0 -P spdm -XTARGET=$*

build/%/example/main: $(GENERATED)
$(BUILD_DIR)/%/example/main: $(GENERATED)
gprbuild -j0 -P build.gpr -XTARGET=$*
test -f $@

build/generated:
mkdir -p build/generated
$(BUILD_DIR)/generated:
mkdir -p $(BUILD_DIR)/generated

# The verification of the SPDM specification occasionally gets stuck in the CI. The code generation
# is attempted twice to decrease the occurrence of unsuccessful pipelines.
build/generated/%: $(SPECIFICATIONS) | build/generated $(INTEGRATION_FILES) $(RFLX)
timeout -k 60 1200 $(RFLX) generate $^ -d build/generated; \
$(BUILD_DIR)/generated/%: $(SPECIFICATIONS) | $(BUILD_DIR)/generated $(INTEGRATION_FILES) $(RFLX)
timeout -k 60 1200 $(RFLX) generate $^ -d $(BUILD_DIR)/generated; \
RC=$$?; \
if [ $$RC -eq 124 ]; \
then \
timeout -k 60 1200 $(RFLX) generate $^ -d build/generated; \
timeout -k 60 1200 $(RFLX) generate $^ -d $(BUILD_DIR)/generated; \
else \
(exit $$RC); \
fi

.PHONY: lib libarm libriscv64

lib: build/lib/libspdm.a
lib: $(BUILD_DIR)/lib/libspdm.a

libarm: build/arm/lib/libspdm.a
libarm: $(BUILD_DIR)/arm/lib/libspdm.a

libriscv64: build/riscv64/lib/libspdm.a
libriscv64: $(BUILD_DIR)/riscv64/lib/libspdm.a

.PHONY: prove

Expand All @@ -85,4 +87,4 @@ generate: $(GENERATED)
.PHONY: clean

clean:
rm -rf build
rm -rf $(BUILD_DIR)
3 changes: 2 additions & 1 deletion examples/apps/spdm_responder/build.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ project Build is

for Languages use ("Ada");
for Source_Dirs use ("src/main");
for Object_Dir use "build/" & Target_Arch & Stack_Check_Path & "/example";
for Object_Dir use "build/" & Target_Arch & Stack_Check_Path & "/example/obj";
for Exec_Dir use "build/" & Target_Arch & Stack_Check_Path & "/example";

for Create_Missing_Dirs use "True";
for Target use Target_Arch & "-elf";
Expand Down
6 changes: 3 additions & 3 deletions examples/apps/spdm_responder/build_lib.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ project Build_Lib is

for Library_Name use "responder";
for Library_Kind use "static";
Build_Dir := "../build/" & Target_Arch & Stack_Check_Path;
for Object_Dir use Build_Dir & "/example";
for Library_Dir use Build_Dir & "/examplelib";
Build_Dir := "build/" & Target_Arch & Stack_Check_Path;
for Object_Dir use Build_Dir & "/example/obj/lib";
for Library_Dir use Build_Dir & "/example/lib";
for Library_Standalone use "standard";
for Library_Interface use ("responder");

Expand Down
2 changes: 1 addition & 1 deletion examples/apps/spdm_responder/spdm.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ project SPDM is
for Target use Target_Arch & "-elf";
for Runtime ("Ada") use "light-spike";
when others =>
Build_Dir := "build";
Build_Dir := "build/default";
end case;

for Object_Dir use Build_Dir & "/obj";
Expand Down

0 comments on commit 70928e8

Please sign in to comment.