diff --git a/Makefile.include b/Makefile.include index 5f1aa605a..0759cf726 100644 --- a/Makefile.include +++ b/Makefile.include @@ -1,6 +1,8 @@ TOP_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) TOOLCHAIN_DIR ?= $(TOP_DIR)vendor/libopencm3 +PYTHON ?= python + ifeq ($(EMULATOR),1) CC = gcc LD = gcc diff --git a/firmware/Makefile b/firmware/Makefile index 124f6556b..4ba08837c 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -110,13 +110,13 @@ bootloader.o: ../fastflash/bootloader.bin $< $@ coins_count.h: coins-gen.py coins.json - ./$< count > $@ + $(PYTHON) $< count > $@ coins_array.h: coins-gen.py coins.json - ./$< array > $@ + $(PYTHON) $< array > $@ nem_mosaics.c nem_mosaics.h: nem_mosaics.py nem_mosaics.json - ./$< + $(PYTHON) $< clean:: rm -f coins_count.h coins_array.h diff --git a/firmware/nem_mosaics.py b/firmware/nem_mosaics.py index cb652067b..c2bd6d029 100755 --- a/firmware/nem_mosaics.py +++ b/firmware/nem_mosaics.py @@ -9,6 +9,11 @@ from itertools import chain sys.path.insert(0, os.path.join(os.path.dirname(__file__), "protob")) import types_pb2 as types +try: + basestring +except NameError: + basestring = (str, bytes) + HEADER_TEMPLATE = """ // This file is automatically generated by nem_mosaics.py -- DO NOT EDIT! diff --git a/firmware/protob/Makefile b/firmware/protob/Makefile index 8dc4c38fd..5a3327f96 100644 --- a/firmware/protob/Makefile +++ b/firmware/protob/Makefile @@ -1,7 +1,9 @@ all: messages.pb.c types.pb.c messages_map.h +PYTHON ?= python + %.pb.c: %.pb %.options - ../../vendor/nanopb/generator/nanopb_generator.py $< -L '#include "%s"' -T + $(PYTHON) ../../vendor/nanopb/generator/nanopb_generator.py $< -L '#include "%s"' -T %.pb: %.proto protoc -I/usr/include -I. $< -o $@ @@ -10,7 +12,7 @@ all: messages.pb.c types.pb.c messages_map.h protoc -I/usr/include -I. $< --python_out=. messages_map.h: messages_map.py messages_pb2.py types_pb2.py - ./$< > $@ + $(PYTHON) $< > $@ clean: rm -f *.pb *.o *.d *.pb.c *.pb.h *_pb2.py messages_map.h