Skip to content

Commit

Permalink
mk: support file extension for executables
Browse files Browse the repository at this point in the history
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 <[email protected]>
Change-Id: Ief012f6294d2f94b23c8b4f9747e21a0dfb91e96
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6494
Tested-by: SPDK CI Jenkins <[email protected]>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <[email protected]>
Reviewed-by: Ben Walker <[email protected]>
  • Loading branch information
nconnolly1 authored and tomzawadzki committed Mar 15, 2021
1 parent 9854c13 commit a4e1d71
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
*.a
*.cmd
*.d
*.dll
*.exe
*.gcda
*.gcno
*.kdev4
*.ko
*.lib
*.log
*.o
*.obj
*.pdb
*.pyc
*.so
*.so.*
Expand Down
2 changes: 2 additions & 0 deletions mk/spdk.app.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR)))
endif
endif

APP := $(APP)$(EXEEXT)

LIBS += $(SPDK_LIB_LINKER_ARGS)

CLEAN_FILES = $(APP)
Expand Down
2 changes: 2 additions & 0 deletions mk/spdk.app_cxx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ ifneq (,$(findstring $(SPDK_ROOT_DIR)/examples,$(CURDIR)))
endif
endif

APP := $(APP)$(EXEEXT)

LIBS += $(SPDK_LIB_LINKER_ARGS)

CLEAN_FILES = $(APP)
Expand Down
3 changes: 2 additions & 1 deletion mk/spdk.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ endif
S ?= $(notdir $(CURDIR))

DESTDIR?=
EXEEXT?=

ifneq ($(prefix),)
CONFIG_PREFIX=$(prefix)
Expand Down Expand Up @@ -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=\
Expand Down
2 changes: 1 addition & 1 deletion mk/spdk.unittest.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit a4e1d71

Please sign in to comment.