forked from RfidResearchGroup/proxmark3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.hal
160 lines (130 loc) · 4.83 KB
/
Makefile.hal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Default platform if no platform specified
PLATFORM?=PM3RDV4
# Standalone Mode info (path depends if make is called at top or from armsrc)
# Guard Makefile.hal against implicit rules: (with % to avoid being first goal)
%/Makefile.hal: ;
-include armsrc/Standalone/Makefile.hal
-include Standalone/Makefile.hal
ifndef DEFAULT_STANDALONE
$(error Could not find armsrc/Standalone/Makefile.hal)
endif
define KNOWN_PLATFORM_DEFINITIONS
Known definitions:
+============================================+
| PLATFORM | DESCRIPTION |
+============================================+
| PM3RDV4 (def) | Proxmark3 rdv4 |
+--------------------------------------------+
| PM3OTHER | Proxmark3 Generic target |
+--------------------------------------------+
+============================================+
| PLATFORM_EXTRAS | DESCRIPTION |
+============================================+
| BTADDON | Proxmark3 rdv4 BT add-on |
+--------------------------------------------+
endef
define HELP_DEFINITIONS
Options to define platform, platform extras and/or standalone mode:
(1) Run make with your PLATFORM, PLATFORM_EXTRAS and/or STANDALONE choices as follows:
make PLATFORM=PM3OTHER STANDALONE=$(HELP_EXAMPLE_STANDALONE)
(2) Save a file called Makefile.platform with contents, e.g.:
PLATFORM=PM3OTHER
or if you have a Proxmark 3 RDV4 with the BT add-on:
PLATFORM=PM3RDV4
PLATFORM_EXTRAS=BTADDON
Default standalone mode is $(DEFAULT_STANDALONE).
To disable standalone modes, set explicitly an empty STANDALONE:
STANDALONE=
endef
define KNOWN_DEFINITIONS
$(KNOWN_PLATFORM_DEFINITIONS)
$(KNOWN_STANDALONE_DEFINITIONS)
$(HELP_DEFINITIONS)
endef
PLTNAME = Unknown Platform
ifeq ($(PLATFORM),PM3RDV4)
PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH
PLTNAME = Proxmark3 rdv4
else ifeq ($(PLATFORM),PM3OTHER)
PLTNAME = Proxmark3 Generic target
else
$(error Invalid or empty PLATFORM: $(PLATFORM). $(KNOWN_DEFINITIONS))
endif
# parsing additional PLATFORM_EXTRAS tokens
PLATFORM_EXTRAS_TMP:=$(PLATFORM_EXTRAS)
ifneq (,$(findstring BTADDON,$(PLATFORM_EXTRAS_TMP)))
PLATFORM_DEFS += -DWITH_FPC_USART_HOST
PLATFORM_EXTRAS_TMP := $(strip $(filter-out BTADDON,$(PLATFORM_EXTRAS_TMP)))
endif
ifneq (,$(findstring FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
PLATFORM_DEFS += -DWITH_FPC_USART_DEV
PLATFORM_EXTRAS_TMP := $(strip $(filter-out FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
endif
ifneq (,$(PLATFORM_EXTRAS_TMP))
$(error Unknown PLATFORM_EXTRAS token(s): $(PLATFORM_EXTRAS_TMP))
endif
# common LF support
PLATFORM_DEFS += \
-DWITH_LF \
-DWITH_HITAG
# common HF support
PLATFORM_DEFS += \
-DWITH_ISO15693 \
-DWITH_LEGICRF \
-DWITH_ISO14443b \
-DWITH_ISO14443a \
-DWITH_ICLASS \
-DWITH_FELICA \
-DWITH_NFCBARCODE \
-DWITH_HFSNIFF
# Standalone mode
ifneq ($(strip $(filter $(PLATFORM_DEFS),$(STANDALONE_REQ_DEFS))),$(strip $(STANDALONE_REQ_DEFS)))
$(error Chosen Standalone mode $(STANDALONE) requires $(strip $(STANDALONE_REQ_DEFS)), unsupported by $(PLTNAME))
endif
PLATFORM_DEFS+=$(STANDALONE_PLATFORM_DEFS)
$(info $(findstring WITH_STANDALONE_*,$(PLATFORM_DEFS)))
# Misc
#PLATFORM_DEFS += -DWITH_LCD
# Add flags dependencies :
# WITH_FPC_USART_* needs WITH_FPC_USART :
ifneq (,$(findstring WITH_FPC_USART_,$(PLATFORM_DEFS)))
PLATFORM_DEFS += -DWITH_FPC_USART
endif
PLATFORM_DEFS_INFO = $(strip $(filter-out STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS))))
PLATFORM_DEFS_INFO_STANDALONE = $(strip $(subst STANDALONE_,, $(filter STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS)))))
# Check that only one Standalone mode has been chosen
ifneq (,$(word 2, $(PLATFORM_DEFS_INFO_STANDALONE)))
$(error You must choose only one Standalone mode!: $(PLATFORM_DEFS_INFO_STANDALONE))
endif
PLATFORM_EXTRAS_INFO = $(PLATFORM_EXTRAS)
# info when no extra
ifeq (,$(PLATFORM_EXTRAS_INFO))
PLATFORM_EXTRAS_INFO = No extra selected
endif
# info when no standalone mode
ifeq (,$(PLATFORM_DEFS_INFO_STANDALONE))
PLATFORM_DEFS_INFO_STANDALONE = No standalone mode selected
endif
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
export PLATFORM
export PLATFORM_EXTRAS
export PLATFORM_EXTRAS_INFO
export PLTNAME
export PLATFORM_DEFS
export PLATFORM_DEFS_INFO
export PLATFORM_DEFS_INFO_STANDALONE
export PLATFORM_CHANGED
$(info ===================================================================)
$(info Platform name: $(PLTNAME))
$(info PLATFORM: $(PLATFORM))
$(info Platform extras: $(PLATFORM_EXTRAS_INFO))
$(info Included options: $(PLATFORM_DEFS_INFO))
$(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE))
$(info ===================================================================)