xref: /freebsd/lib/libc++/Makefile (revision e92ffd9b626833ebdbf2742c8ffddc6cd94b963e)
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
242RT_HEADERS+=	unwind-arm.h
243RT_HEADERS+=	unwind-itanium.h
244RT_HEADERS+=	unwind.h
245.for hdr in ${RT_HEADERS}
246STD+=		${_LIBCXXRTDIR}/${hdr}
247.endfor
248
249INCSGROUPS+=	ALG
250ALGDIR=		${CXXINCLUDEDIR}/__algorithm
251ALG_HEADERS+=	adjacent_find.h
252ALG_HEADERS+=	all_of.h
253ALG_HEADERS+=	any_of.h
254ALG_HEADERS+=	binary_search.h
255ALG_HEADERS+=	clamp.h
256ALG_HEADERS+=	comp.h
257ALG_HEADERS+=	comp_ref_type.h
258ALG_HEADERS+=	copy.h
259ALG_HEADERS+=	copy_backward.h
260ALG_HEADERS+=	copy_if.h
261ALG_HEADERS+=	copy_n.h
262ALG_HEADERS+=	count.h
263ALG_HEADERS+=	count_if.h
264ALG_HEADERS+=	equal.h
265ALG_HEADERS+=	equal_range.h
266ALG_HEADERS+=	fill.h
267ALG_HEADERS+=	fill_n.h
268ALG_HEADERS+=	find.h
269ALG_HEADERS+=	find_end.h
270ALG_HEADERS+=	find_first_of.h
271ALG_HEADERS+=	find_if.h
272ALG_HEADERS+=	find_if_not.h
273ALG_HEADERS+=	for_each.h
274ALG_HEADERS+=	for_each_n.h
275ALG_HEADERS+=	generate.h
276ALG_HEADERS+=	generate_n.h
277ALG_HEADERS+=	half_positive.h
278ALG_HEADERS+=	includes.h
279ALG_HEADERS+=	inplace_merge.h
280ALG_HEADERS+=	is_heap.h
281ALG_HEADERS+=	is_heap_until.h
282ALG_HEADERS+=	is_partitioned.h
283ALG_HEADERS+=	is_permutation.h
284ALG_HEADERS+=	is_sorted.h
285ALG_HEADERS+=	is_sorted_until.h
286ALG_HEADERS+=	iter_swap.h
287ALG_HEADERS+=	lexicographical_compare.h
288ALG_HEADERS+=	lower_bound.h
289ALG_HEADERS+=	make_heap.h
290ALG_HEADERS+=	max.h
291ALG_HEADERS+=	max_element.h
292ALG_HEADERS+=	merge.h
293ALG_HEADERS+=	min.h
294ALG_HEADERS+=	min_element.h
295ALG_HEADERS+=	minmax.h
296ALG_HEADERS+=	minmax_element.h
297ALG_HEADERS+=	mismatch.h
298ALG_HEADERS+=	move.h
299ALG_HEADERS+=	move_backward.h
300ALG_HEADERS+=	next_permutation.h
301ALG_HEADERS+=	none_of.h
302ALG_HEADERS+=	nth_element.h
303ALG_HEADERS+=	partial_sort.h
304ALG_HEADERS+=	partial_sort_copy.h
305ALG_HEADERS+=	partition.h
306ALG_HEADERS+=	partition_copy.h
307ALG_HEADERS+=	partition_point.h
308ALG_HEADERS+=	pop_heap.h
309ALG_HEADERS+=	prev_permutation.h
310ALG_HEADERS+=	push_heap.h
311ALG_HEADERS+=	remove.h
312ALG_HEADERS+=	remove_copy.h
313ALG_HEADERS+=	remove_copy_if.h
314ALG_HEADERS+=	remove_if.h
315ALG_HEADERS+=	replace.h
316ALG_HEADERS+=	replace_copy.h
317ALG_HEADERS+=	replace_copy_if.h
318ALG_HEADERS+=	replace_if.h
319ALG_HEADERS+=	reverse.h
320ALG_HEADERS+=	reverse_copy.h
321ALG_HEADERS+=	rotate.h
322ALG_HEADERS+=	rotate_copy.h
323ALG_HEADERS+=	sample.h
324ALG_HEADERS+=	search.h
325ALG_HEADERS+=	search_n.h
326ALG_HEADERS+=	set_difference.h
327ALG_HEADERS+=	set_intersection.h
328ALG_HEADERS+=	set_symmetric_difference.h
329ALG_HEADERS+=	set_union.h
330ALG_HEADERS+=	shift_left.h
331ALG_HEADERS+=	shift_right.h
332ALG_HEADERS+=	shuffle.h
333ALG_HEADERS+=	sift_down.h
334ALG_HEADERS+=	sort.h
335ALG_HEADERS+=	sort_heap.h
336ALG_HEADERS+=	stable_partition.h
337ALG_HEADERS+=	stable_sort.h
338ALG_HEADERS+=	swap_ranges.h
339ALG_HEADERS+=	transform.h
340ALG_HEADERS+=	unique.h
341ALG_HEADERS+=	unique_copy.h
342ALG_HEADERS+=	unwrap_iter.h
343ALG_HEADERS+=	upper_bound.h
344.for hdr in ${ALG_HEADERS}
345ALG+=		${HDRDIR}/__algorithm/${hdr}
346.endfor
347
348INCSGROUPS+=	FMT
349FMTDIR=		${CXXINCLUDEDIR}/__format
350FMT_HEADERS+=	format_error.h
351FMT_HEADERS+=	format_parse_context.h
352.for hdr in ${FMT_HEADERS}
353FMT+=		${HDRDIR}/__format/${hdr}
354.endfor
355
356INCSGROUPS+=	FUN
357FUNDIR=		${CXXINCLUDEDIR}/__functional
358FUN_HEADERS+=	binary_function.h
359FUN_HEADERS+=	binary_negate.h
360FUN_HEADERS+=	bind.h
361FUN_HEADERS+=	bind_front.h
362FUN_HEADERS+=	binder1st.h
363FUN_HEADERS+=	binder2nd.h
364FUN_HEADERS+=	default_searcher.h
365FUN_HEADERS+=	function.h
366FUN_HEADERS+=	hash.h
367FUN_HEADERS+=	identity.h
368FUN_HEADERS+=	invoke.h
369FUN_HEADERS+=	is_transparent.h
370FUN_HEADERS+=	mem_fn.h
371FUN_HEADERS+=	mem_fun_ref.h
372FUN_HEADERS+=	not_fn.h
373FUN_HEADERS+=	operations.h
374FUN_HEADERS+=	perfect_forward.h
375FUN_HEADERS+=	pointer_to_binary_function.h
376FUN_HEADERS+=	pointer_to_unary_function.h
377FUN_HEADERS+=	ranges_operations.h
378FUN_HEADERS+=	reference_wrapper.h
379FUN_HEADERS+=	unary_function.h
380FUN_HEADERS+=	unary_negate.h
381FUN_HEADERS+=	unwrap_ref.h
382FUN_HEADERS+=	weak_result_type.h
383.for hdr in ${FUN_HEADERS}
384FUN+=		${HDRDIR}/__functional/${hdr}
385.endfor
386
387INCSGROUPS+=	IT
388ITDIR=		${CXXINCLUDEDIR}/__iterator
389IT_HEADERS+=	access.h
390IT_HEADERS+=	advance.h
391IT_HEADERS+=	back_insert_iterator.h
392IT_HEADERS+=	common_iterator.h
393IT_HEADERS+=	concepts.h
394IT_HEADERS+=	counted_iterator.h
395IT_HEADERS+=	data.h
396IT_HEADERS+=	default_sentinel.h
397IT_HEADERS+=	distance.h
398IT_HEADERS+=	empty.h
399IT_HEADERS+=	erase_if_container.h
400IT_HEADERS+=	front_insert_iterator.h
401IT_HEADERS+=	incrementable_traits.h
402IT_HEADERS+=	insert_iterator.h
403IT_HEADERS+=	istream_iterator.h
404IT_HEADERS+=	istreambuf_iterator.h
405IT_HEADERS+=	iter_move.h
406IT_HEADERS+=	iter_swap.h
407IT_HEADERS+=	iterator.h
408IT_HEADERS+=	iterator_traits.h
409IT_HEADERS+=	move_iterator.h
410IT_HEADERS+=	next.h
411IT_HEADERS+=	ostream_iterator.h
412IT_HEADERS+=	ostreambuf_iterator.h
413IT_HEADERS+=	prev.h
414IT_HEADERS+=	projected.h
415IT_HEADERS+=	readable_traits.h
416IT_HEADERS+=	reverse_access.h
417IT_HEADERS+=	reverse_iterator.h
418IT_HEADERS+=	size.h
419IT_HEADERS+=	wrap_iter.h
420.for hdr in ${IT_HEADERS}
421IT+=		${HDRDIR}/__iterator/${hdr}
422.endfor
423
424INCSGROUPS+=	MEM
425MEMDIR=		${CXXINCLUDEDIR}/__memory
426MEM_HEADERS+=	addressof.h
427MEM_HEADERS+=	allocation_guard.h
428MEM_HEADERS+=	allocator.h
429MEM_HEADERS+=	allocator_arg_t.h
430MEM_HEADERS+=	allocator_traits.h
431MEM_HEADERS+=	auto_ptr.h
432MEM_HEADERS+=	compressed_pair.h
433MEM_HEADERS+=	construct_at.h
434MEM_HEADERS+=	pointer_safety.h
435MEM_HEADERS+=	pointer_traits.h
436MEM_HEADERS+=	raw_storage_iterator.h
437MEM_HEADERS+=	shared_ptr.h
438MEM_HEADERS+=	temporary_buffer.h
439MEM_HEADERS+=	uninitialized_algorithms.h
440MEM_HEADERS+=	unique_ptr.h
441MEM_HEADERS+=	uses_allocator.h
442.for hdr in ${MEM_HEADERS}
443MEM+=		${HDRDIR}/__memory/${hdr}
444.endfor
445
446INCSGROUPS+=	RND
447RNDDIR=		${CXXINCLUDEDIR}/__random
448RND_HEADERS+=	uniform_int_distribution.h
449.for hdr in ${RND_HEADERS}
450RND+=		${HDRDIR}/__random/${hdr}
451.endfor
452
453INCSGROUPS+=	RNG
454RNGDIR=		${CXXINCLUDEDIR}/__ranges
455RNG_HEADERS+=	access.h
456RNG_HEADERS+=	all.h
457RNG_HEADERS+=	common_view.h
458RNG_HEADERS+=	concepts.h
459RNG_HEADERS+=	copyable_box.h
460RNG_HEADERS+=	dangling.h
461RNG_HEADERS+=	data.h
462RNG_HEADERS+=	drop_view.h
463RNG_HEADERS+=	empty.h
464RNG_HEADERS+=	empty_view.h
465RNG_HEADERS+=	enable_borrowed_range.h
466RNG_HEADERS+=	enable_view.h
467RNG_HEADERS+=	non_propagating_cache.h
468RNG_HEADERS+=	ref_view.h
469RNG_HEADERS+=	size.h
470RNG_HEADERS+=	subrange.h
471RNG_HEADERS+=	transform_view.h
472RNG_HEADERS+=	view_interface.h
473.for hdr in ${RNG_HEADERS}
474RNG+=		${HDRDIR}/__ranges/${hdr}
475.endfor
476
477INCSGROUPS+=	UTL
478UTLDIR=		${CXXINCLUDEDIR}/__utility
479UTL_HEADERS+=	__decay_copy.h
480UTL_HEADERS+=	as_const.h
481UTL_HEADERS+=	cmp.h
482UTL_HEADERS+=	declval.h
483UTL_HEADERS+=	exchange.h
484UTL_HEADERS+=	forward.h
485UTL_HEADERS+=	in_place.h
486UTL_HEADERS+=	integer_sequence.h
487UTL_HEADERS+=	move.h
488UTL_HEADERS+=	pair.h
489UTL_HEADERS+=	piecewise_construct.h
490UTL_HEADERS+=	rel_ops.h
491UTL_HEADERS+=	swap.h
492UTL_HEADERS+=	to_underlying.h
493.for hdr in ${UTL_HEADERS}
494UTL+=		${HDRDIR}/__utility/${hdr}
495.endfor
496
497INCSGROUPS+=	VAR
498VAR_HEADERS+=	monostate.h
499VARDIR=	${CXXINCLUDEDIR}/__variant
500.for hdr in ${VAR_HEADERS}
501VAR+=		${HDRDIR}/__variant/${hdr}
502.endfor
503
504INCSGROUPS+=	EXP
505EXPDIR=		${CXXINCLUDEDIR}/experimental
506EXP_HEADERS+=	__config
507EXP_HEADERS+=	__memory
508EXP_HEADERS+=	algorithm
509EXP_HEADERS+=	coroutine
510EXP_HEADERS+=	deque
511EXP_HEADERS+=	filesystem
512EXP_HEADERS+=	forward_list
513EXP_HEADERS+=	functional
514EXP_HEADERS+=	iterator
515EXP_HEADERS+=	list
516EXP_HEADERS+=	map
517EXP_HEADERS+=	memory_resource
518EXP_HEADERS+=	propagate_const
519EXP_HEADERS+=	regex
520EXP_HEADERS+=	set
521EXP_HEADERS+=	simd
522EXP_HEADERS+=	string
523EXP_HEADERS+=	type_traits
524EXP_HEADERS+=	unordered_map
525EXP_HEADERS+=	unordered_set
526EXP_HEADERS+=	utility
527EXP_HEADERS+=	vector
528.for hdr in ${EXP_HEADERS}
529EXP+=		${HDRDIR}/experimental/${hdr}
530.endfor
531
532INCSGROUPS+=	EXT
533EXTDIR=		${CXXINCLUDEDIR}/ext
534EXT_HEADERS+=	__hash
535EXT_HEADERS+=	hash_map
536EXT_HEADERS+=	hash_set
537.for hdr in ${EXT_HEADERS}
538EXT+=		${HDRDIR}/ext/${hdr}
539.endfor
540
541.include <bsd.lib.mk>
542