mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
Automate make clean when platform definitions are changed
This commit is contained in:
parent
9b668e3827
commit
355319e36a
4 changed files with 34 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -24,6 +24,8 @@ version.c
|
|||
|
||||
# new build file for add-ons.
|
||||
Makefile.platform
|
||||
# Cache for detecting platform def changes
|
||||
.Makefile.options.cache
|
||||
|
||||
!client/hardnested/*.bin
|
||||
!client/hardnested/tables/*.z
|
||||
|
|
21
Makefile
21
Makefile
|
@ -25,6 +25,7 @@ endif
|
|||
|
||||
ifeq ($(PLATFORM),)
|
||||
-include Makefile.platform
|
||||
-include .Makefile.options.cache
|
||||
ifeq ($(PLATFORM),)
|
||||
PLATFORM=PM3RDV4
|
||||
else
|
||||
|
@ -54,17 +55,17 @@ mfkey/%: FORCE
|
|||
$(MAKE) -C tools/mfkey $(patsubst mfkey/%,%,$@)
|
||||
nonce2key/%: FORCE
|
||||
$(MAKE) -C tools/nonce2key $(patsubst nonce2key/%,%,$@)
|
||||
bootrom/%: FORCE
|
||||
bootrom/%: FORCE cleanifplatformchanged
|
||||
$(MAKE) -C bootrom $(patsubst bootrom/%,%,$@)
|
||||
armsrc/%: FORCE
|
||||
armsrc/%: FORCE cleanifplatformchanged
|
||||
$(MAKE) -C armsrc $(patsubst armsrc/%,%,$@)
|
||||
client/%: FORCE
|
||||
$(MAKE) -C client $(patsubst client/%,%,$@)
|
||||
recovery/%: FORCE bootrom/% armsrc/%
|
||||
recovery/%: FORCE cleanifplatformchanged bootrom/% armsrc/%
|
||||
$(MAKE) -C recovery $(patsubst recovery/%,%,$@)
|
||||
FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites)
|
||||
|
||||
.PHONY: all clean help _test bootrom flash-bootrom os flash-os flash-all recovery client mfkey nounce2key style checks FORCE udev accessrights
|
||||
.PHONY: all clean help _test bootrom flash-bootrom os flash-os flash-all recovery client mfkey nounce2key style checks FORCE udev accessrights cleanifplatformchanged
|
||||
|
||||
help:
|
||||
@echo "Multi-OS Makefile"
|
||||
|
@ -117,6 +118,18 @@ newtarbin:
|
|||
tarbin: newtarbin client/tarbin armsrc/tarbin bootrom/tarbin
|
||||
$(GZIP) proxmark3-$(platform)-bin.tar
|
||||
|
||||
# detect if there were changes in the platform definitions, requiring a clean
|
||||
cleanifplatformchanged:
|
||||
ifeq ($(PLATFORM_CHANGED), true)
|
||||
echo "Platform definitions changed, cleaning bootrom/armsrc/recovery first..."
|
||||
$(MAKE) -C bootrom clean
|
||||
$(MAKE) -C armsrc clean
|
||||
$(MAKE) -C recovery clean
|
||||
@echo CACHED_PLATFORM=$(PLATFORM) > .Makefile.options.cache
|
||||
@echo CACHED_PLATFORM_EXTRAS=$(PLATFORM_EXTRAS) >> .Makefile.options.cache
|
||||
@echo CACHED_PLATFORM_DEFS=$(PLATFORM_DEFS) >> .Makefile.options.cache
|
||||
endif
|
||||
|
||||
# configure system to ignore PM3 device as a modem (ModemManager blacklist, effective *only* if ModemManager is not using _strict_ policy)
|
||||
# Read doc/md/ModemManager-Must-Be-Discarded.md for more info
|
||||
udev:
|
||||
|
|
|
@ -11,6 +11,7 @@ APP_INCLUDES = apps.h
|
|||
# This Makefile might have been called directly, not via the root Makefile, so:
|
||||
ifeq ($(PLTNAME),)
|
||||
-include ../Makefile.platform
|
||||
-include ../.Makefile.options.cache
|
||||
ifeq ($(PLATFORM),)
|
||||
PLATFORM=PM3RDV4
|
||||
else
|
||||
|
@ -30,6 +31,11 @@ ifeq ($(PLTNAME),)
|
|||
$(info Included options: $(PLATFORM_DEFS_INFO))
|
||||
$(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE))
|
||||
$(info ===================================================================)
|
||||
|
||||
# detect if there were changes in the platform definitions, requiring a clean
|
||||
ifeq ($(PLATFORM_CHANGED), true)
|
||||
$(error platform definitions have been changed, please "make clean" at the root of the project)
|
||||
endif
|
||||
endif
|
||||
|
||||
#remove one of the following defines and comment out the relevant line
|
||||
|
|
|
@ -163,3 +163,12 @@ export MCU
|
|||
export PLATFORM_DEFS
|
||||
export PLATFORM_DEFS_INFO
|
||||
export PLATFORM_DEFS_INFO_STANDALONE
|
||||
|
||||
PLATFORM_CHANGED=false
|
||||
ifneq ($(PLATFORM), $(CACHED_PLATFORM))
|
||||
PLATFORM_CHANGED=true
|
||||
else ifneq ($(PLATFORM_EXTRAS), $(CACHED_PLATFORM_EXTRAS))
|
||||
PLATFORM_CHANGED=true
|
||||
else ifneq ($(PLATFORM_DEFS), $(CACHED_PLATFORM_DEFS))
|
||||
PLATFORM_CHANGED=true
|
||||
endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue