Skip to content

Commit

Permalink
don’t use brew for prefix if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Feb 3, 2024
1 parent a60dd02 commit e4ec6f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile-variables
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PREFIX ?= /usr/local
ifndef MACOS_VER_NUM
MACOS_VER_NUM := $(shell vtool -show-build $(shell brew --prefix)/lib/libgetargv.dylib | awk '/minos/{print $$2}')
MACOS_VER_NUM := $(shell vtool -show-build $(PREFIX)/lib/libgetargv.dylib | awk '/minos/{print $$2}')
endif
MACOS_VER_MAJOR := $(shell echo $(MACOS_VER_NUM) | cut -f1 -d.)
MACOS_VER_MINOR := $(shell echo $(MACOS_VER_NUM) | cut -f2 -d.)
Expand All @@ -25,7 +26,6 @@ OBJ_DIR = obj
LIB_DIR = lib
PKG_DIR = pkg
FAKE_ROOT = fakeroot
PREFIX ?= /usr/local
CXX = clang++
CPPFLAGS += -MMD -MP

Expand Down
7 changes: 3 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ LIB_SHORT_NAME := getargv++
INCLUDE_DIR := include/$(LIB_SHORT_NAME)
COV_DIR := coverage
PREFIX := $(PWD)
BREW_PREFIX := $(shell /usr/bin/env -P /usr/local/bin:/opt/homebrew/bin brew --prefix)

COMPILER_VERSION := $(shell $(CXX) --version | grep version | grep -o -m 1 "[0-9]\+\.[0-9]\+\.*[0-9]*" | head -n 1)
COMPILER_VERSION_NUMBER := $(shell echo $(COMPILER_VERSION) | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
Expand Down Expand Up @@ -37,10 +36,10 @@ lib_unit_tests: $(BIN_DIR)/lib_unit_tests

#unit test library
$(BIN_DIR)/lib_unit_tests: CPPFLAGS := -MMD -MP -fvisibility=hidden
$(BIN_DIR)/lib_unit_tests: CXXFLAGS += -fblocks -I $(BREW_PREFIX)/include -O0 -g3 -fcoverage-mapping $(SANI_FLAGS)
$(BIN_DIR)/lib_unit_tests: CXXFLAGS += -fblocks $(shell pkg-config --cflags getargv) -O0 -g3 -fcoverage-mapping $(SANI_FLAGS)
$(BIN_DIR)/lib_unit_tests: EXE := $(BIN_DIR)/lib_unit_tests
$(BIN_DIR)/lib_unit_tests: LDLIBS := -l criterion -l getargv $(SANI_FLAGS)
$(BIN_DIR)/lib_unit_tests: LDFLAGS := -L $(BREW_PREFIX)/lib
$(BIN_DIR)/lib_unit_tests: LDLIBS := -l criterion $(SANI_FLAGS)
$(BIN_DIR)/lib_unit_tests: LDFLAGS := $(shell pkg-config --libs getargv)

# test building with library, phony targets can't use % pattern when declaring deps, thus the non-DRY rules
libtest1: $(DYLIB) $(BIN_DIR)/libtest1
Expand Down

0 comments on commit e4ec6f0

Please sign in to comment.