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 <nick.connolly@mayadata.io>
Change-Id: Ief012f6294d2f94b23c8b4f9747e21a0dfb91e96
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6494
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Nick Connolly 2021-02-23 08:58:06 +00:00 committed by Tomasz Zawadzki
parent 9854c138f7
commit a4e1d715f7
5 changed files with 12 additions and 2 deletions

5
.gitignore vendored
View File

@ -2,12 +2,17 @@
*.a
*.cmd
*.d
*.dll
*.exe
*.gcda
*.gcno
*.kdev4
*.ko
*.lib
*.log
*.o
*.obj
*.pdb
*.pyc
*.so
*.so.*

View File

@ -46,6 +46,8 @@ ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR)))
endif
endif
APP := $(APP)$(EXEEXT)
LIBS += $(SPDK_LIB_LINKER_ARGS)
CLEAN_FILES = $(APP)

View File

@ -45,6 +45,8 @@ ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR)))
endif
endif
APP := $(APP)$(EXEEXT)
LIBS += $(SPDK_LIB_LINKER_ARGS)
CLEAN_FILES = $(APP)

View File

@ -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=\

View File

@ -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 =