1
- PREFIX ?= /usr/local
2
- ifndef MACOS_VER_NUM
3
- MACOS_VER_NUM := $(shell vtool -show-build $(shell pkg-config --variable=libdir getargv)/libgetargv.dylib | awk '/minos/{print $$2}')
4
- endif
1
+ PREFIX ?= /usr/local
2
+ MACOS_VER_NUM ?= $(shell vtool -show-build $(shell pkg-config --variable=libdir getargv)/libgetargv.dylib | awk '/minos/{print $$2}')
5
3
MACOS_VER_MAJOR := $(shell echo $(MACOS_VER_NUM) | cut -f1 -d.)
6
4
MACOS_VER_MINOR := $(shell echo $(MACOS_VER_NUM) | cut -f2 -d.)
7
5
MACOS_LT_10_11 := $(shell [ $(MACOS_VER_MAJOR) -eq 10 -a $(MACOS_VER_MINOR) -lt 11 ] && echo true)
@@ -12,53 +10,51 @@ export MACOSX_DEPLOYMENT_TARGET := $(MACOS_VER_MAJOR).$(MACOS_VER_MINOR)
12
10
# When changing version, also change: getargv++.pc, doxygen.conf, and README.md
13
11
VERSION=0.9
14
12
#
15
- COMPAT_VERSION := $(shell echo $(VERSION) | cut -f1 -d.).0
16
- ARCH := $(shell uname -m)
13
+ COMPAT_VERSION := $(shell echo $(VERSION) | cut -f1 -d.).0
14
+ ARCH := $(shell uname -m)
17
15
CODESIGN_PREFIX := cam.narzt.
18
16
KEYCHAIN := ~/Library/Keychains/login.keychain-db
19
- ifndef CERT_IDENTITY
20
- CERT_IDENTITY := $(shell security find-identity -v -p codesigning | sed -Ee 's/.*"([^"]+)".*/\1/g' | grep -Fve ' valid identit' -e ' CA')
21
- endif
17
+ CERT_IDENTITY ?= $(shell security find-identity -v -p codesigning | sed -Ee 's/.*"([^"]+)".*/\1/g' | grep -Fve ' valid identit' -e ' CA')
22
18
23
- SRC_DIR = src
24
- INCLUDE_DIR = include
25
- OBJ_DIR = obj
26
- LIB_DIR = lib
27
- PKG_DIR = pkg
28
- FAKE_ROOT = fakeroot
29
- CXX = clang++
30
- CPPFLAGS := -MMD -MP
19
+ SRC_DIR : = src
20
+ INCLUDE_DIR : = include
21
+ OBJ_DIR : = obj
22
+ LIB_DIR : = lib
23
+ PKG_DIR : = pkg
24
+ FAKE_ROOT : = fakeroot
25
+ CXX : = clang++
26
+ CPPFLAGS := -MMD -MP
31
27
32
28
COMPILER_VERSION := $(shell $(CXX) --version | grep version | grep -o -m 1 "[0-9]\+\.[0-9]\+\.*[0-9]*" | head -n 1)
33
29
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/')
34
30
CLANG_13_OR_MORE := $(shell expr $(COMPILER_VERSION_NUMBER) \>= 130106)
35
31
ifneq ($(CLANG_13_OR_MORE),0)
36
32
# supported: c++11, c++14, c++17, c++20
37
33
# future: c++2b
38
- CXXFLAGS : = --std=c++20 -O3 -Iinclude $(shell pkg-config --cflags getargv)
34
+ CXXFLAGS ? = --std=c++20 -O3 -Iinclude $(shell pkg-config --cflags getargv)
39
35
else
40
- CXXFLAGS : = --std=c++17 -O3 -Iinclude $(shell pkg-config --cflags getargv)
36
+ CXXFLAGS ? = --std=c++17 -O3 -Iinclude $(shell pkg-config --cflags getargv)
41
37
endif
42
38
43
39
EXTRA_CXXFLAGS := -pedantic-errors -Weverything -Wno-c++98-compat -Wno-pre-c++20-compat-pedantic -Wno-poison-system-directories
44
- LDFLAGS := -Llib -fvisibility=default -fPIC
45
- LDLIBS : = $(shell pkg-config --libs getargv)
40
+ LDFLAGS := -Llib -fvisibility=default -fPIC
41
+ LDLIBS ? = $(shell pkg-config --libs getargv)
46
42
47
- LIB_SHORT_NAME = getargv++
48
- LIB_NAME = lib$(LIB_SHORT_NAME)
49
- DYLIB_FILENAME = $(LIB_NAME).$(VERSION).dylib
50
- DYLIB = lib/$(DYLIB_FILENAME)
51
- SOURCES = $(wildcard $(SRC_DIR)/*.cpp)
52
- HEADERS = $(wildcard $(INCLUDE_DIR)/*.hpp)
53
- OBJECTS = $(SOURCES:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
43
+ LIB_SHORT_NAME : = getargv++
44
+ LIB_NAME : = lib$(LIB_SHORT_NAME)
45
+ DYLIB_FILENAME : = $(LIB_NAME).$(VERSION).dylib
46
+ DYLIB : = lib/$(DYLIB_FILENAME)
47
+ SOURCES : = $(wildcard $(SRC_DIR)/*.cpp)
48
+ HEADERS : = $(wildcard $(INCLUDE_DIR)/*.hpp)
49
+ OBJECTS : = $(SOURCES:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
54
50
55
51
DMG_VOLUME_NAME := $(LIB_NAME) Installer
56
52
DMG := $(PKG_DIR)/$(LIB_NAME).dmg
57
53
PRODUCT_BUNDLE_PACKAGE_TYPE := APPL
58
54
LIB_BUNDLE_IDENTIFIER := $(CODESIGN_PREFIX)$(LIB_NAME)
59
55
PRODUCT_BUNDLE_IDENTIFIER := $(LIB_BUNDLE_IDENTIFIER)
60
- PRODUCT := $(PKG_DIR)/$(LIB_NAME)-$(VERSION)-macOS-$(MACOS_VER_NUM )-$(ARCH).pkg
61
- LIB_PKG := $(PKG_DIR)/$(LIB_NAME)-$(VERSION)-macOS-$(MACOS_VER_NUM )-$(ARCH)-package.pkg
56
+ PRODUCT := $(PKG_DIR)/$(LIB_NAME)-$(VERSION)-macOS-$(MACOSX_DEPLOYMENT_TARGET )-$(ARCH).pkg
57
+ LIB_PKG := $(PKG_DIR)/$(LIB_NAME)-$(VERSION)-macOS-$(MACOSX_DEPLOYMENT_TARGET )-$(ARCH)-package.pkg
62
58
DISTRIBUTION := $(OBJ_DIR)/dist.xml
63
59
64
60
ifeq ($(MACOS_LT_10_11),true)
0 commit comments