fb9acd45 |
1 | GZIP=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 |
5 | ifeq ($(shell echo ""),) |
6 | # This is probably a proper system, so we can use uname |
7 | DELETE=rm -rf |
8 | FLASH_TOOL=client/flasher |
9 | platform=$(shell uname) |
10 | ifneq (,$(findstring MINGW,$(platform))) |
11 | FLASH_PORT=com3 |
12 | PATHSEP=\\# |
13 | else |
03f29e03 |
14 | FLASH_PORT=/dev/ttyACM0 |
fb9acd45 |
15 | PATHSEP=/ |
16 | endif |
17 | else |
18 | # Assume that we are running on native Windows |
19 | DELETE=del /q |
20 | FLASH_TOOL=client/flasher.exe |
21 | platform=Windows |
22 | FLASH_PORT=com3 |
23 | PATHSEP=\\# |
24 | endif |
bd846386 |
25 | |
fb9acd45 |
26 | all clean: %: client/% bootrom/% armsrc/% recovery/% mfkey/% |
db335b3d |
27 | |
64b81198 |
28 | bootrom/%: FORCE |
fb9acd45 |
29 | $(MAKE) -C bootrom $(patsubst bootrom/%, %, $@) |
64b81198 |
30 | armsrc/%: FORCE |
fb9acd45 |
31 | $(MAKE) -C armsrc $(patsubst armsrc/%, %, $@) |
d5be6f7c |
32 | client/%: FORCE |
fb9acd45 |
33 | $(MAKE) -C client $(patsubst client/%, %, $@) |
a79e330d |
34 | recovery/%: FORCE |
fb9acd45 |
35 | $(MAKE) -C recovery $(patsubst recovery/%, %, $@) |
36 | mfkey/%: FORCE |
37 | $(MAKE) -C tools/mfkey $(patsubst mfkey/%, %, $@) |
64b81198 |
38 | FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites) |
39 | |
f3919878 |
40 | .PHONY: all clean help _test flash-bootrom flash-os flash-all FORCE |
64b81198 |
41 | |
db335b3d |
42 | help: |
43 | @echo Multi-OS Makefile, you are running on $(DETECTED_OS) |
44 | @echo Possible targets: |
64b81198 |
45 | @echo + all - Make bootrom, armsrc and the OS-specific host directory |
33bf54cf |
46 | @echo + client - Make only the OS-specific host directory |
64b81198 |
47 | @echo + flash-bootrom - Make bootrom and flash it |
16f54ead |
48 | @echo + flash-os - Make armsrc and flash os \(includes fpga\) |
f3919878 |
49 | @echo + flash-all - Make bootrom and armsrc and flash bootrom and os image |
64b81198 |
50 | @echo + clean - Clean in bootrom, armsrc and the OS-specific host directory |
51 | |
33bf54cf |
52 | client: client/all |
53 | |
fb9acd45 |
54 | mfkey: mfkey/all |
55 | |
70b1a685 |
56 | flash-bootrom: bootrom/obj/bootrom.elf $(FLASH_TOOL) |
03f29e03 |
57 | $(FLASH_TOOL) $(FLASH_PORT) -b $(subst /,$(PATHSEP),$<) |
64b81198 |
58 | |
fb228974 |
59 | flash-os: armsrc/obj/fullimage.elf $(FLASH_TOOL) |
03f29e03 |
60 | $(FLASH_TOOL) $(FLASH_PORT) $(subst /,$(PATHSEP),$<) |
c2686a49 |
61 | |
fb228974 |
62 | flash-all: bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf $(FLASH_TOOL) |
03f29e03 |
63 | $(FLASH_TOOL) $(FLASH_PORT) -b $(subst /,$(PATHSEP),$(filter-out $(FLASH_TOOL),$^)) |
52b3d184 |
64 | |
bd846386 |
65 | newtarbin: |
66 | $(DELETE) proxmark3-$(platform)-bin.tar proxmark3-$(platform)-bin.tar.gz |
67 | @touch proxmark3-$(platform)-bin.tar |
68 | |
69 | tarbin: newtarbin client/tarbin armsrc/tarbin bootrom/tarbin |
70 | $(GZIP) proxmark3-$(platform)-bin.tar |
71 | |
52b3d184 |
72 | # Dummy target to test for GNU make availability |
73 | _test: |