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
 
   8 FLASH_TOOL=client/flasher
 
   9 platform=$(shell uname)
 
  10 ifneq (,$(findstring MINGW,$(platform)))
 
  14 FLASH_PORT=/dev/ttyACM0
 
  18 # Assume that we are running on native Windows
 
  20 FLASH_TOOL=client/flasher.exe
 
  26 all clean: %: client/% bootrom/% armsrc/% recovery/% mfkey/%
 
  29         $(MAKE) -C bootrom $(patsubst bootrom/%, %, $@)
 
  31         $(MAKE) -C armsrc $(patsubst armsrc/%, %, $@)
 
  33         $(MAKE) -C client $(patsubst client/%, %, $@)
 
  35         $(MAKE) -C recovery $(patsubst recovery/%, %, $@)
 
  37         $(MAKE) -C tools/mfkey $(patsubst mfkey/%, %, $@)
 
  38 FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites)
 
  40 .PHONY: all clean help _test flash-bootrom flash-os flash-all FORCE
 
  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
 
  56 flash-bootrom: bootrom/obj/bootrom.elf $(FLASH_TOOL)
 
  57         $(FLASH_TOOL) $(FLASH_PORT) -b $(subst /,$(PATHSEP),$<)
 
  59 flash-os: armsrc/obj/fullimage.elf $(FLASH_TOOL)
 
  60         $(FLASH_TOOL) $(FLASH_PORT) $(subst /,$(PATHSEP),$<)
 
  62 flash-all: bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf $(FLASH_TOOL)
 
  63         $(FLASH_TOOL) $(FLASH_PORT) -b $(subst /,$(PATHSEP),$(filter-out $(FLASH_TOOL),$^))
 
  66         $(DELETE) proxmark3-$(platform)-bin.tar proxmark3-$(platform)-bin.tar.gz
 
  67         @touch proxmark3-$(platform)-bin.tar
 
  69 tarbin: newtarbin client/tarbin armsrc/tarbin bootrom/tarbin
 
  70         $(GZIP) proxmark3-$(platform)-bin.tar
 
  72 # Dummy target to test for GNU make availability