Makefile: generate executable file name alternatively
This commit is contained in:
parent
d7e5e12126
commit
d404c4ff3a
1 changed files with 5 additions and 8 deletions
13
Makefile
13
Makefile
|
@ -17,18 +17,15 @@ SRC = $(wildcard $(SRCDIR)/*.c)
|
|||
OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
|
||||
DEP = $(OBJ:.o=.d)
|
||||
|
||||
PROGNAME_RELEASE = polonium
|
||||
PROGNAME_DEBUG = polonium_debug
|
||||
PROGNAME_BASE = polonium
|
||||
PROGNAME_SUFFIX_DEBUG = debug
|
||||
|
||||
EXECUTABLE = $(PROGNAME_BASE)
|
||||
ifeq ($(DEBUG), 1)
|
||||
EXECUTABLE = $(PROGNAME_DEBUG)
|
||||
else
|
||||
EXECUTABLE = $(PROGNAME_RELEASE)
|
||||
EXECUTABLE := $(EXECUTABLE)_$(PROGNAME_SUFFIX_DEBUG)
|
||||
endif
|
||||
|
||||
EXECPATH = $(BINDIR)/$(EXECUTABLE)
|
||||
EXECPATH_RELEASE = $(BINDIR)/$(PROGNAME_RELEASE)
|
||||
EXECPATH_DEBUG = $(BINDIR)/$(PROGNAME_DEBUG)
|
||||
|
||||
all: $(EXECPATH)
|
||||
|
||||
|
@ -64,7 +61,7 @@ define rmdir_if_empty
|
|||
endef
|
||||
|
||||
clean:
|
||||
$(call rmfiles_if_exist,$(EXECPATH_RELEASE) $(EXECPATH_DEBUG) $(DEP) $(OBJ))
|
||||
$(call rmfiles_if_exist,$(EXECPATH) $(DEP) $(OBJ))
|
||||
$(call rmdir_if_empty,$(BINDIR))
|
||||
$(call rmdir_if_empty,$(OBJDIR))
|
||||
|
||||
|
|
Loading…
Reference in a new issue