Merge branch 'RfidResearchGroup:master' into spi_flash_v2
[RRG-proxmark3.git] / Makefile
blob960fc755726b96c5245e29ac756a160a3b97701c
1 #-----------------------------------------------------------------------------
2 # Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # See LICENSE.txt for the text of the license.
15 #-----------------------------------------------------------------------------
17 -include Makefile.platform
18 -include .Makefile.options.cache
19 include Makefile.defs
20 include common_arm/Makefile.hal
22 # preserve relative DESTDIR path for subdir makes
23 ifneq (,$(DESTDIR))
24 # realpath needs the directory to exist
25 $(shell $(MKDIR) $(DESTDIR))
26 MYDESTDIR:=$(realpath $(DESTDIR))
27 ifeq (,$(MYDESTDIR))
28 $(error Can't create $(DESTDIR))
29 endif
30 endif
32 all clean install uninstall check: %: client/% bootrom/% armsrc/% recovery/% mfc_card_only/% mfc_card_reader/% mfd_aes_brute/% fpga_compress/% cryptorf/%
33 # hitag2crack toolsuite is not yet integrated in "all", it must be called explicitly: "make hitag2crack"
34 #all clean install uninstall check: %: hitag2crack/%
36 INSTALLTOOLS=mfc/pm3_eml2lower.sh mfc/pm3_eml2upper.sh mfc/pm3_mfdread.py mfc/pm3_mfd2eml.py mfc/pm3_eml2mfd.py pm3_amii_bin2eml.pl pm3_reblay-emulating.py pm3_reblay-reading.py
37 INSTALLSIMFW=sim011.bin sim011.sha512.txt sim013.bin sim013.sha512.txt sim014.bin sim014.sha512.txt
38 INSTALLSCRIPTS=pm3 pm3-flash pm3-flash-all pm3-flash-bootrom pm3-flash-fullimage
39 INSTALLSHARES=tools/jtag_openocd traces
40 INSTALLDOCS=doc/*.md doc/md
42 install: common/install
44 common/install:
45 $(info [@] Installing common resources to $(MYDESTDIR)$(PREFIX)...)
46 ifneq (,$(INSTALLSCRIPTS))
47 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLBINRELPATH)
48 $(Q)$(INSTALLSUDO) $(CP) $(INSTALLSCRIPTS) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLBINRELPATH)
49 endif
50 ifneq (,$(INSTALLSHARES))
51 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLSHARERELPATH)
52 $(Q)$(INSTALLSUDO) $(CP) $(INSTALLSHARES) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLSHARERELPATH)
53 endif
54 ifneq (,$(INSTALLDOCS))
55 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLDOCSRELPATH)
56 $(Q)$(INSTALLSUDO) $(CP) $(INSTALLDOCS) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLDOCSRELPATH)
57 endif
58 ifneq (,$(INSTALLTOOLS))
59 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLTOOLSRELPATH)
60 $(Q)$(INSTALLSUDO) $(CP) $(foreach tool,$(INSTALLTOOLS),tools/$(tool)) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLTOOLSRELPATH)
61 endif
62 ifneq (,$(INSTALLSIMFW))
63 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
64 $(Q)$(INSTALLSUDO) $(CP) $(foreach fw,$(INSTALLSIMFW),client/resources/$(fw)) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
65 endif
66 ifeq ($(platform),Linux)
67 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(UDEV_PREFIX)
68 # If user is running ArchLinux, use group 'uucp'
69 # Else, use group 'dialout'
70 ifneq ($(wildcard /etc/arch-release),)
71 $(Q)$(INSTALLSUDO) $(CP) driver/77-pm3-usb-device-blacklist-uucp.rules $(DESTDIR)$(UDEV_PREFIX)/77-pm3-usb-device-blacklist.rules
72 else
73 $(Q)$(INSTALLSUDO) $(CP) driver/77-pm3-usb-device-blacklist-dialout.rules $(DESTDIR)$(UDEV_PREFIX)/77-pm3-usb-device-blacklist.rules
74 endif
75 endif
77 uninstall: common/uninstall
79 common/uninstall:
80 $(info [@] Uninstalling common resources from $(MYDESTDIR)$(PREFIX)...)
81 ifneq (,$(INSTALLSCRIPTS))
82 $(Q)$(INSTALLSUDO) $(RM) $(foreach script,$(INSTALLSCRIPTS),$(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLBINRELPATH)$(PATHSEP)$(notdir $(script)))
83 endif
85 ifneq (,$(INSTALLSHARES))
86 $(Q)$(INSTALLSUDO) $(RMDIR) $(foreach share,$(INSTALLSHARES),$(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLSHARERELPATH)$(PATHSEP)$(notdir $(share)))
87 endif
89 ifneq (,$(INSTALLDOCS))
90 $(Q)$(INSTALLSUDO) $(RMDIR) $(foreach doc,$(INSTALLDOCS),$(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLDOCSRELPATH)$(PATHSEP)$(notdir $(doc)))
91 $(Q)-$(INSTALLSUDO) $(RMDIR_SOFT) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLDOCSRELPATH)
92 endif
94 ifneq (,$(INSTALLTOOLS))
95 $(Q)$(INSTALLSUDO) $(RM) $(foreach tool,$(INSTALLTOOLS),$(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLTOOLSRELPATH)$(PATHSEP)$(notdir $(tool)))
96 endif
98 $(Q)-$(INSTALLSUDO) $(RMDIR_SOFT) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLTOOLSRELPATH)
100 ifneq (,$(INSTALLSIMFW))
101 $(Q)$(INSTALLSUDO) $(RM) $(foreach fw,$(INSTALLSIMFW),$(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(notdir $(fw)))
102 endif
104 $(Q)-$(INSTALLSUDO) $(RMDIR_SOFT) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
106 ifeq ($(platform),Linux)
107 $(Q)$(INSTALLSUDO) $(RM) $(DESTDIR)$(UDEV_PREFIX)/77-pm3-usb-device-blacklist.rules
108 endif
109 $(Q)-$(INSTALLSUDO) $(RMDIR_SOFT) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLSHARERELPATH)
111 # tests
112 cryptorf/check: FORCE
113 $(info [*] CHECK $(patsubst %/check,%,$@))
114 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
115 mfc_card_only/check: FORCE
116 $(info [*] CHECK $(patsubst %/check,%,$@))
117 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) nonce2key staticnested $(patsubst %/check,%,$@)
118 mfc_card_reader/check: FORCE
119 $(info [*] CHECK $(patsubst %/check,%,$@))
120 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) mfkey mf_nonce_brute $(patsubst %/check,%,$@)
121 mfd_aes_brute/check: FORCE
122 $(info [*] CHECK $(patsubst %/check,%,$@))
123 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
124 fpga_compress/check: FORCE
125 $(info [*] CHECK $(patsubst %/check,%,$@))
126 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
127 bootrom/check: FORCE
128 $(info [*] CHECK $(patsubst %/check,%,$@))
129 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
130 armsrc/check: FORCE
131 $(info [*] CHECK $(patsubst %/check,%,$@))
132 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
133 client/check: FORCE
134 $(info [*] CHECK $(patsubst %/check,%,$@))
135 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
136 recovery/check: FORCE
137 $(info [*] CHECK $(patsubst %/check,%,$@))
138 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
139 hitag2crack/check: FORCE
140 $(info [*] CHECK $(patsubst %/check,%,$@))
141 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
142 common/check: FORCE
143 $(info [*] CHECK $(patsubst %/check,%,$@))
144 $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
145 check: common/check
146 $(info [*] ALL CHECKS DONE)
148 cryptorf/%: FORCE
149 $(info [*] MAKE $@)
150 $(Q)$(MAKE) --no-print-directory -C tools/cryptorf $(patsubst cryptorf/%,%,$@) DESTDIR=$(MYDESTDIR)
151 mfc_card_only/%: FORCE
152 $(info [*] MAKE $@)
153 $(Q)$(MAKE) --no-print-directory -C tools/mfc/card_only $(patsubst mfc_card_only/%,%,$@) DESTDIR=$(MYDESTDIR)
154 mfc_card_reader/%: FORCE
155 $(info [*] MAKE $@)
156 $(Q)$(MAKE) --no-print-directory -C tools/mfc/card_reader $(patsubst mfc_card_reader/%,%,$@) DESTDIR=$(MYDESTDIR)
157 mfd_aes_brute/%: FORCE
158 $(info [*] MAKE $@)
159 $(Q)$(MAKE) --no-print-directory -C tools/mfd_aes_brute $(patsubst mfd_aes_brute/%,%,$@) DESTDIR=$(MYDESTDIR)
160 fpga_compress/%: FORCE cleanifplatformchanged
161 $(info [*] MAKE $@)
162 $(Q)$(MAKE) --no-print-directory -C tools/fpga_compress $(patsubst fpga_compress/%,%,$@) DESTDIR=$(MYDESTDIR)
163 bootrom/%: FORCE cleanifplatformchanged
164 $(info [*] MAKE $@)
165 $(Q)$(MAKE) --no-print-directory -C bootrom $(patsubst bootrom/%,%,$@) DESTDIR=$(MYDESTDIR)
166 armsrc/%: FORCE cleanifplatformchanged fpga_compress/%
167 $(info [*] MAKE $@)
168 $(Q)$(MAKE) --no-print-directory -C armsrc $(patsubst armsrc/%,%,$@) DESTDIR=$(MYDESTDIR)
169 client/%: FORCE cleanifplatformchanged
170 $(info [*] MAKE $@)
171 $(Q)$(MAKE) --no-print-directory -C client $(patsubst client/%,%,$@) DESTDIR=$(MYDESTDIR)
172 recovery/all: bootrom/all armsrc/all
173 recovery/install: bootrom/install armsrc/install
174 recovery/%: FORCE cleanifplatformchanged
175 $(info [*] MAKE $@)
176 $(Q)$(MAKE) --no-print-directory -C recovery $(patsubst recovery/%,%,$@) DESTDIR=$(MYDESTDIR)
177 hitag2crack/%: FORCE
178 $(info [*] MAKE $@)
179 $(Q)$(MAKE) --no-print-directory -C tools/hitag2crack $(patsubst hitag2crack/%,%,$@) DESTDIR=$(MYDESTDIR)
180 FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites)
182 .PHONY: all clean install uninstall help _test bootrom fullimage recovery client mfc_card_only mfc_card_reader mfd_aes_brute hitag2crack style miscchecks release FORCE udev accessrights cleanifplatformchanged
184 help:
185 @echo "Multi-OS Makefile"
186 @echo
187 @echo "Possible targets:"
188 @echo "+ all - Make all targets: bootrom, fullimage and OS-specific host tools"
189 @echo "+ clean - Clean in all targets"
190 @echo "+ .../clean - Clean in specified target and its deps, e.g. bootrom/clean"
191 @echo "+ (un)install - Install/uninstall Proxmark files in the system, default to /usr/local/share,"
192 @echo " else provide a PREFIX. See Maintainers.md for more options"
193 @echo
194 @echo "+ bootrom - Make bootrom"
195 @echo "+ fullimage - Make armsrc fullimage (includes fpga)"
196 @echo "+ recovery - Make bootrom and fullimage files for JTAG flashing"
197 @echo
198 @echo "+ client - Make only the OS-specific host client"
199 @echo "+ cryptorf - Make tools/cryptorf"
200 @echo "+ mfc_card_only - Make tools/mfc/card_only"
201 @echo "+ mfc_card_reader - Make tools/mfc/card_reader"
202 @echo "+ mfd_aes_brute - Make tools/mfd_aes_brute"
203 @echo "+ hitag2crack - Make tools/hitag2crack"
204 @echo "+ fpga_compress - Make tools/fpga_compress"
205 @echo
206 @echo "+ style - Apply some automated source code formatting rules"
207 @echo "+ check - Run offline tests. Set CHECKARGS to pass arguments to the test script"
208 @echo "+ .../check - Run offline tests against specific target. See above."
209 @echo "+ miscchecks - Detect various encoding issues in source code"
210 @echo
211 @echo "+ udev - Sets udev rules on *nix"
212 @echo "+ accessrights - Ensure user belongs to correct group on *nix"
213 @echo
214 @echo "To see possible platforms. default is PM3RDV4"
215 @echo " make PLATFORM="
216 @echo
217 @echo "For verbose mode"
218 @echo " make V=1"
219 @echo
221 client: client/all
223 bootrom: bootrom/all
225 # aliases fullimage = armsrc
227 fullimage: armsrc/all
229 fullimage/all: armsrc/all
231 fullimage/clean: armsrc/clean
233 fullimage/install: armsrc/install
235 fullimage/uninstall: armsrc/uninstall
237 recovery: recovery/all
239 cryptorf: cryptorf/all
241 mfc_card_only: mfc_card_only/all
243 mfc_card_reader: mfc_card_reader/all
245 mfd_aes_brute: mfd_aes_brute/all
247 fpga_compress: fpga_compress/all
249 hitag2crack: hitag2crack/all
251 newtarbin:
252 $(RM) proxmark3-$(platform)-bin.tar proxmark3-$(platform)-bin.tar.gz
253 @touch proxmark3-$(platform)-bin.tar
255 tarbin: newtarbin client/tarbin armsrc/tarbin bootrom/tarbin
256 $(info GEN proxmark3-$(platform)-bin.tar)
257 $(Q)$(GZIP) proxmark3-$(platform)-bin.tar
259 # detect if there were changes in the platform definitions, requiring a clean
260 cleanifplatformchanged:
261 ifeq ($(PLATFORM_CHANGED),true)
262 $(info [!] Platform definitions changed, cleaning bootrom/armsrc/recovery first...)
263 $(Q)$(MAKE) --no-print-directory -C bootrom clean
264 $(Q)$(MAKE) --no-print-directory -C armsrc clean
265 $(Q)$(MAKE) --no-print-directory -C recovery clean
266 $(Q)$(MAKE) --no-print-directory -C client clean
267 $(Q)$(MAKE) --no-print-directory -C tools/fpga_compress clean
268 $(Q)$(ECHO) CACHED_PLATFORM=$(PLATFORM) > .Makefile.options.cache
269 $(Q)$(ECHO) CACHED_PLATFORM_EXTRAS=$(PLATFORM_EXTRAS) >> .Makefile.options.cache
270 $(Q)$(ECHO) CACHED_PLATFORM_DEFS=$(PLATFORM_DEFS) >> .Makefile.options.cache
271 endif
273 # configure system to ignore PM3 device as a modem (ModemManager blacklist, effective *only* if ModemManager is not using _strict_ policy)
274 # Read doc/md/ModemManager-Must-Be-Discarded.md for more info
275 udev:
276 ifneq ($(wildcard /etc/arch-release),)
277 # If user is running ArchLinux, use group 'uucp'
278 $(SUDO) cp -rf driver/77-pm3-usb-device-blacklist-uucp.rules $(DESTDIR)$(UDEV_PREFIX)/77-pm3-usb-device-blacklist.rules
279 else
280 # Else, use group 'dialout'
281 $(SUDO) cp -rf driver/77-pm3-usb-device-blacklist-dialout.rules $(DESTDIR)$(UDEV_PREFIX)/77-pm3-usb-device-blacklist.rules
282 endif
283 $(SUDO) udevadm control --reload-rules
284 $(SUDO) udevadm trigger --action=change
286 # configure system to add user to the dialout group and if bluetooth group exists, add user to it
287 # you need to logout, relogin to get this access right correct.
288 # Finally, you might need to run the proxmark3 client under SUDO on some systems
289 accessrights:
290 ifneq ($(wildcard /etc/arch-release),)
291 #If user is running ArchLinux, use specific command and group
292 $(Q)$(SUDO) $(USERMOD) uucp $(USER)
293 $(Q)$(GETENT_BL) >/dev/null && $(SUDO) $(USERMOD) bluetooth $(USER) || true
294 else ifneq ($(wildcard /etc/fedora-release),)
295 # If the user is running Fedora, use `usermod` with the dialout group
296 $(Q)$(SUDO) $(USERMOD) dialout $(USER)
297 $(Q)$(GETENT_BL) >/dev/null && $(SUDO) $(USERMOD) bluetooth $(USER) || true
298 else
299 $(Q)$(SUDO) $(ADDUSER) $(USER) dialout
300 $(Q)$(GETENT_BL) >/dev/null && $(SUDO) $(ADDUSER) $(USER) bluetooth || true
301 endif
303 # easy printing of MAKE VARIABLES
304 print-%: ; @echo $* = $($*)
306 style:
307 # Make sure astyle is installed
308 @command -v astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
309 # Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile, *.v, pm3
310 find . \( -not -path "./cov-int/*" -and -not -path "./fpga*/xst/*" -and \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" -or -name "*.v" -or -name "pm3" \) \) \
311 -exec perl -pi -e 's/[ \t]+$$//' {} \; \
312 -exec sh -c "tail -c1 {} | xxd -p | tail -1 | grep -q -v 0a$$" \; \
313 -exec sh -c "echo >> {}" \;
314 # Apply astyle on *.c, *.h, *.cpp
315 find . \( -not -path "./cov-int/*" -and \( \( -name "*.[ch]" -and -not -name "ui_overlays.h" \) -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) \) \) -exec astyle --formatted --mode=c --suffix=none \
316 --indent=spaces=4 --indent-switches \
317 --keep-one-line-blocks --max-continuation-indent=60 \
318 --style=google --pad-oper --unpad-paren --pad-header \
319 --align-pointer=name {} \;
320 # Update commands.md
321 [ -x client/proxmark3 ] && client/proxmark3 -m | tr -d '\r' > doc/commands.md
322 # Make sure python3 is installed
323 @command -v python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 )
324 # Update commands.json, patch port in case it was run under Windows
325 [ -x client/proxmark3 ] && client/proxmark3 --fulltext | sed 's#com[0-9]#/dev/ttyACM0#'|python3 client/pyscripts/pm3_help2json.py - - | tr -d '\r' > doc/commands.json
327 # Update the readline autocomplete autogenerated code
328 [ -x client/proxmark3 ] && client/proxmark3 --fulltext | python3 client/pyscripts/pm3_help2list.py - - | tr -d '\r' > client/src/pm3line_vocabulary.h
331 # Detecting weird codepages and tabs.
332 ifeq ($(platform),Darwin)
333 miscchecks: TABSCMD=egrep -l '\t' {}
334 else
335 miscchecks: TABSCMD=grep -lP '\t' {}
336 endif
337 ifneq (,$(EDIT))
338 miscchecks: TABSCMD+= && vi {} -c ':set tabstop=4' -c ':set et|retab' -c ':wq'
339 endif
340 miscchecks:
341 # Make sure recode is installed
342 @command -v recode >/dev/null || ( echo "Please install 'recode' package first" ; exit 1 )
343 @echo "Files with suspicious chars:"
344 @find . \( -not -path "./cov-int/*" -and -not -path "./client/deps/*" -and \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" -or -name "*.v" -or -name "pm3" \) \) \
345 -exec sh -c "cat {} |recode utf8.. >/dev/null || echo {}" \;
346 ifneq (,$(EDIT))
347 @echo "Files with tabs: (EDIT enabled, files will be rewritten!)"
348 else
349 @echo "Files with tabs: (rerun with EDIT=1 if you want to convert them with vim)"
350 endif
351 # to remove tabs within lines, one can try with: vi $file -c ':set tabstop=4' -c ':set et|retab' -c ':wq'
352 @find . \( -not -path "./cov-int/*" -and -not -path "./client/deps/*" -and -not -wholename "./client/src/pm3_*wrap.c" -and \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "*.md" -or -name "*.txt" -or -name "*.awk" -or -name "*.v" -or -name "pm3" \) \) \
353 -exec sh -c "$(TABSCMD)" \;
354 # @echo "Files with printf \\\\t:"
355 # @find . \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "*.md" -or -name "*.txt" -or -name "*.awk" -or -name "*.v" \) \
356 # -exec grep -lP '\\t' {} \;
358 release: VERSION="v4.$(shell git log --oneline master | wc -l)"
359 release:
360 $(if $(findstring master,$(shell git rev-parse --abbrev-ref HEAD)),,$(error "!!! you are not on master branch, aborting"))
361 $(if $(findstring dirty,$(shell git describe --dirty --always)),$(error "!!! you have pending changes, aborting"))
362 $(if $(RELEASE_NAME),,$(error "!!! missing RELEASE_NAME, aborting"))
363 # Preparing a commit for release tagging, to be reverted after tagging.
364 @echo "# - Release Tag: $(VERSION)"
365 @echo "# - Release Name: $(RELEASE_NAME)"
366 # - Removing -Werror...
367 @find . \( -path "./Makefile.defs" -or -path "./client/Makefile" -or -path "./common_arm/Makefile.common" -or -path "./tools/hitag2crack/*/Makefile" \) -exec sed -i 's/ -Werror//' {} \;
368 @find . \( -path "./client/deps/*.cmake" -or -path "./client/CMakeLists.txt" \) -exec sed -i 's/ -Werror//' {} \;
369 # - Changing banner...
370 @sed -i "s/^#define BANNERMSG3 .*/#define BANNERMSG3 \"Release $(VERSION) - $(RELEASE_NAME)\"/" client/src/proxmark3.c
371 @echo -n "# ";grep "^#define BANNERMSG3" client/src/proxmark3.c
372 # - Committing temporarily...
373 @git commit -a -m "Release $(VERSION) - $(RELEASE_NAME)"
374 # - Tagging temporarily...
375 @git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION)
376 # - Changing default version information based on new tag
377 @$(SH) tools/mkversion.sh --force common/default_version_pm3.c
378 # - Removing mkversion calls
379 @sed -i 's#^.*\.\./tools/mkversion.sh.*|| #\t$$(Q)#' client/Makefile bootrom/Makefile armsrc/Makefile
380 @sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt client/experimental_lib/CMakeLists.txt
381 # - Deleting tag...
382 @git tag -d $(VERSION)
383 # - Amending commit...
384 @git commit -a --amend -m "Release $(VERSION) - $(RELEASE_NAME)"
385 # - Tagging again...
386 @git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION)
387 # - Reverting tagged commit...
388 @git revert --no-edit HEAD
389 @echo "==================================================================="
390 @echo "Done! You can now execute 'git push && git push origin $(VERSION)'"
392 # Dummy target to test for GNU make availability
393 _test: