Skip to content

Commit

Permalink
Refs fibercrypto#83, Add Windows Os detection via MSYS2 and create th…
Browse files Browse the repository at this point in the history
…e protob.exe target
  • Loading branch information
stdevPavelmc committed Dec 13, 2019
1 parent c8586fc commit 17cc922
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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 +71,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: install-protoc

install-protoc-osx: install-protoc

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

/usr/local/bin/protoc:
echo "Downloading protobuf from $(PROTOC_URL)"
Expand All @@ -83,11 +92,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 +146,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 Down

0 comments on commit 17cc922

Please sign in to comment.