Skip to content

Commit

Permalink
Merge pull request #84 from stdevPavelmc/stdevPavelmc_t83_fix_82_appl…
Browse files Browse the repository at this point in the history
…ied_to_master

Apply changes from PR #82 to the develop [default] branch (aid on solution for fibercrypto/skywallet-mcu#342)
  • Loading branch information
olemis authored Dec 13, 2019
2 parents 8ce918b + e2a2b3c commit 81be0e9
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
.DEFAULT_GOAL := help
.PHONY: help all clean install
.PHONY: build-go build-js build-c build-py
.PHONY: install-deps-go install-deps-js install-deps-nanopb install-protoc
.PHONY: install-deps-go install-deps-js install-deps-nanopb
.PHONY: install-protoc install-protoc-linux install-protoc-osx install-protoc-win32
.PHONY: clean-go clean-js clean-c clean-py

REPO_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

UNAME_S = $(shell uname -s)
PYTHON ?= python
PYTHON ?= python3
PIP ?= pip3
PIPARGS ?=
GOPATH ?= $(HOME)/go
Expand All @@ -21,6 +22,11 @@ else
ifeq ($(UNAME_S),Darwin)
OS_NAME=osx
endif
UNAME_W = $(shell uname -s | cut -d "_" -f1 )
ifeq ($(UNAME_W),MINGW64)
OS_NAME=win32
PROTOC_ZIP ?= protoc-$(PROTOC_VERSION)-$(OS_NAME).zip
endif
endif

PROTOC_VERSION ?= 3.6.1
Expand Down Expand Up @@ -66,15 +72,19 @@ OUT_C ?= $(PROTOB_C_DIR)

all: build-go build-js build-c build-py ## Generate protobuf classes for all languages

install: install-deps-go install-deps-js install-deps-nanopb install-protoc ## Install protocol buffer tools
install: install-deps-go install-deps-js install-deps-nanopb install-protoc-$(OS_NAME) ## Install protocol buffer tools

clean: clean-go clean-js clean-c clean-py ## Delete temporary and output files
rm -rf \
$$( find . -name '*.swp' ) \
$$( find . -name '*.swo' ) \
$$( find . -name '*.orig' )

install-protoc: /usr/local/bin/protoc
install-protoc-linux: /usr/local/bin/protoc

install-protoc-osx: /usr/local/bin/protoc

install-protoc-win32: /usr/local/bin/protoc.exe

/usr/local/bin/protoc:
echo "Downloading protobuf from $(PROTOC_URL)"
Expand All @@ -83,11 +93,19 @@ install-protoc: /usr/local/bin/protoc
sudo unzip -o $(PROTOC_ZIP) -d /usr/local bin/protoc
rm -f $(PROTOC_ZIP)

/usr/local/bin/protoc.exe:
echo "Downloading protobuf from $(PROTOC_URL)"
curl -OL $(PROTOC_URL)
echo "Installing protoc"
mkdir -p /usr/local/bin
sudo unzip -o $(PROTOC_ZIP) -d /usr/local bin/protoc.exe
rm -f $(PROTOC_ZIP)

#----------------
# Go lang
#----------------

install-deps-go: install-protoc ## Install tools to generate protobuf classes for go lang
install-deps-go: install-protoc-$(OS_NAME) ## Install tools to generate protobuf classes for go lang
@if [ -e $(PROTOB_SRC_DIR) ] ; then \
echo 'Detected $(PROTOC_GOGO_URL) on local file system. Checking v1.2.0' ; \
cd $(PROTOB_SRC_DIR) && git checkout v1.2.0 ; \
Expand Down Expand Up @@ -129,7 +147,7 @@ clean-js:
# C with nanopb
#----------------

install-deps-nanopb: install-protoc ## Install tools to generate protobuf classes for C and Python with nanopb
install-deps-nanopb: install-protoc-$(OS_NAME) ## Install tools to generate protobuf classes for C and Python with nanopb
make -C $(PROTOC_NANOPBGEN_DIR)/proto/
$(PIP) install $(PIPARGS) "protobuf==$(PROTOC_VERSION)" ecdsa

Expand All @@ -155,6 +173,7 @@ clean-c: clean-py
$$( find $(OUT_C) -name '*.i' ) \
$$( find $(OUT_C) -name '*.s' ) \
$$( find $(OUT_C) -name '*.o' )
sudo rm -f /usr/local/bin/protoc* || exit 0

#----------------
# Python with nanopb
Expand Down

0 comments on commit 81be0e9

Please sign in to comment.