diff --git a/mk/flags.mk b/mk/flags.mk index 74efd59d..571c2074 100644 --- a/mk/flags.mk +++ b/mk/flags.mk @@ -45,8 +45,9 @@ endif # Add boost library search path. # This is the defualt installation location by home brew. ifeq "$(is_darwin)" "1" - LDFLAGS += -L/usr/local/lib - INCLUDES += /usr/local/opt/flex/include + LDFLAGS += -L $(BOOST_ROOT)/lib + LDFLAGS += -L$(FLEX_ROOT)/lib + INCLUDES += $(FLEX_ROOT)/include endif # Need to pass the -U option to GNU ar to turn off deterministic mode, or diff --git a/mk/paths.mk b/mk/paths.mk index 61b1db22..e3084674 100644 --- a/mk/paths.mk +++ b/mk/paths.mk @@ -26,8 +26,12 @@ TEST_ROOT := $(ERPC_ROOT)/test ifeq "$(is_mingw)" "1" BOOST_ROOT ?= $(ERPC_ROOT)/erpcgen/VisualStudio_v14/boost_1_67_0 -else +else ifneq "$(is_darwin)" "1" BOOST_ROOT ?= /usr/local/opt/boost +else + ifndef BOOST_ROOT + BOOST_ROOT := $(shell brew --prefix boost) + endif endif TARGET_OUTPUT_ROOT = $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)/$(os_name)/$(APP_NAME) @@ -70,8 +74,15 @@ endif # Tool paths. Use different paths for OS X. ifeq "$(is_darwin)" "1" - FLEX ?= /usr/local/opt/flex/bin/flex - BISON ?= /usr/local/opt/bison/bin/bison + ifndef FLEX_ROOT + FLEX_ROOT := $(shell brew --prefix flex) + endif + ifndef BISON_ROOT + BISON_ROOT := $(shell brew --prefix bison) + endif + + FLEX ?= $(FLEX_ROOT)/bin/flex + BISON ?= $(BISON_ROOT)/bin/bison else ifeq "$(is_linux)" "1" FLEX ?= /usr/bin/flex BISON ?= /usr/bin/bison