xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision 4f2483e5d0c339c7ac30db66a67c108da0b33ca6)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright (c) 2012 by Delphix. All rights reserved.
14# Copyright 2015 Garrett D'Amore <garrett@damore.org>
15# Copyright 2019 Joyent, Inc.
16# Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
17# Copyright 2023 Bill Sommerfeld <sommerfeld@alum.mit.edu>
18# Copyright 2025 Oxide Computer Company
19#
20
21SUBDIRS = \
22	catopen \
23	clocklock \
24	err \
25	fexecve \
26	fpround \
27	i18n \
28	newlocale \
29	nl_langinfo \
30	printf-intmax \
31	priv_gettext \
32	qsort \
33	posix_spawn \
34	random \
35	regex \
36	select \
37	stdio \
38	symbols \
39	threads \
40	wcsrtombs \
41	wctype
42
43PROGS = \
44	aligned_alloc \
45	ascftime \
46	asprintf-14933 \
47	c11_threads \
48	c11_tss \
49	call_once \
50	closefrom \
51	dprintf \
52	endian \
53	env-7076 \
54	fnmatch \
55	getlocname \
56	isatty \
57	localeconv \
58	memchr \
59	memset_s \
60	mutex_attr \
61	mutex-16200 \
62	posix_memalign \
63	printf-15294 \
64	printf-9511 \
65	psignal-5097 \
66	ptsname \
67	quick_exit_order \
68	quick_exit_status \
69	set_constraint_handler_s \
70	strcoll-strxfrm-6907 \
71	stdbit \
72	strerror \
73	strtonum \
74	strtox \
75	timespec_get \
76	timespec_getres \
77	wcslcat \
78	wcslcpy \
79	wcsftime \
80	wcsftime_old \
81	wcsncasecmp \
82	wcsncasecmp-7344 \
83	wcsncasecmp-7350 \
84	uchar \
85	utimes
86
87SCRIPTS = \
88	aligned_alloc \
89	quick_exit \
90	psignal
91
92CPPFLAGS += -D_REENTRANT
93
94PROGS32 = $(PROGS:%=%.32)
95PROGS64 = \
96	$(PROGS:%=%.64) \
97	printf-6961.64
98
99aligned_alloc.32 :=	CSTD=$(CSTD_GNU17)
100aligned_alloc.64 :=	CSTD=$(CSTD_GNU17)
101aligned_alloc.32 :=	LDLIBS += -lproc
102aligned_alloc.64 :=	LDLIBS64 += -lproc
103posix_memalign.32 :=	LDLIBS += -lproc
104posix_memalign.64 :=	LDLIBS64 += -lproc
105
106asprintf-14933.32 :=	CSTD=$(CSTD_GNU17)
107asprintf-14933.64 :=	CSTD=$(CSTD_GNU17)
108
109dprintf.32 :=	CSTD=$(CSTD_GNU17)
110dprintf.64 :=	CSTD=$(CSTD_GNU17)
111dprintf.32 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
112dprintf.64 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
113
114memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
115memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
116set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
117set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
118
119getlocname.32 := CSTD=$(CSTD_GNU17)
120getlocname.64 := CSTD=$(CSTD_GNU17)
121
122isatty.32 :=	CSTD=$(CSTD_GNU17)
123isatty.64 :=	CSTD=$(CSTD_GNU17)
124
125localeconv.32 :=	CSTD=$(CSTD_GNU17)
126localeconv.64 :=	CSTD=$(CSTD_GNU17)
127
128mutex-16200.32 :=	LDLIBS += -lproc
129mutex-16200.64 :=	LDLIBS64 += -lproc
130mutex-16200.32 :=	CSTD=$(CSTD_GNU17)
131mutex-16200.64 :=	CSTD=$(CSTD_GNU17)
132mutex_attr.32 :=	CSTD=$(CSTD_GNU17)
133mutex_attr.64 :=	CSTD=$(CSTD_GNU17)
134
135ptsname.32 :=		LDLIBS += -lsocket
136ptsname.64 :=		LDLIBS64 += -lsocket
137
138stdbit.32 :=	CSTD=$(CSTD_GNU17)
139stdbit.64 :=	CSTD=$(CSTD_GNU17)
140
141strtonum.32 :=		CSTD=$(CSTD_GNU17)
142strtonum.64 :=		CSTD=$(CSTD_GNU17)
143
144strtox.32 :=		CSTD=$(CSTD_GNU17)
145strtox.64 :=		CSTD=$(CSTD_GNU17)
146
147timespec_get.32 :=	CSTD=$(CSTD_GNU17)
148timespec_get.64 :=	CSTD=$(CSTD_GNU17)
149timespec_getres.32 :=	CSTD=$(CSTD_GNU17)
150timespec_getres.64 :=	CSTD=$(CSTD_GNU17)
151
152wcsftime.32 :=		CSTD=$(CSTD_GNU17)
153wcsftime.64 :=		CSTD=$(CSTD_GNU17)
154
155# This tests the XPG4 wcsftime(), so build it with XPG4-era C.
156wcsftime_old.32 :=	CSTD=$(CSTD_GNU89)
157wcsftime_old.64 :=	CSTD=$(CSTD_GNU89)
158
159wcslcat.32 :=		CSTD=$(CSTD_GNU17)
160wcslcat.64 :=		CSTD=$(CSTD_GNU17)
161wcslcpy.32 :=		CSTD=$(CSTD_GNU17)
162wcslcpy.64 :=		CSTD=$(CSTD_GNU17)
163
164ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
165ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
166	$(PROGS64:%=$(ROOTOPTDIR)/%) \
167	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
168
169include $(SRC)/cmd/Makefile.cmd
170
171all     :=      TARGET = all
172install :=      TARGET = install
173clean   :=      TARGET = clean
174clobber :=      TARGET = clobber
175lint    :=      TARGET = lint
176
177.KEEP_STATE:
178
179install: $(SUBDIRS) $(ROOTOPTPROGS)
180
181all: $(SUBDIRS) $(PROGS32) $(PROGS64)
182
183clean lint: $(SUBDIRS)
184
185$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
186
187$(ROOTOPTDIR):
188	$(INS.dir)
189
190$(ROOTOPTDIR)/%: %
191	$(INS.file)
192
193$(ROOTOPTDIR)/%: %.ksh
194	$(INS.rename)
195
196%.64: %.c
197	$(LINK64.c) -o $@ $< $(LDLIBS64)
198	$(POST_PROCESS)
199
200%.32: %.c
201	$(LINK.c) -o $@ $< $(LDLIBS)
202	$(POST_PROCESS)
203
204clobber: $(SUBDIRS)
205	$(RM) $(PROGS32) $(PROGS64)
206
207$(SUBDIRS): FRC
208	@cd $@; pwd; $(MAKE) $(TARGET)
209
210FRC:
211