xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision 5cc82207c6bb1a6b9b4a68cc33698dd1e4a61e28)
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	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	timespec_get \
74	timespec_getres \
75	wcslcat \
76	wcslcpy \
77	wcsncasecmp \
78	wcsncasecmp-7344 \
79	wcsncasecmp-7350 \
80	uchar \
81	utimes
82
83SCRIPTS = \
84	aligned_alloc \
85	quick_exit \
86	psignal
87
88CPPFLAGS += -D_REENTRANT
89
90PROGS32 = $(PROGS:%=%.32)
91PROGS64 = \
92	$(PROGS:%=%.64) \
93	printf-6961.64
94
95aligned_alloc.32 :=	CSTD=$(CSTD_GNU17)
96aligned_alloc.64 :=	CSTD=$(CSTD_GNU17)
97aligned_alloc.32 :=	LDLIBS += -lproc
98aligned_alloc.64 :=	LDLIBS64 += -lproc
99posix_memalign.32 :=	LDLIBS += -lproc
100posix_memalign.64 :=	LDLIBS64 += -lproc
101
102asprintf-14933.32 :=	CSTD=$(CSTD_GNU17)
103asprintf-14933.64 :=	CSTD=$(CSTD_GNU17)
104
105dprintf.32 :=	CSTD=$(CSTD_GNU17)
106dprintf.64 :=	CSTD=$(CSTD_GNU17)
107dprintf.32 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
108dprintf.64 :=	CPPFLAGS += -D_XOPEN_SOURCE=700 -D__EXTENSIONS__
109
110memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
111memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
112set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
113set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
114
115getlocname.32 := CSTD=$(CSTD_GNU17)
116getlocname.64 := CSTD=$(CSTD_GNU17)
117
118isatty.32 :=	CSTD=$(CSTD_GNU17)
119isatty.64 :=	CSTD=$(CSTD_GNU17)
120
121mutex-16200.32 :=	LDLIBS += -lproc
122mutex-16200.64 :=	LDLIBS64 += -lproc
123mutex-16200.32 :=	CSTD=$(CSTD_GNU17)
124mutex-16200.64 :=	CSTD=$(CSTD_GNU17)
125mutex_attr.32 :=	CSTD=$(CSTD_GNU17)
126mutex_attr.64 :=	CSTD=$(CSTD_GNU17)
127
128ptsname.32 :=		LDLIBS += -lsocket
129ptsname.64 :=		LDLIBS64 += -lsocket
130
131stdbit.32 :=	CSTD=$(CSTD_GNU17)
132stdbit.64 :=	CSTD=$(CSTD_GNU17)
133
134strtonum.32 :=		CSTD=$(CSTD_GNU17)
135strtonum.64 :=		CSTD=$(CSTD_GNU17)
136
137timespec_get.32 :=	CSTD=$(CSTD_GNU17)
138timespec_get.64 :=	CSTD=$(CSTD_GNU17)
139timespec_getres.32 :=	CSTD=$(CSTD_GNU17)
140timespec_getres.64 :=	CSTD=$(CSTD_GNU17)
141
142wcslcat.32 :=		CSTD=$(CSTD_GNU17)
143wcslcat.64 :=		CSTD=$(CSTD_GNU17)
144wcslcpy.32 :=		CSTD=$(CSTD_GNU17)
145wcslcpy.64 :=		CSTD=$(CSTD_GNU17)
146
147ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
148ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
149	$(PROGS64:%=$(ROOTOPTDIR)/%) \
150	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
151
152include $(SRC)/cmd/Makefile.cmd
153
154all     :=      TARGET = all
155install :=      TARGET = install
156clean   :=      TARGET = clean
157clobber :=      TARGET = clobber
158lint    :=      TARGET = lint
159
160.KEEP_STATE:
161
162install: $(SUBDIRS) $(ROOTOPTPROGS)
163
164all: $(SUBDIRS) $(PROGS32) $(PROGS64)
165
166clean lint: $(SUBDIRS)
167
168$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
169
170$(ROOTOPTDIR):
171	$(INS.dir)
172
173$(ROOTOPTDIR)/%: %
174	$(INS.file)
175
176$(ROOTOPTDIR)/%: %.ksh
177	$(INS.rename)
178
179%.64: %.c
180	$(LINK64.c) -o $@ $< $(LDLIBS64)
181	$(POST_PROCESS)
182
183%.32: %.c
184	$(LINK.c) -o $@ $< $(LDLIBS)
185	$(POST_PROCESS)
186
187clobber: $(SUBDIRS)
188	$(RM) $(PROGS32) $(PROGS64)
189
190$(SUBDIRS): FRC
191	@cd $@; pwd; $(MAKE) $(TARGET)
192
193FRC:
194