| 1 |
# This file should allow ACE to be built on Linux, using the clang compiler. |
| 2 |
|
| 3 |
include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU |
| 4 |
|
| 5 |
ifeq ($(insure),0) |
| 6 |
ifeq ($(CXX),g++) |
| 7 |
CC = clang |
| 8 |
CXX = clang++ |
| 9 |
endif |
| 10 |
endif |
| 11 |
|
| 12 |
ifndef CXX_VERSION |
| 13 |
CXX_VERSION := $(shell $(CXX) -dumpversion) |
| 14 |
endif |
| 15 |
CXX_MAJOR_VERSION := $(firstword $(subst ., ,$(CXX_VERSION))) |
| 16 |
|
| 17 |
# clang 16 and newer default to C++17 |
| 18 |
ifeq ($(CXX_MAJOR_VERSION),$(filter $(CXX_MAJOR_VERSION),4 5 6 7 8 9 10 11 12 13 14 15)) |
| 19 |
c++std ?= c++17 |
| 20 |
endif |
| 21 |
|
| 22 |
CCFLAGS += $(CFLAGS) |
| 23 |
DCFLAGS += -g |
| 24 |
DLD = $(CXX) |
| 25 |
LD = $(CXX) |
| 26 |
LIBS += -ldl |
| 27 |
|
| 28 |
ifeq ($(threads),1) |
| 29 |
LIBS += -lpthread |
| 30 |
LIBS += -lrt |
| 31 |
endif |
| 32 |
|
| 33 |
OCFLAGS += -O3 |
| 34 |
|
| 35 |
ifeq ($(optimize),0) |
| 36 |
CPPFLAGS += -O0 |
| 37 |
endif |
| 38 |
|
| 39 |
ifneq ($(c++std),) |
| 40 |
CCFLAGS += -std=$(c++std) |
| 41 |
else ifeq ($(c++20),1) |
| 42 |
CCFLAGS += -std=c++20 |
| 43 |
else ifeq ($(c++17),1) |
| 44 |
CCFLAGS += -std=c++17 |
| 45 |
endif |
| 46 |
|
| 47 |
ifeq ($(no_deprecated),1) |
| 48 |
CCFLAGS += -Wno-deprecated-declarations |
| 49 |
endif |
| 50 |
|
| 51 |
SOFLAGS += $(CPPFLAGS) -shared |
| 52 |
SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<; \ |
| 53 |
$(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o |
| 54 |
PRELIB = @true |
| 55 |
|
| 56 |
# Visibility doesn't seem to work with clang 2.8, default to off |
| 57 |
no_hidden_visibility ?= 1 |
| 58 |
|
| 59 |
ifeq ($(shared_libs), 1) |
| 60 |
ifneq ($static_libs_only), 1) |
| 61 |
LDFLAGS += -Wl,-E |
| 62 |
ifneq ($(no_hidden_visibility),1) |
| 63 |
CCFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
| 64 |
else |
| 65 |
CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 |
| 66 |
endif # no_hidden_visibility |
| 67 |
endif |
| 68 |
endif |
| 69 |
|
| 70 |
# Added line below to support "Executable Shared Object" files (as |
| 71 |
# needed by the service configurator). |
| 72 |
# Marius Kjeldahl <[email protected], [email protected]> |
| 73 |
ifeq ($(threads),1) |
| 74 |
ESOBUILD = $(COMPILEESO.cc) $(PIC) -shared -o $(VSHDIR)$*.so $< |
| 75 |
ifndef PRELIB |
| 76 |
PRELIB = @true |
| 77 |
endif # ! PRELIB |
| 78 |
endif |