xref: /freebsd/lib/libc++/Makefile (revision 1323ec571215a77ddd21294f0871979d5ad6b992)
1# $FreeBSD$
2
3SHLIBDIR?=	/lib
4
5.include <src.opts.mk>
6
7PACKAGE=	clibs
8_LIBCXXRTDIR=	${SRCTOP}/contrib/libcxxrt
9HDRDIR=		${SRCTOP}/contrib/llvm-project/libcxx/include
10SRCDIR=		${SRCTOP}/contrib/llvm-project/libcxx/src
11CXXINCLUDEDIR=	${INCLUDEDIR}/c++/v${SHLIB_MAJOR}
12
13.PATH: ${SRCDIR}
14
15LIB=		c++
16SHLIB_MAJOR=	1
17SHLIB_LDSCRIPT=	libc++.ldscript
18
19SRCS+=		algorithm.cpp
20SRCS+=		any.cpp
21SRCS+=		atomic.cpp
22SRCS+=		barrier.cpp
23SRCS+=		bind.cpp
24SRCS+=		charconv.cpp
25SRCS+=		chrono.cpp
26SRCS+=		condition_variable.cpp
27SRCS+=		condition_variable_destructor.cpp
28SRCS+=		debug.cpp
29SRCS+=		exception.cpp
30SRCS+=		filesystem/directory_iterator.cpp
31SRCS+=		filesystem/int128_builtins.cpp
32SRCS+=		filesystem/operations.cpp
33SRCS+=		format.cpp
34SRCS+=		functional.cpp
35SRCS+=		future.cpp
36SRCS+=		hash.cpp
37SRCS+=		ios.cpp
38SRCS+=		ios.instantiations.cpp
39SRCS+=		iostream.cpp
40SRCS+=		locale.cpp
41SRCS+=		memory.cpp
42SRCS+=		mutex.cpp
43SRCS+=		mutex_destructor.cpp
44SRCS+=		new.cpp
45SRCS+=		optional.cpp
46SRCS+=		random.cpp
47SRCS+=		random_shuffle.cpp
48SRCS+=		regex.cpp
49SRCS+=		shared_mutex.cpp
50SRCS+=		stdexcept.cpp
51SRCS+=		string.cpp
52SRCS+=		strstream.cpp
53SRCS+=		system_error.cpp
54SRCS+=		thread.cpp
55SRCS+=		typeinfo.cpp
56SRCS+=		utility.cpp
57SRCS+=		valarray.cpp
58SRCS+=		variant.cpp
59SRCS+=		vector.cpp
60
61CXXRT_SRCS+=	auxhelper.cc
62CXXRT_SRCS+=	dynamic_cast.cc
63CXXRT_SRCS+=	exception.cc
64CXXRT_SRCS+=	guard.cc
65CXXRT_SRCS+=	libelftc_dem_gnu3.c
66CXXRT_SRCS+=	memory.cc
67CXXRT_SRCS+=	stdexcept.cc
68CXXRT_SRCS+=	terminate.cc
69CXXRT_SRCS+=	typeinfo.cc
70
71.for _S in ${CXXRT_SRCS}
72CLEANFILES+=	cxxrt_${_S}
73STATICOBJS+=	cxxrt_${_S:R}.o
74cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOMETA
75	ln -sf ${.ALLSRC} ${.TARGET}
76.endfor
77
78WARNS?=		0
79CFLAGS+=	-isystem ${.CURDIR}
80CFLAGS+=	-isystem ${HDRDIR}
81CFLAGS+=	-isystem ${_LIBCXXRTDIR}
82CFLAGS+=	-nostdinc++
83CFLAGS+=	-nostdlib
84CFLAGS+=	-D_LIBCPP_BUILDING_LIBRARY
85CFLAGS+=	-DLIBCXXRT
86CFLAGS+=	-ffunction-sections
87CFLAGS+=	-fdata-sections
88CXXSTD?=	c++14
89
90LIBADD+=	cxxrt
91
92INCSGROUPS+=	STD
93STDDIR=		${CXXINCLUDEDIR}
94STD_HEADERS+=	__availability
95STD_HEADERS+=	__bit_reference
96STD_HEADERS+=	__bits
97STD_HEADERS+=	__bsd_locale_defaults.h
98STD_HEADERS+=	__bsd_locale_fallbacks.h
99STD_HEADERS+=	__config
100STD_HEADERS+=	__debug
101STD_HEADERS+=	__errc
102STD_HEADERS+=	__function_like.h
103STD_HEADERS+=	__functional_base
104STD_HEADERS+=	__hash_table
105STD_HEADERS+=	__libcpp_version
106STD_HEADERS+=	__locale
107STD_HEADERS+=	__mutex_base
108STD_HEADERS+=	__node_handle
109STD_HEADERS+=	__nullptr
110STD_HEADERS+=	__split_buffer
111STD_HEADERS+=	__std_stream
112STD_HEADERS+=	__string
113STD_HEADERS+=	__threading_support
114STD_HEADERS+=	__tree
115STD_HEADERS+=	__tuple
116STD_HEADERS+=	__undef_macros
117STD_HEADERS+=	algorithm
118STD_HEADERS+=	any
119STD_HEADERS+=	array
120STD_HEADERS+=	atomic
121STD_HEADERS+=	barrier
122STD_HEADERS+=	bit
123STD_HEADERS+=	bitset
124STD_HEADERS+=	cassert
125STD_HEADERS+=	ccomplex
126STD_HEADERS+=	cctype
127STD_HEADERS+=	cerrno
128STD_HEADERS+=	cfenv
129STD_HEADERS+=	cfloat
130STD_HEADERS+=	charconv
131STD_HEADERS+=	chrono
132STD_HEADERS+=	cinttypes
133STD_HEADERS+=	ciso646
134STD_HEADERS+=	climits
135STD_HEADERS+=	clocale
136STD_HEADERS+=	cmath
137STD_HEADERS+=	codecvt
138STD_HEADERS+=	compare
139STD_HEADERS+=	complex
140STD_HEADERS+=	complex.h
141STD_HEADERS+=	concepts
142STD_HEADERS+=	condition_variable
143STD_HEADERS+=	csetjmp
144STD_HEADERS+=	csignal
145STD_HEADERS+=	cstdarg
146STD_HEADERS+=	cstdbool
147STD_HEADERS+=	cstddef
148STD_HEADERS+=	cstdint
149STD_HEADERS+=	cstdio
150STD_HEADERS+=	cstdlib
151STD_HEADERS+=	cstring
152STD_HEADERS+=	ctgmath
153STD_HEADERS+=	ctime
154STD_HEADERS+=	ctype.h
155STD_HEADERS+=	cwchar
156STD_HEADERS+=	cwctype
157STD_HEADERS+=	deque
158STD_HEADERS+=	errno.h
159STD_HEADERS+=	exception
160STD_HEADERS+=	execution
161STD_HEADERS+=	fenv.h
162STD_HEADERS+=	filesystem
163STD_HEADERS+=	float.h
164STD_HEADERS+=	format
165STD_HEADERS+=	forward_list
166STD_HEADERS+=	fstream
167STD_HEADERS+=	functional
168STD_HEADERS+=	future
169STD_HEADERS+=	initializer_list
170STD_HEADERS+=	inttypes.h
171STD_HEADERS+=	iomanip
172STD_HEADERS+=	ios
173STD_HEADERS+=	iosfwd
174STD_HEADERS+=	iostream
175STD_HEADERS+=	istream
176STD_HEADERS+=	iterator
177STD_HEADERS+=	latch
178STD_HEADERS+=	limits
179STD_HEADERS+=	limits.h
180STD_HEADERS+=	list
181STD_HEADERS+=	locale
182STD_HEADERS+=	locale.h
183STD_HEADERS+=	map
184STD_HEADERS+=	math.h
185STD_HEADERS+=	memory
186STD_HEADERS+=	module.modulemap
187STD_HEADERS+=	mutex
188STD_HEADERS+=	new
189STD_HEADERS+=	numbers
190STD_HEADERS+=	numeric
191STD_HEADERS+=	optional
192STD_HEADERS+=	ostream
193STD_HEADERS+=	queue
194STD_HEADERS+=	random
195STD_HEADERS+=	ranges
196STD_HEADERS+=	ratio
197STD_HEADERS+=	regex
198STD_HEADERS+=	scoped_allocator
199STD_HEADERS+=	semaphore
200STD_HEADERS+=	set
201STD_HEADERS+=	setjmp.h
202STD_HEADERS+=	shared_mutex
203STD_HEADERS+=	span
204STD_HEADERS+=	sstream
205STD_HEADERS+=	stack
206STD_HEADERS+=	stdbool.h
207STD_HEADERS+=	stddef.h
208STD_HEADERS+=	stdexcept
209STD_HEADERS+=	stdint.h
210STD_HEADERS+=	stdio.h
211STD_HEADERS+=	stdlib.h
212STD_HEADERS+=	streambuf
213STD_HEADERS+=	string
214STD_HEADERS+=	string.h
215STD_HEADERS+=	string_view
216STD_HEADERS+=	strstream
217STD_HEADERS+=	system_error
218STD_HEADERS+=	tgmath.h
219STD_HEADERS+=	thread
220STD_HEADERS+=	tuple
221STD_HEADERS+=	type_traits
222STD_HEADERS+=	typeindex
223STD_HEADERS+=	typeinfo
224STD_HEADERS+=	unordered_map
225STD_HEADERS+=	unordered_set
226STD_HEADERS+=	utility
227STD_HEADERS+=	valarray
228STD_HEADERS+=	variant
229STD_HEADERS+=	vector
230STD_HEADERS+=	version
231STD_HEADERS+=	wchar.h
232STD_HEADERS+=	wctype.h
233.for hdr in ${STD_HEADERS}
234STD+=		${HDRDIR}/${hdr}
235.endfor
236
237# Special case for __config_site, which as of libc++ 12.0.0 is generated by
238# CMake, and as of 13.0.0 installed side-by-side with__config.
239STD+=		${.CURDIR}/__config_site
240
241RT_HEADERS+=	cxxabi.h
242.for hdr in ${RT_HEADERS}
243STD+=		${_LIBCXXRTDIR}/${hdr}
244.endfor
245
246INCSGROUPS+=	ALG
247ALGDIR=		${CXXINCLUDEDIR}/__algorithm
248ALG_HEADERS+=	adjacent_find.h
249ALG_HEADERS+=	all_of.h
250ALG_HEADERS+=	any_of.h
251ALG_HEADERS+=	binary_search.h
252ALG_HEADERS+=	clamp.h
253ALG_HEADERS+=	comp.h
254ALG_HEADERS+=	comp_ref_type.h
255ALG_HEADERS+=	copy.h
256ALG_HEADERS+=	copy_backward.h
257ALG_HEADERS+=	copy_if.h
258ALG_HEADERS+=	copy_n.h
259ALG_HEADERS+=	count.h
260ALG_HEADERS+=	count_if.h
261ALG_HEADERS+=	equal.h
262ALG_HEADERS+=	equal_range.h
263ALG_HEADERS+=	fill.h
264ALG_HEADERS+=	fill_n.h
265ALG_HEADERS+=	find.h
266ALG_HEADERS+=	find_end.h
267ALG_HEADERS+=	find_first_of.h
268ALG_HEADERS+=	find_if.h
269ALG_HEADERS+=	find_if_not.h
270ALG_HEADERS+=	for_each.h
271ALG_HEADERS+=	for_each_n.h
272ALG_HEADERS+=	generate.h
273ALG_HEADERS+=	generate_n.h
274ALG_HEADERS+=	half_positive.h
275ALG_HEADERS+=	includes.h
276ALG_HEADERS+=	inplace_merge.h
277ALG_HEADERS+=	is_heap.h
278ALG_HEADERS+=	is_heap_until.h
279ALG_HEADERS+=	is_partitioned.h
280ALG_HEADERS+=	is_permutation.h
281ALG_HEADERS+=	is_sorted.h
282ALG_HEADERS+=	is_sorted_until.h
283ALG_HEADERS+=	iter_swap.h
284ALG_HEADERS+=	lexicographical_compare.h
285ALG_HEADERS+=	lower_bound.h
286ALG_HEADERS+=	make_heap.h
287ALG_HEADERS+=	max.h
288ALG_HEADERS+=	max_element.h
289ALG_HEADERS+=	merge.h
290ALG_HEADERS+=	min.h
291ALG_HEADERS+=	min_element.h
292ALG_HEADERS+=	minmax.h
293ALG_HEADERS+=	minmax_element.h
294ALG_HEADERS+=	mismatch.h
295ALG_HEADERS+=	move.h
296ALG_HEADERS+=	move_backward.h
297ALG_HEADERS+=	next_permutation.h
298ALG_HEADERS+=	none_of.h
299ALG_HEADERS+=	nth_element.h
300ALG_HEADERS+=	partial_sort.h
301ALG_HEADERS+=	partial_sort_copy.h
302ALG_HEADERS+=	partition.h
303ALG_HEADERS+=	partition_copy.h
304ALG_HEADERS+=	partition_point.h
305ALG_HEADERS+=	pop_heap.h
306ALG_HEADERS+=	prev_permutation.h
307ALG_HEADERS+=	push_heap.h
308ALG_HEADERS+=	remove.h
309ALG_HEADERS+=	remove_copy.h
310ALG_HEADERS+=	remove_copy_if.h
311ALG_HEADERS+=	remove_if.h
312ALG_HEADERS+=	replace.h
313ALG_HEADERS+=	replace_copy.h
314ALG_HEADERS+=	replace_copy_if.h
315ALG_HEADERS+=	replace_if.h
316ALG_HEADERS+=	reverse.h
317ALG_HEADERS+=	reverse_copy.h
318ALG_HEADERS+=	rotate.h
319ALG_HEADERS+=	rotate_copy.h
320ALG_HEADERS+=	sample.h
321ALG_HEADERS+=	search.h
322ALG_HEADERS+=	search_n.h
323ALG_HEADERS+=	set_difference.h
324ALG_HEADERS+=	set_intersection.h
325ALG_HEADERS+=	set_symmetric_difference.h
326ALG_HEADERS+=	set_union.h
327ALG_HEADERS+=	shift_left.h
328ALG_HEADERS+=	shift_right.h
329ALG_HEADERS+=	shuffle.h
330ALG_HEADERS+=	sift_down.h
331ALG_HEADERS+=	sort.h
332ALG_HEADERS+=	sort_heap.h
333ALG_HEADERS+=	stable_partition.h
334ALG_HEADERS+=	stable_sort.h
335ALG_HEADERS+=	swap_ranges.h
336ALG_HEADERS+=	transform.h
337ALG_HEADERS+=	unique.h
338ALG_HEADERS+=	unique_copy.h
339ALG_HEADERS+=	unwrap_iter.h
340ALG_HEADERS+=	upper_bound.h
341.for hdr in ${ALG_HEADERS}
342ALG+=		${HDRDIR}/__algorithm/${hdr}
343.endfor
344
345INCSGROUPS+=	FMT
346FMTDIR=		${CXXINCLUDEDIR}/__format
347FMT_HEADERS+=	format_error.h
348FMT_HEADERS+=	format_parse_context.h
349.for hdr in ${FMT_HEADERS}
350FMT+=		${HDRDIR}/__format/${hdr}
351.endfor
352
353INCSGROUPS+=	FUN
354FUNDIR=		${CXXINCLUDEDIR}/__functional
355FUN_HEADERS+=	binary_function.h
356FUN_HEADERS+=	binary_negate.h
357FUN_HEADERS+=	bind.h
358FUN_HEADERS+=	bind_front.h
359FUN_HEADERS+=	binder1st.h
360FUN_HEADERS+=	binder2nd.h
361FUN_HEADERS+=	default_searcher.h
362FUN_HEADERS+=	function.h
363FUN_HEADERS+=	hash.h
364FUN_HEADERS+=	identity.h
365FUN_HEADERS+=	invoke.h
366FUN_HEADERS+=	is_transparent.h
367FUN_HEADERS+=	mem_fn.h
368FUN_HEADERS+=	mem_fun_ref.h
369FUN_HEADERS+=	not_fn.h
370FUN_HEADERS+=	operations.h
371FUN_HEADERS+=	perfect_forward.h
372FUN_HEADERS+=	pointer_to_binary_function.h
373FUN_HEADERS+=	pointer_to_unary_function.h
374FUN_HEADERS+=	ranges_operations.h
375FUN_HEADERS+=	reference_wrapper.h
376FUN_HEADERS+=	unary_function.h
377FUN_HEADERS+=	unary_negate.h
378FUN_HEADERS+=	unwrap_ref.h
379FUN_HEADERS+=	weak_result_type.h
380.for hdr in ${FUN_HEADERS}
381FUN+=		${HDRDIR}/__functional/${hdr}
382.endfor
383
384INCSGROUPS+=	IT
385ITDIR=		${CXXINCLUDEDIR}/__iterator
386IT_HEADERS+=	access.h
387IT_HEADERS+=	advance.h
388IT_HEADERS+=	back_insert_iterator.h
389IT_HEADERS+=	common_iterator.h
390IT_HEADERS+=	concepts.h
391IT_HEADERS+=	counted_iterator.h
392IT_HEADERS+=	data.h
393IT_HEADERS+=	default_sentinel.h
394IT_HEADERS+=	distance.h
395IT_HEADERS+=	empty.h
396IT_HEADERS+=	erase_if_container.h
397IT_HEADERS+=	front_insert_iterator.h
398IT_HEADERS+=	incrementable_traits.h
399IT_HEADERS+=	insert_iterator.h
400IT_HEADERS+=	istream_iterator.h
401IT_HEADERS+=	istreambuf_iterator.h
402IT_HEADERS+=	iter_move.h
403IT_HEADERS+=	iter_swap.h
404IT_HEADERS+=	iterator.h
405IT_HEADERS+=	iterator_traits.h
406IT_HEADERS+=	move_iterator.h
407IT_HEADERS+=	next.h
408IT_HEADERS+=	ostream_iterator.h
409IT_HEADERS+=	ostreambuf_iterator.h
410IT_HEADERS+=	prev.h
411IT_HEADERS+=	projected.h
412IT_HEADERS+=	readable_traits.h
413IT_HEADERS+=	reverse_access.h
414IT_HEADERS+=	reverse_iterator.h
415IT_HEADERS+=	size.h
416IT_HEADERS+=	wrap_iter.h
417.for hdr in ${IT_HEADERS}
418IT+=		${HDRDIR}/__iterator/${hdr}
419.endfor
420
421INCSGROUPS+=	MEM
422MEMDIR=		${CXXINCLUDEDIR}/__memory
423MEM_HEADERS+=	addressof.h
424MEM_HEADERS+=	allocation_guard.h
425MEM_HEADERS+=	allocator.h
426MEM_HEADERS+=	allocator_arg_t.h
427MEM_HEADERS+=	allocator_traits.h
428MEM_HEADERS+=	auto_ptr.h
429MEM_HEADERS+=	compressed_pair.h
430MEM_HEADERS+=	construct_at.h
431MEM_HEADERS+=	pointer_safety.h
432MEM_HEADERS+=	pointer_traits.h
433MEM_HEADERS+=	raw_storage_iterator.h
434MEM_HEADERS+=	shared_ptr.h
435MEM_HEADERS+=	temporary_buffer.h
436MEM_HEADERS+=	uninitialized_algorithms.h
437MEM_HEADERS+=	unique_ptr.h
438MEM_HEADERS+=	uses_allocator.h
439.for hdr in ${MEM_HEADERS}
440MEM+=		${HDRDIR}/__memory/${hdr}
441.endfor
442
443INCSGROUPS+=	RND
444RNDDIR=		${CXXINCLUDEDIR}/__random
445RND_HEADERS+=	uniform_int_distribution.h
446.for hdr in ${RND_HEADERS}
447RND+=		${HDRDIR}/__random/${hdr}
448.endfor
449
450INCSGROUPS+=	RNG
451RNGDIR=		${CXXINCLUDEDIR}/__ranges
452RNG_HEADERS+=	access.h
453RNG_HEADERS+=	all.h
454RNG_HEADERS+=	common_view.h
455RNG_HEADERS+=	concepts.h
456RNG_HEADERS+=	copyable_box.h
457RNG_HEADERS+=	dangling.h
458RNG_HEADERS+=	data.h
459RNG_HEADERS+=	drop_view.h
460RNG_HEADERS+=	empty.h
461RNG_HEADERS+=	empty_view.h
462RNG_HEADERS+=	enable_borrowed_range.h
463RNG_HEADERS+=	enable_view.h
464RNG_HEADERS+=	non_propagating_cache.h
465RNG_HEADERS+=	ref_view.h
466RNG_HEADERS+=	size.h
467RNG_HEADERS+=	subrange.h
468RNG_HEADERS+=	transform_view.h
469RNG_HEADERS+=	view_interface.h
470.for hdr in ${RNG_HEADERS}
471RNG+=		${HDRDIR}/__ranges/${hdr}
472.endfor
473
474INCSGROUPS+=	UTL
475UTLDIR=		${CXXINCLUDEDIR}/__utility
476UTL_HEADERS+=	__decay_copy.h
477UTL_HEADERS+=	as_const.h
478UTL_HEADERS+=	cmp.h
479UTL_HEADERS+=	declval.h
480UTL_HEADERS+=	exchange.h
481UTL_HEADERS+=	forward.h
482UTL_HEADERS+=	in_place.h
483UTL_HEADERS+=	integer_sequence.h
484UTL_HEADERS+=	move.h
485UTL_HEADERS+=	pair.h
486UTL_HEADERS+=	piecewise_construct.h
487UTL_HEADERS+=	rel_ops.h
488UTL_HEADERS+=	swap.h
489UTL_HEADERS+=	to_underlying.h
490.for hdr in ${UTL_HEADERS}
491UTL+=		${HDRDIR}/__utility/${hdr}
492.endfor
493
494INCSGROUPS+=	VAR
495VAR_HEADERS+=	monostate.h
496VARDIR=	${CXXINCLUDEDIR}/__variant
497.for hdr in ${VAR_HEADERS}
498VAR+=		${HDRDIR}/__variant/${hdr}
499.endfor
500
501INCSGROUPS+=	EXP
502EXPDIR=		${CXXINCLUDEDIR}/experimental
503EXP_HEADERS+=	__config
504EXP_HEADERS+=	__memory
505EXP_HEADERS+=	algorithm
506EXP_HEADERS+=	coroutine
507EXP_HEADERS+=	deque
508EXP_HEADERS+=	filesystem
509EXP_HEADERS+=	forward_list
510EXP_HEADERS+=	functional
511EXP_HEADERS+=	iterator
512EXP_HEADERS+=	list
513EXP_HEADERS+=	map
514EXP_HEADERS+=	memory_resource
515EXP_HEADERS+=	propagate_const
516EXP_HEADERS+=	regex
517EXP_HEADERS+=	set
518EXP_HEADERS+=	simd
519EXP_HEADERS+=	string
520EXP_HEADERS+=	type_traits
521EXP_HEADERS+=	unordered_map
522EXP_HEADERS+=	unordered_set
523EXP_HEADERS+=	utility
524EXP_HEADERS+=	vector
525.for hdr in ${EXP_HEADERS}
526EXP+=		${HDRDIR}/experimental/${hdr}
527.endfor
528
529INCSGROUPS+=	EXT
530EXTDIR=		${CXXINCLUDEDIR}/ext
531EXT_HEADERS+=	__hash
532EXT_HEADERS+=	hash_map
533EXT_HEADERS+=	hash_set
534.for hdr in ${EXT_HEADERS}
535EXT+=		${HDRDIR}/ext/${hdr}
536.endfor
537
538.include <bsd.lib.mk>
539