Skip to content

Commit

Permalink
makefile fixes for c++11/c++17
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder committed Oct 18, 2023
1 parent 27fa1f4 commit 7584f5a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ DEBUG=${ALL_DEBUG}
#export EXTRALINK
export MAKE
export CURVER?=2.6.0
export CPLUSPLUS=$(shell ${CC} -dM -E -x c++ /dev/null | grep -F __cplusplus | grep -Po '\d\d\d\d\d\dL')
$(warning __cplusplus=${CPLUSPLUS})

ifneq (,$(wildcard /etc/os-release))
DISTRO := $(shell awk -F= '/^NAME/{print $$2}' /etc/os-release)
else
Expand Down
14 changes: 8 additions & 6 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,25 @@ PROXYSQLCLICKHOUSE := $(shell echo $(PROXYSQLCLICKHOUSE))
PSQLCH=
ifeq ($(PROXYSQLCLICKHOUSE),1)
PSQLCH=-DPROXYSQLCLICKHOUSE
ifeq ($(IS_CXX17),1)
PSQLCH=-DPROXYSQLCLICKHOUSE -std=c++17 -DCXX17
endif
endif


# 'libhttpserver': Add 'ENABLE_EPOLL' by default for all platforms except
# for 'Darwin'. This is required when compiling 'libhttpserver' for avoiding
# internal use of 'SELECT' in favor of 'EPOLL'. See #3591.
ENABLE_EPOLL=-DENABLE_EPOLL
ifeq ($(UNAME_S),Darwin)
ENABLE_EPOLL=
else
ENABLE_EPOLL=-DENABLE_EPOLL
endif

MYCFLAGS=$(IDIRS) $(OPTZ) $(DEBUG) -Wall -DGITVERSION=\"$(GIT_VERSION)\" $(NOJEM) $(WGCOV) $(WASAN)
MYCXXFLAGS=-std=c++11 $(MYCFLAGS) $(PSQLCH) $(ENABLE_EPOLL)

MYCXXFLAGS=-std=c++11 -DCXX11
ifeq ($(IS_CXX17),1)
MYCXXFLAGS=-std=c++17 -DCXX17
endif
MYCXXFLAGS+= $(MYCFLAGS) $(PSQLCH) $(ENABLE_EPOLL)


default: libproxysql.a
.PHONY: default
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ PROXYSQLCLICKHOUSE := $(shell echo $(PROXYSQLCLICKHOUSE))
PSQLCH=
ifeq ($(PROXYSQLCLICKHOUSE),1)
PSQLCH=-DPROXYSQLCLICKHOUSE
ifeq ($(IS_CXX17),1)
PSQLCH=-DPROXYSQLCLICKHOUSE -std=c++17 -DCXX17
endif
endif


Expand All @@ -145,7 +142,10 @@ ifeq ($(TEST_WITHASANVAR),1)
WASAN+= -DTEST_WITHASAN
endif

MYCXXFLAGS=-std=c++11
MYCXXFLAGS=-std=c++11 -DCXX11
ifeq ($(IS_CXX17),1)
MYCXXFLAGS=-std=c++17 -DCXX17
endif
ifeq ($(CXX),clang++)
MYCXXFLAGS+= -fuse-ld=lld
endif
Expand Down

0 comments on commit 7584f5a

Please sign in to comment.