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