xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision a7cee4e9766ebda975dd156d1f10a70f51c242f0)
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	aligned_alloc \
44	ascftime \
45	asprintf-14933 \
46	c11_threads \
47	c11_tss \
48	call_once \
49	closefrom \
50	dprintf \
51	endian \
52	env-7076 \
53	fnmatch \
54	getlocname \
55	isatty \
56	localeconv \
57	memchr \
58	memset_s \
59	mutex_attr \
60	mutex-16200 \
61	posix_memalign \
62	printf-15294 \
63	printf-9511 \
64	psignal-5097 \
65	ptsname \
66	quick_exit_order \
67	quick_exit_status \
68	set_constraint_handler_s \
69	strcoll-strxfrm-6907 \
70	stdbit \
71	strerror \
72	strtonum \
73	strtox \
74	swprintf-17781 \
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
152uchar.32 :=		CSTD=$(CSTD_GNU17)
153uchar.64 :=		CSTD=$(CSTD_GNU17)
154
155wcsftime.32 :=		CSTD=$(CSTD_GNU17)
156wcsftime.64 :=		CSTD=$(CSTD_GNU17)
157
158# This tests the XPG4 wcsftime(), so build it with XPG4-era C.
159wcsftime_old.32 :=	CSTD=$(CSTD_GNU89)
160wcsftime_old.64 :=	CSTD=$(CSTD_GNU89)
161
162wcslcat.32 :=		CSTD=$(CSTD_GNU17)
163wcslcat.64 :=		CSTD=$(CSTD_GNU17)
164wcslcpy.32 :=		CSTD=$(CSTD_GNU17)
165wcslcpy.64 :=		CSTD=$(CSTD_GNU17)
166
167ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
168ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
169	$(PROGS64:%=$(ROOTOPTDIR)/%) \
170	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
171
172include $(SRC)/cmd/Makefile.cmd
173
174all     :=      TARGET = all
175install :=      TARGET = install
176clean   :=      TARGET = clean
177clobber :=      TARGET = clobber
178lint    :=      TARGET = lint
179
180.KEEP_STATE:
181
182install: $(SUBDIRS) $(ROOTOPTPROGS)
183
184all: $(SUBDIRS) $(PROGS32) $(PROGS64)
185
186clean lint: $(SUBDIRS)
187
188$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
189
190$(ROOTOPTDIR):
191	$(INS.dir)
192
193$(ROOTOPTDIR)/%: %
194	$(INS.file)
195
196$(ROOTOPTDIR)/%: %.ksh
197	$(INS.rename)
198
199%.64: %.c
200	$(LINK64.c) -o $@ $< $(LDLIBS64)
201	$(POST_PROCESS)
202
203%.32: %.c
204	$(LINK.c) -o $@ $< $(LDLIBS)
205	$(POST_PROCESS)
206
207clobber: $(SUBDIRS)
208	$(RM) $(PROGS32) $(PROGS64)
209
210$(SUBDIRS): FRC
211	@cd $@; pwd; $(MAKE) $(TARGET)
212
213FRC:
214