xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision 060623f0d0a5aedf859d9b8f34ee893cbd7f33a8)
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	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
100aligned_alloc.32 :=	CSTD=$(CSTD_GNU17)
101aligned_alloc.64 :=	CSTD=$(CSTD_GNU17)
102aligned_alloc.32 :=	LDLIBS += -lproc
103aligned_alloc.64 :=	LDLIBS64 += -lproc
104posix_memalign.32 :=	LDLIBS += -lproc
105posix_memalign.64 :=	LDLIBS64 += -lproc
106
107asprintf-14933.32 :=	CSTD=$(CSTD_GNU17)
108asprintf-14933.64 :=	CSTD=$(CSTD_GNU17)
109
110dprintf.32 :=	CSTD=$(CSTD_GNU17)
111dprintf.64 :=	CSTD=$(CSTD_GNU17)
112dprintf.32 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
113dprintf.64 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
114
115memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
116memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
117set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
118set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
119
120getlocname.32 := CSTD=$(CSTD_GNU17)
121getlocname.64 := CSTD=$(CSTD_GNU17)
122
123isatty.32 :=	CSTD=$(CSTD_GNU17)
124isatty.64 :=	CSTD=$(CSTD_GNU17)
125
126localeconv.32 :=	CSTD=$(CSTD_GNU17)
127localeconv.64 :=	CSTD=$(CSTD_GNU17)
128
129mutex-16200.32 :=	LDLIBS += -lproc
130mutex-16200.64 :=	LDLIBS64 += -lproc
131mutex-16200.32 :=	CSTD=$(CSTD_GNU17)
132mutex-16200.64 :=	CSTD=$(CSTD_GNU17)
133mutex_attr.32 :=	CSTD=$(CSTD_GNU17)
134mutex_attr.64 :=	CSTD=$(CSTD_GNU17)
135
136ptsname.32 :=		LDLIBS += -lsocket
137ptsname.64 :=		LDLIBS64 += -lsocket
138
139stdbit.32 :=	CSTD=$(CSTD_GNU17)
140stdbit.64 :=	CSTD=$(CSTD_GNU17)
141
142strtonum.32 :=		CSTD=$(CSTD_GNU17)
143strtonum.64 :=		CSTD=$(CSTD_GNU17)
144
145strtox.32 :=		CSTD=$(CSTD_GNU17)
146strtox.64 :=		CSTD=$(CSTD_GNU17)
147
148timespec_get.32 :=	CSTD=$(CSTD_GNU17)
149timespec_get.64 :=	CSTD=$(CSTD_GNU17)
150timespec_getres.32 :=	CSTD=$(CSTD_GNU17)
151timespec_getres.64 :=	CSTD=$(CSTD_GNU17)
152
153wcsftime.32 :=		CSTD=$(CSTD_GNU17)
154wcsftime.64 :=		CSTD=$(CSTD_GNU17)
155
156# This tests the XPG4 wcsftime(), so build it with XPG4-era C.
157wcsftime_old.32 :=	CSTD=$(CSTD_GNU89)
158wcsftime_old.64 :=	CSTD=$(CSTD_GNU89)
159
160wcslcat.32 :=		CSTD=$(CSTD_GNU17)
161wcslcat.64 :=		CSTD=$(CSTD_GNU17)
162wcslcpy.32 :=		CSTD=$(CSTD_GNU17)
163wcslcpy.64 :=		CSTD=$(CSTD_GNU17)
164
165ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
166ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
167	$(PROGS64:%=$(ROOTOPTDIR)/%) \
168	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
169
170include $(SRC)/cmd/Makefile.cmd
171
172all     :=      TARGET = all
173install :=      TARGET = install
174clean   :=      TARGET = clean
175clobber :=      TARGET = clobber
176lint    :=      TARGET = lint
177
178.KEEP_STATE:
179
180install: $(SUBDIRS) $(ROOTOPTPROGS)
181
182all: $(SUBDIRS) $(PROGS32) $(PROGS64)
183
184clean lint: $(SUBDIRS)
185
186$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
187
188$(ROOTOPTDIR):
189	$(INS.dir)
190
191$(ROOTOPTDIR)/%: %
192	$(INS.file)
193
194$(ROOTOPTDIR)/%: %.ksh
195	$(INS.rename)
196
197%.64: %.c
198	$(LINK64.c) -o $@ $< $(LDLIBS64)
199	$(POST_PROCESS)
200
201%.32: %.c
202	$(LINK.c) -o $@ $< $(LDLIBS)
203	$(POST_PROCESS)
204
205clobber: $(SUBDIRS)
206	$(RM) $(PROGS32) $(PROGS64)
207
208$(SUBDIRS): FRC
209	@cd $@; pwd; $(MAKE) $(TARGET)
210
211FRC:
212