From 51ce757dd5da670eb76f7c8f1f3fdd91ea51ec65 Mon Sep 17 00:00:00 2001 From: Rintaro Okamura Date: Thu, 27 Aug 2020 13:36:25 +0900 Subject: [PATCH] :bug: fix Makefile: compatible with macOS Signed-off-by: Rintaro Okamura --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 049d71d218..9f9837da67 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,13 @@ SWAP_TAG ?= latest BINDIR ?= /usr/local/bin UNAME := $(eval UNAME := $(shell uname))$(UNAME) + +ifeq ($(UNAME),Linux) CPU_INFO_FLAGS := $(eval CPU_INFO_FLAGS := $(shell cat /proc/cpuinfo | grep flags | cut -d " " -f 2- | head -1))$(CPU_INFO_FLAGS) +else +CPU_INFO_FLAGS := "" +endif + GIT_COMMIT := $(eval GIT_COMMIT := $(shell git rev-list -1 HEAD))$(GIT_COMMIT) MAKELISTS := Makefile $(shell find Makefile.d -type f -regex ".*\.mk") @@ -243,7 +249,6 @@ format: \ license \ update/goimports \ format/yaml - # format/docker .PHONY: update/goimports ## run goimports for all go files @@ -322,11 +327,16 @@ ngt/install: /usr/local/include/NGT/Capi.h .PHONY: tensorflow/install ## install TensorFlow for C tensorflow/install: /usr/local/lib/libtensorflow.so +ifeq ($(UNAME),Darwin) +/usr/local/lib/libtensorflow.so: + brew install libtensorflow@1 +else /usr/local/lib/libtensorflow.so: curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-$(TENSORFLOW_C_VERSION).tar.gz tar -C /usr/local -xzf libtensorflow-cpu-linux-x86_64-$(TENSORFLOW_C_VERSION).tar.gz rm -f libtensorflow-cpu-linux-x86_64-$(TENSORFLOW_C_VERSION).tar.gz ldconfig +endif .PHONY: lint ## run lints