diff options
| author | Roy Hooper <rhooper@toybox.ca> | 2018-05-14 11:19:19 -0400 |
|---|---|---|
| committer | Roy Hooper <rhooper@toybox.ca> | 2018-05-14 11:19:19 -0400 |
| commit | 1661cbb6e19a1dcf389a0b919076798677de8b99 (patch) | |
| tree | 2d39e5405cdfae7d7f253b3bb4b9dc3aa6501ea3 | |
| parent | ce5eae1c76b82132453cc9734fb808cf413ffb17 (diff) | |
Make python detection more robust and allow setting PYTHON2 and PYTHON3 to override python executables during build.
| -rw-r--r-- | ports/atmel-samd/Makefile | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index d6ed0707a..e85a11b57 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -1,3 +1,7 @@ +# Set default python interpreters +PYTHON2 ?= $(which python2 || which python2.7) +PYTHON3 ?= python3 + # Select the board to build for: if not given on the command line, # then default to PYBV10. BOARD ?= metro_m0_express @@ -395,7 +399,7 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.elf: $(OBJ) $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group - $(Q)$(SIZE) $@ | python3 $(TOP)/tools/build_memory_info.py $(LD_FILE) + $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(ECHO) "Create $@" @@ -403,7 +407,7 @@ $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin $(ECHO) "Create $@" - python2 $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^ + $(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^ $(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate @@ -411,7 +415,7 @@ $(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: auto autogen_usb_descriptor.intermediate: tools/gen_usb_descriptor.py Makefile install -d $(BUILD)/genhdr - python3 tools/gen_usb_descriptor.py \ + $(PYTHON3) tools/gen_usb_descriptor.py \ --manufacturer $(USB_MANUFACTURER)\ --product $(USB_PRODUCT)\ --vid $(USB_VID)\ |
