From 2f8a180f8da76959c4a3f20141c200f2e25917ed Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Fri, 6 Jun 2025 13:56:21 +0200 Subject: [PATCH 1/2] igvm_c/Makefile: add CFLAGS, LDFLAGS and CC Replace cc with $(CC) so that it can be changed externally. Introduce CFLAGS and LDFLAGS for dump_igvm and igvm_test. Remove libm from dump_igvm as is not required. Signed-off-by: Luigi Leonardi --- igvm_c/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/igvm_c/Makefile b/igvm_c/Makefile index 9914fa2..4ab3a9a 100644 --- a/igvm_c/Makefile +++ b/igvm_c/Makefile @@ -15,7 +15,10 @@ TARGET_PATH="$(IGVM_DIR)/$(TARGET_DIR)/debug" endif PREFIX ?= /usr -DESTDIR ?= +DESTDIR ?= + +CFLAGS ?= -g3 -O0 +LDFLAGS += -L $(TARGET_PATH) CARGO=CARGO_TARGET_DIR=$(IGVM_DIR)/$(TARGET_DIR) cargo @@ -47,10 +50,10 @@ $(API_DIR)/include/igvm.h: $(RUST_SOURCE) $(API_DIR)/scripts/post_process.sh "$(API_DIR)/include" $(TARGET_PATH)/dump_igvm: $(API_DIR)/include/igvm.h $(API_DIR)/sample/dump_igvm.c $(TARGET_PATH)/libigvm.a - cc -g3 -O0 -I $(API_DIR) -L $(TARGET_PATH) -o $@ $^ -ligvm -ldl -pthread -lm -lutil -lrt + $(CC) $(CFLAGS) -I $(API_DIR) -o $@ $^ -ligvm -ldl -pthread -lutil -lrt $(LDFLAGS) $(TARGET_PATH)/igvm_test: $(API_DIR)/include/igvm.h $(API_DIR)/tests/igvm_test.c $(TARGET_PATH)/libigvm.a - cc -g3 -O0 -I $(API_DIR) -L $(TARGET_PATH) -o $@ $^ -ligvm -lcunit -ldl -pthread -lm -lutil -lrt + $(CC) $(CFLAGS) -I $(API_DIR) -o $@ $^ -ligvm -lcunit -ldl -pthread -lm -lutil -lrt $(LDFLAGS) $(TARGET_PATH)/igvm.bin: $(TARGET_PATH)/test_data $(TARGET_PATH)/test_data $(TARGET_PATH)/igvm.bin From 678dd4503383b042df728262d38278e1b0f925f6 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Fri, 6 Jun 2025 14:43:04 +0200 Subject: [PATCH 2/2] igvm_c/Makefile: add targets to PHONY .PHONY does not include targets that are not file names like `build` or `all`. Signed-off-by: Luigi Leonardi --- igvm_c/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/igvm_c/Makefile b/igvm_c/Makefile index 4ab3a9a..a085bb8 100644 --- a/igvm_c/Makefile +++ b/igvm_c/Makefile @@ -29,7 +29,7 @@ RUST_SOURCE := $(IGVM_DIR)/igvm/src/c_api.rs $(IGVM_DIR)/igvm/src/lib.rs $(IGVM_ # Determine igvm crate version from Cargo.toml VERSION = $(shell grep -oP "(?<=version = \").+(?=\")" $(IGVM_DIR)/igvm/Cargo.toml) -.PHONY: install +.PHONY: all build test clean install all: build test