Fix basic makefile using unspecified behavior

This commit is contained in:
rexy712 2021-04-19 12:49:51 -07:00
parent c3759e2802
commit 9a56b99f27

View File

@ -11,7 +11,7 @@
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#Copyright 2018-2020 rexy712
#Copyright 2018-2021 rexy712
#Makefile to generate a single executable from all sources in SOURCE_DIRS that end in EXT
@ -72,7 +72,7 @@ endif #windows
all::
#main target
all:: | flags-update $(MAIN_EXECUTABLE)
all:: $(MAIN_EXECUTABLE)
#postrun targets
all::
@ -162,25 +162,23 @@ define \n
endef
.PHONY: cflags-update
cflags-update:
ifeq ($(SAVEFLAGS),1)
ifneq ($(subst -MF"$(DEPDIR)/",-MF"$(DEPDIR)/cflags-update",$(ALL_COMPILEFLAGS)),$(OLD_COMPILEFLAGS))
ifneq ($(subst -MF"$(DEPDIR)/",-MF"$(DEPDIR)/$(CFLAGS_TMPFILE)",$(ALL_COMPILEFLAGS)),$(OLD_COMPILEFLAGS))
.PHONY: $(CFLAGS_TMPFILE)
$(CFLAGS_TMPFILE):
$(file >$(CFLAGS_TMPFILE),$(ALL_COMPILEFLAGS))
endif
$(CFLAGS_TMPFILE): cflags-update
endif
.PHONY: ldflags-update
ldflags-update:
ifeq ($(SAVEFLAGS),1)
ifneq ($(ALL_LINKFLAGS),$(OLD_LINKFLAGS))
$(file >$(LDFLAGS_TMPFILE),$(ALL_LINKFLAGS))
endif
$(LDFLAGS_TMPFILE): ldflags-update
else
$(CFLAGS_TMPFILE):
endif
.PHONY: flags-update
flags-update: cflags-update ldflags-update
ifneq ($(ALL_LINKFLAGS),$(OLD_LINKFLAGS))
.PHONY: $(LDFLAGS_TMPFILE)
$(LDFLAGS_TMPFILE):
$(file >$(LDFLAGS_TMPFILE),$(ALL_LINKFLAGS))
else
$(LDFLAGS_TMPFILE):
endif
endif
#Link executable
$(MAIN_EXECUTABLE): $(OBJECTS) $(LDFLAGS_TMPFILE)