xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision 438283cf397cce47d80cc67b04bbfdfe73b0d142)
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 2026 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	threads \
39	wcsrtombs \
40	wctype
41
42PROGS = \
43	aio_cancel \
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	swprintf-17781 \
76	timespec_get \
77	timespec_getres \
78	wcslcat \
79	wcslcpy \
80	wcsftime \
81	wcsftime_old \
82	wcsncasecmp \
83	wcsncasecmp-7344 \
84	wcsncasecmp-7350 \
85	uchar \
86	utimes
87
88SCRIPTS = \
89	aligned_alloc \
90	quick_exit \
91	psignal
92
93CPPFLAGS += -D_REENTRANT
94
95PROGS32 = $(PROGS:%=%.32)
96PROGS64 = \
97	$(PROGS:%=%.64) \
98	printf-6961.64
99
100aio_cancel.32 :=	CSTD=$(CSTD_GNU17)
101aio_cancel.64 :=	CSTD=$(CSTD_GNU17)
102aio_cancel.32 :=	LDLIBS += -lproc
103aio_cancel.64 :=	LDLIBS64 += -lproc
104
105aligned_alloc.32 :=	CSTD=$(CSTD_GNU17)
106aligned_alloc.64 :=	CSTD=$(CSTD_GNU17)
107aligned_alloc.32 :=	LDLIBS += -lproc
108aligned_alloc.64 :=	LDLIBS64 += -lproc
109posix_memalign.32 :=	LDLIBS += -lproc
110posix_memalign.64 :=	LDLIBS64 += -lproc
111
112asprintf-14933.32 :=	CSTD=$(CSTD_GNU17)
113asprintf-14933.64 :=	CSTD=$(CSTD_GNU17)
114
115dprintf.32 :=	CSTD=$(CSTD_GNU17)
116dprintf.64 :=	CSTD=$(CSTD_GNU17)
117dprintf.32 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
118dprintf.64 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
119
120memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
121memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
122set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
123set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
124
125getlocname.32 := CSTD=$(CSTD_GNU17)
126getlocname.64 := CSTD=$(CSTD_GNU17)
127
128isatty.32 :=	CSTD=$(CSTD_GNU17)
129isatty.64 :=	CSTD=$(CSTD_GNU17)
130
131localeconv.32 :=	CSTD=$(CSTD_GNU17)
132localeconv.64 :=	CSTD=$(CSTD_GNU17)
133
134mutex-16200.32 :=	LDLIBS += -lproc
135mutex-16200.64 :=	LDLIBS64 += -lproc
136mutex-16200.32 :=	CSTD=$(CSTD_GNU17)
137mutex-16200.64 :=	CSTD=$(CSTD_GNU17)
138mutex_attr.32 :=	CSTD=$(CSTD_GNU17)
139mutex_attr.64 :=	CSTD=$(CSTD_GNU17)
140
141ptsname.32 :=		LDLIBS += -lsocket
142ptsname.64 :=		LDLIBS64 += -lsocket
143
144stdbit.32 :=	CSTD=$(CSTD_GNU17)
145stdbit.64 :=	CSTD=$(CSTD_GNU17)
146
147strtonum.32 :=		CSTD=$(CSTD_GNU17)
148strtonum.64 :=		CSTD=$(CSTD_GNU17)
149
150strtox.32 :=		CSTD=$(CSTD_GNU17)
151strtox.64 :=		CSTD=$(CSTD_GNU17)
152
153timespec_get.32 :=	CSTD=$(CSTD_GNU17)
154timespec_get.64 :=	CSTD=$(CSTD_GNU17)
155timespec_getres.32 :=	CSTD=$(CSTD_GNU17)
156timespec_getres.64 :=	CSTD=$(CSTD_GNU17)
157
158uchar.32 :=		CSTD=$(CSTD_GNU17)
159uchar.64 :=		CSTD=$(CSTD_GNU17)
160
161wcsftime.32 :=		CSTD=$(CSTD_GNU17)
162wcsftime.64 :=		CSTD=$(CSTD_GNU17)
163
164# This tests the XPG4 wcsftime(), so build it with XPG4-era C.
165wcsftime_old.32 :=	CSTD=$(CSTD_GNU89)
166wcsftime_old.64 :=	CSTD=$(CSTD_GNU89)
167
168wcslcat.32 :=		CSTD=$(CSTD_GNU17)
169wcslcat.64 :=		CSTD=$(CSTD_GNU17)
170wcslcpy.32 :=		CSTD=$(CSTD_GNU17)
171wcslcpy.64 :=		CSTD=$(CSTD_GNU17)
172
173ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
174ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
175	$(PROGS64:%=$(ROOTOPTDIR)/%) \
176	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
177
178include $(SRC)/cmd/Makefile.cmd
179
180all     :=      TARGET = all
181install :=      TARGET = install
182clean   :=      TARGET = clean
183clobber :=      TARGET = clobber
184lint    :=      TARGET = lint
185
186.KEEP_STATE:
187
188install: $(SUBDIRS) $(ROOTOPTPROGS)
189
190all: $(SUBDIRS) $(PROGS32) $(PROGS64)
191
192clean lint: $(SUBDIRS)
193
194$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
195
196$(ROOTOPTDIR):
197	$(INS.dir)
198
199$(ROOTOPTDIR)/%: %
200	$(INS.file)
201
202$(ROOTOPTDIR)/%: %.ksh
203	$(INS.rename)
204
205%.64: %.c
206	$(LINK64.c) -o $@ $< $(LDLIBS64)
207	$(POST_PROCESS)
208
209%.32: %.c
210	$(LINK.c) -o $@ $< $(LDLIBS)
211	$(POST_PROCESS)
212
213clobber: $(SUBDIRS)
214	$(RM) $(PROGS32) $(PROGS64)
215
216$(SUBDIRS): FRC
217	@cd $@; pwd; $(MAKE) $(TARGET)
218
219FRC:
220