From a4e1d715f786c649b972f108e7af2ecba9a22765 Mon Sep 17 00:00:00 2001 From: Nick Connolly Date: Tue, 23 Feb 2021 08:58:06 +0000 Subject: [PATCH] mk: support file extension for executables Some platforms require that a specific file extension is used for executables. Append $(EXEEXT) to $(APP) definitions to accommodate this. The name EXEEXT has been chosen for consistency with automake which uses the same variable for the same purpose. Add extensions for generated files used by Windows to the 'clean' target (.obj, .lib, .pdb) and add output files to .gitignore. Tested using a cross compiler that forces a .exe suffix and verifying that all LINK messages include the correct suffix and that a second call to make does nothing (showing that the targets match the generated executables). Signed-off-by: Nick Connolly Change-Id: Ief012f6294d2f94b23c8b4f9747e21a0dfb91e96 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6494 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- .gitignore | 5 +++++ mk/spdk.app.mk | 2 ++ mk/spdk.app_cxx.mk | 2 ++ mk/spdk.common.mk | 3 ++- mk/spdk.unittest.mk | 2 +- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c9c85b925d..59c9c63051 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,17 @@ *.a *.cmd *.d +*.dll +*.exe *.gcda *.gcno *.kdev4 *.ko +*.lib *.log *.o +*.obj +*.pdb *.pyc *.so *.so.* diff --git a/mk/spdk.app.mk b/mk/spdk.app.mk index f6fb17a1f0..61a23d5e73 100644 --- a/mk/spdk.app.mk +++ b/mk/spdk.app.mk @@ -46,6 +46,8 @@ ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR))) endif endif +APP := $(APP)$(EXEEXT) + LIBS += $(SPDK_LIB_LINKER_ARGS) CLEAN_FILES = $(APP) diff --git a/mk/spdk.app_cxx.mk b/mk/spdk.app_cxx.mk index d035a18e15..c6b4e0cbe8 100644 --- a/mk/spdk.app_cxx.mk +++ b/mk/spdk.app_cxx.mk @@ -45,6 +45,8 @@ ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR))) endif endif +APP := $(APP)$(EXEEXT) + LIBS += $(SPDK_LIB_LINKER_ARGS) CLEAN_FILES = $(APP) diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index ba3c9d01cd..e64d8a17da 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -47,6 +47,7 @@ endif S ?= $(notdir $(CURDIR)) DESTDIR?= +EXEEXT?= ifneq ($(prefix),) CONFIG_PREFIX=$(prefix) @@ -354,7 +355,7 @@ LIB_C=\ # Clean up generated files listed as arguments plus a default list CLEAN_C=\ - $(Q)rm -f *.a *.o *.d *.d.tmp *.gcno *.gcda + $(Q)rm -f *.a *.lib *.o *.obj *.d *.d.tmp *.pdb *.gcno *.gcda # Install a library INSTALL_LIB=\ diff --git a/mk/spdk.unittest.mk b/mk/spdk.unittest.mk index 01d2bc3ec8..4dddb9a00e 100644 --- a/mk/spdk.unittest.mk +++ b/mk/spdk.unittest.mk @@ -56,7 +56,7 @@ SPDK_LIB_LIST += thread util log LIBS += -lcunit $(SPDK_STATIC_LIB_LINKER_ARGS) -APP = $(TEST_FILE:.c=) +APP = $(TEST_FILE:.c=)$(EXEEXT) ifneq ($(UNIT_TEST_LINK_ENV),1) ENV_LINKER_ARGS =