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