xref: /freebsd/lib/libomp/Makefile (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1# z_Linux_asm.S is missing BTI support
2MK_BRANCH_PROTECTION=no
3
4.include <bsd.compiler.mk>
5
6SHLIB_NAME=	libomp.so
7
8OMPSRC=		${SRCTOP}/contrib/llvm-project/openmp/runtime/src
9ITTSRC=		${OMPSRC}/thirdparty/ittnotify
10.PATH:		${OMPSRC}
11.PATH:		${ITTSRC}
12
13SRCS+=		ittnotify_static.cpp
14SRCS+=		kmp_affinity.cpp
15SRCS+=		kmp_alloc.cpp
16SRCS+=		kmp_atomic.cpp
17SRCS+=		kmp_barrier.cpp
18SRCS+=		kmp_cancel.cpp
19SRCS+=		kmp_csupport.cpp
20SRCS+=		kmp_debug.cpp
21SRCS+=		kmp_dispatch.cpp
22SRCS+=		kmp_environment.cpp
23SRCS+=		kmp_error.cpp
24SRCS+=		kmp_ftn_cdecl.cpp
25SRCS+=		kmp_ftn_extra.cpp
26SRCS+=		kmp_global.cpp
27SRCS+=		kmp_gsupport.cpp
28SRCS+=		kmp_i18n.cpp
29SRCS+=		kmp_io.cpp
30SRCS+=		kmp_itt.cpp
31SRCS+=		kmp_lock.cpp
32SRCS+=		kmp_runtime.cpp
33SRCS+=		kmp_sched.cpp
34SRCS+=		kmp_settings.cpp
35SRCS+=		kmp_str.cpp
36SRCS+=		kmp_taskdeps.cpp
37SRCS+=		kmp_tasking.cpp
38SRCS+=		kmp_threadprivate.cpp
39SRCS+=		kmp_utility.cpp
40SRCS+=		kmp_version.cpp
41SRCS+=		kmp_wait_release.cpp
42SRCS+=		ompt-general.cpp
43SRCS+=		z_Linux_asm.S
44SRCS+=		z_Linux_util.cpp
45INCS+=		omp.h
46
47WARNS?=		1
48
49CFLAGS+=	-D__STDC_CONSTANT_MACROS
50CFLAGS+=	-D__STDC_FORMAT_MACROS
51CFLAGS+=	-D__STDC_LIMIT_MACROS
52CFLAGS+=	-I${.CURDIR}
53CFLAGS+=	-I${OMPSRC}
54CFLAGS+=	-I${ITTSRC}
55CFLAGS+=	-ffunction-sections
56CFLAGS+=	-fdata-sections
57CXXFLAGS+=	-fvisibility-inlines-hidden
58CXXFLAGS+=	-fno-exceptions
59CXXFLAGS+=	-fno-rtti
60CXXSTD=		c++17
61
62.if ${COMPILER_TYPE} == "clang"
63.if ${MACHINE_CPUARCH} == "i386"
64.if ${COMPILER_VERSION} >= 90000
65# When targeting i386, clang 9.0.0 produces a new warning about large atomic
66# operations "possibly incurring significant performance penalties", but there
67# is not much we can do about it.
68CWARNFLAGS+=	-Wno-atomic-alignment
69.endif
70.if ${COMPILER_VERSION} >= 170000
71# When targeting i386, clang 17.0.0 produces a new warning that __sync
72# builtin operations must have natural alignment, but there is not much we
73# can do about it.
74CWARNFLAGS+=	-Wno-sync-alignment
75.endif # COMPILER_VERSION >= 170000
76.endif # MACHINE_CPUARCH == i386
77.if ${COMPILER_VERSION} >= 180000
78# clang 18.0.0 introduces a new warning about variable length arrays in C++,
79# which OpenMP makes use of in several sources.
80CXXWARNFLAGS+=	-Wno-vla-cxx-extension
81.endif # COMPILER_VERSION >= 180000
82.endif # COMPILER_TYPE == clang
83
84LDFLAGS+=	-Wl,--warn-shared-textrel
85LDFLAGS+=	-Wl,--gc-sections
86LDFLAGS+=	-Wl,-z,noexecstack
87LDFLAGS+=	-Wl,-fini=__kmp_internal_end_fini
88LDFLAGS+=	-Wl,-soname,libomp.so
89
90VERSION_MAP=	${OMPSRC}/exports_so.txt
91
92LIBADD+=	pthread
93LIBADD+=	m
94
95SYMLINKS+=	${SHLIB_NAME} ${LIBDIR}/libgomp.so
96
97.include <bsd.lib.mk>
98