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>
.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: