]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - Makefile
small refactoring
[proxmark3-svn] / Makefile
... / ...
CommitLineData
1GZIP=gzip
2# Windows' echo echos its input verbatim, on Posix there is some
3# amount of shell command line parsing going on. echo "" on
4# Windows yields literal "", on Linux yields an empty line
5ifeq ($(shell echo ""),)
6# This is probably a proper system, so we can use uname
7DELETE=rm -rf
8FLASH_TOOL=client/flasher
9platform=$(shell uname)
10ifneq (,$(findstring MINGW,$(platform)))
11FLASH_PORT=com3
12PATHSEP=\\#
13else
14FLASH_PORT=/dev/ttyACM0
15PATHSEP=/
16endif
17else
18# Assume that we are running on native Windows
19DELETE=del /q
20FLASH_TOOL=client/flasher.exe
21platform=Windows
22FLASH_PORT=com3
23PATHSEP=\\#
24endif
25
26all clean: %: client/% bootrom/% armsrc/% recovery/% mfkey/%
27
28bootrom/%: FORCE
29 $(MAKE) -C bootrom $(patsubst bootrom/%, %, $@)
30armsrc/%: FORCE
31 $(MAKE) -C armsrc $(patsubst armsrc/%, %, $@)
32client/%: FORCE
33 $(MAKE) -C client $(patsubst client/%, %, $@)
34recovery/%: FORCE
35 $(MAKE) -C recovery $(patsubst recovery/%, %, $@)
36mfkey/%: FORCE
37 $(MAKE) -C tools/mfkey $(patsubst mfkey/%, %, $@)
38FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites)
39
40.PHONY: all clean help _test flash-bootrom flash-os flash-all FORCE
41
42help:
43 @echo Multi-OS Makefile, you are running on $(DETECTED_OS)
44 @echo Possible targets:
45 @echo + all - Make bootrom, armsrc and the OS-specific host directory
46 @echo + client - Make only the OS-specific host directory
47 @echo + flash-bootrom - Make bootrom and flash it
48 @echo + flash-os - Make armsrc and flash os \(includes fpga\)
49 @echo + flash-all - Make bootrom and armsrc and flash bootrom and os image
50 @echo + clean - Clean in bootrom, armsrc and the OS-specific host directory
51
52client: client/all
53
54mfkey: mfkey/all
55
56flash-bootrom: bootrom/obj/bootrom.elf $(FLASH_TOOL)
57 $(FLASH_TOOL) $(FLASH_PORT) -b $(subst /,$(PATHSEP),$<)
58
59flash-os: armsrc/obj/fullimage.elf $(FLASH_TOOL)
60 $(FLASH_TOOL) $(FLASH_PORT) $(subst /,$(PATHSEP),$<)
61
62flash-all: bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf $(FLASH_TOOL)
63 $(FLASH_TOOL) $(FLASH_PORT) -b $(subst /,$(PATHSEP),$(filter-out $(FLASH_TOOL),$^))
64
65newtarbin:
66 $(DELETE) proxmark3-$(platform)-bin.tar proxmark3-$(platform)-bin.tar.gz
67 @touch proxmark3-$(platform)-bin.tar
68
69tarbin: newtarbin client/tarbin armsrc/tarbin bootrom/tarbin
70 $(GZIP) proxmark3-$(platform)-bin.tar
71
72# Dummy target to test for GNU make availability
73_test:
Impressum, Datenschutz