]>
tests/vpci: Use $(CC) instead of $(HOSTCC)
authorMichal Orzel <michal.orzel@amd.com>
Wed, 4 Jun 2025 07:21:28 +0000 (09:21 +0200)
committerRoger Pau Monne <roger.pau@citrix.com>
Mon, 9 Jun 2025 10:12:43 +0000 (12:12 +0200)
Depending on the build environment, HOSTCC can be different than CC. With
the recent `install` rule addition, this would put a binary of a wrong
format in the destdir (e.g. building tests on x86 host for Arm target).

Take the opportunity to adjust the `run` rule to only run the test if
HOSTCC is CC, else print a warning message.

Fixes: 96a587a05736 ("tools/tests: Add install target for vPCI")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
tools/tests/vpci/Makefile

index 9450f7593a417ab12e8b6560b14025bb9688757e..97359ff67f862aeb2c20fcd0fac9eb10c0d2b8a0 100644 (file)
@@ -8,10 +8,14 @@ all: $(TARGET)
 
 .PHONY: run
 run: $(TARGET)
+ifeq ($(CC),$(HOSTCC))
        ./$(TARGET)
+else
+       $(warning HOSTCC != CC, will not run test)
+endif
 
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
-       $(HOSTCC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c
+       $(CC) $(CFLAGS_xeninclude) -g -o $@ vpci.c main.c
 
 .PHONY: clean
 clean: