Makefile: fail if old build directories exist

After a checkout from before revision, old directories
such as bin/Linux64 only remain if untracked files exist
within. This may be confusing to the user. They may even
use an outdated executable if it is one of those untracked
files.
This commit is contained in:
James R 2021-06-22 15:14:42 -07:00
parent d5146945a6
commit 5f4d7e3c5b
2 changed files with 21 additions and 1 deletions

View File

@ -132,6 +132,10 @@ goals:=$(or $(MAKECMDGOALS),all)
cleanonly:=$(filter $(clean_targets),$(goals))
destructive:=$(filter-out info,$(cleanonly))
ifndef cleanonly
include Makefile.d/old.mk
endif
include Makefile.d/util.mk
ifdef PREFIX
@ -399,7 +403,7 @@ clean :
$(call _rm,$(exe) $(dbg) $(dbg).txt $(objects))
distclean :
$(call _rm,../bin ../objs ../deps comptime.h)
$(call _rm,../bin ../objs ../deps ../make comptime.h)
info:
ifdef WINDOWSHELL

16
src/Makefile.d/old.mk Normal file
View File

@ -0,0 +1,16 @@
#
# Warn about old build directories and offer to purge.
#
_old:=$(wildcard $(addprefix ../bin/,FreeBSD Linux \
Linux64 Mingw Mingw64 SDL dummy) ../objs ../deps)
ifdef _old
$(foreach v,$(_old),$(info $(abspath $(v))))
$(info )
$(info These directories are no longer\
required and should be removed.)
$(info You may remove them manually or\
by using 'make distclean')
$(error )
endif