Makefile: generate executable file name alternatively

This commit is contained in:
Intel A80486DX2-66 2024-07-08 20:50:46 +03:00
parent d7e5e12126
commit d404c4ff3a
Signed by: 80486DX2-66
GPG key ID: 83631EF27054609B

View file

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