1 # Default platform if no platform specified
4 # Standalone Mode info (path depends if make is called at top or from armsrc)
5 # Guard Makefile.hal against implicit rules: (with % to avoid being first goal)
7 -include armsrc/Standalone/Makefile.hal
8 -include Standalone/Makefile.hal
9 ifndef DEFAULT_STANDALONE
10 $(error Could not find armsrc/Standalone/Makefile.hal)
13 define KNOWN_PLATFORM_DEFINITIONS
17 +============================================+
18 | PLATFORM | DESCRIPTION |
19 +============================================+
20 | PM3RDV4 (def) | Proxmark3 RDV4 |
21 +--------------------------------------------+
22 | PM3GENERIC | Proxmark3 generic target |
23 +--------------------------------------------+
25 +============================================+
26 | PLATFORM_EXTRAS | DESCRIPTION |
27 +============================================+
28 | BTADDON | Proxmark3 RDV4 BT add-on |
29 +--------------------------------------------+
33 define HELP_DEFINITIONS
34 Options to define platform, platform extras and/or standalone mode:
35 (1) Run make with your PLATFORM, PLATFORM_EXTRAS and/or STANDALONE choices as follows:
36 make PLATFORM=PM3GENERIC STANDALONE=$(HELP_EXAMPLE_STANDALONE)
38 (2) Save a file called Makefile.platform with contents, e.g.:
41 or if you have a Proxmark 3 RDV4 with the BT add-on:
43 PLATFORM_EXTRAS=BTADDON
45 Default standalone mode is $(DEFAULT_STANDALONE).
46 To disable standalone modes, set explicitly an empty STANDALONE:
49 For Proxmarks with only 256k, you can define
51 to be warned if the image is too big for your device
52 and you can specify which parts to skip in order to reduce the size:
67 define KNOWN_DEFINITIONS
68 $(KNOWN_PLATFORM_DEFINITIONS)
69 $(KNOWN_STANDALONE_DEFINITIONS)
73 PLTNAME = Unknown Platform
75 ifeq ($(PLATFORM),PM3RDV4)
76 PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH -DRDV4
77 PLTNAME = Proxmark3 RDV4
78 else ifeq ($(PLATFORM),PM3OTHER)
79 $(warning PLATFORM=PM3OTHER is deprecated, please use PLATFORM=PM3GENERIC)
80 PLTNAME = Proxmark3 generic target
81 else ifeq ($(PLATFORM),PM3GENERIC)
82 PLTNAME = Proxmark3 generic target
85 $(error Invalid or empty PLATFORM: $(PLATFORM). $(KNOWN_DEFINITIONS))
88 # parsing additional PLATFORM_EXTRAS tokens
89 PLATFORM_EXTRAS_TMP:=$(PLATFORM_EXTRAS)
90 ifneq (,$(findstring BTADDON,$(PLATFORM_EXTRAS_TMP)))
91 PLATFORM_DEFS += -DWITH_FPC_USART_HOST
92 PLATFORM_EXTRAS_TMP := $(strip $(filter-out BTADDON,$(PLATFORM_EXTRAS_TMP)))
94 ifneq (,$(findstring FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
95 PLATFORM_DEFS += -DWITH_FPC_USART_DEV
96 PLATFORM_EXTRAS_TMP := $(strip $(filter-out FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
98 ifneq (,$(PLATFORM_EXTRAS_TMP))
99 $(error Unknown PLATFORM_EXTRAS token(s): $(PLATFORM_EXTRAS_TMP))
104 PLATFORM_DEFS += -DWITH_LF
106 ifneq ($(SKIP_HITAG),1)
107 PLATFORM_DEFS += -DWITH_HITAG
109 ifneq ($(SKIP_EM4x50),1)
110 PLATFORM_DEFS += -DWITH_EM4x50
112 ifneq ($(SKIP_EM4x70),1)
113 PLATFORM_DEFS += -DWITH_EM4x70
117 ifneq ($(SKIP_ISO15693),1)
118 PLATFORM_DEFS += -DWITH_ISO15693
120 ifneq ($(SKIP_LEGICRF),1)
121 PLATFORM_DEFS += -DWITH_LEGICRF
123 ifneq ($(SKIP_ISO14443b),1)
124 PLATFORM_DEFS += -DWITH_ISO14443b
126 ifneq ($(SKIP_ISO14443a),1)
127 PLATFORM_DEFS += -DWITH_ISO14443a
129 ifneq ($(SKIP_ICLASS),1)
130 PLATFORM_DEFS += -DWITH_ICLASS
132 ifneq ($(SKIP_FELICA),1)
133 PLATFORM_DEFS += -DWITH_FELICA
135 ifneq ($(SKIP_NFCBARCODE),1)
136 PLATFORM_DEFS += -DWITH_NFCBARCODE
138 ifneq ($(SKIP_HFSNIFF),1)
139 PLATFORM_DEFS += -DWITH_HFSNIFF
141 ifneq ($(SKIP_HFPLOT),1)
142 PLATFORM_DEFS += -DWITH_HFPLOT
144 ifeq ($(SKIP_COMPRESSION),1)
145 PLATFORM_DEFS += -DWITH_NO_COMPRESSION
149 ifneq ($(strip $(filter $(PLATFORM_DEFS),$(STANDALONE_REQ_DEFS))),$(strip $(STANDALONE_REQ_DEFS)))
150 $(error Chosen Standalone mode $(STANDALONE) requires $(strip $(STANDALONE_REQ_DEFS)), unsupported by $(PLTNAME))
152 ifneq (,$(STANDALONE_PLATFORM_DEFS))
153 PLATFORM_DEFS+=$(STANDALONE_PLATFORM_DEFS)
156 $(info $(findstring WITH_STANDALONE_*,$(PLATFORM_DEFS)))
159 ifneq (,$(findstring WITH_LCD,$(PLATFORM_DEFS)))
160 #PLATFORM_DEFS += -DWITH_LCD
163 # Add flags dependencies :
165 # WITH_FPC_USART_* needs WITH_FPC_USART :
166 ifneq (,$(findstring WITH_FPC_USART_,$(PLATFORM_DEFS)))
167 PLATFORM_DEFS += -DWITH_FPC_USART
170 PLATFORM_DEFS_INFO = $(strip $(filter-out STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS))))
171 PLATFORM_DEFS_INFO_STANDALONE = $(strip $(subst STANDALONE_,, $(filter STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS)))))
173 # Check that only one Standalone mode has been chosen
174 ifneq (,$(word 2, $(PLATFORM_DEFS_INFO_STANDALONE)))
175 $(error You must choose only one Standalone mode!: $(PLATFORM_DEFS_INFO_STANDALONE))
178 PLATFORM_EXTRAS_INFO = $(PLATFORM_EXTRAS)
180 ifeq (,$(PLATFORM_EXTRAS_INFO))
181 PLATFORM_EXTRAS_INFO = No extra selected
184 # info when no standalone mode
185 ifeq (,$(PLATFORM_DEFS_INFO_STANDALONE))
186 PLATFORM_DEFS_INFO_STANDALONE = No standalone mode selected
189 ifeq ($(PLATFORM_SIZE),)
193 PLATFORM_CHANGED=false
194 ifneq ($(PLATFORM), $(CACHED_PLATFORM))
195 PLATFORM_CHANGED=true
196 else ifneq ($(PLATFORM_EXTRAS), $(CACHED_PLATFORM_EXTRAS))
197 PLATFORM_CHANGED=true
198 else ifneq ($(PLATFORM_DEFS), $(CACHED_PLATFORM_DEFS))
199 PLATFORM_CHANGED=true
203 export PLATFORM_EXTRAS
204 export PLATFORM_EXTRAS_INFO
208 export PLATFORM_DEFS_INFO
209 export PLATFORM_DEFS_INFO_STANDALONE
210 export PLATFORM_CHANGED
212 $(info ===================================================================)
213 $(info Platform name: $(PLTNAME))
214 $(info PLATFORM: $(PLATFORM))
215 $(info PLATFORM_SIZE: $(PLATFORM_SIZE))
216 $(info Platform extras: $(PLATFORM_EXTRAS_INFO))
217 $(info Included options: $(PLATFORM_DEFS_INFO))
218 $(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE))
219 $(info ===================================================================)