xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision 4f06f471d7f0863b816d15ea031e9fe062f9743f)
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	endian \
52	env-7076 \
53	fnmatch \
54	isatty \
55	memchr \
56	memset_s \
57	mutex_attr \
58	mutex-16200 \
59	posix_memalign \
60	printf-15294 \
61	printf-9511 \
62	psignal-5097 \
63	ptsname \
64	quick_exit_order \
65	quick_exit_status \
66	set_constraint_handler_s \
67	strcoll-strxfrm-6907 \
68	stdbit \
69	strerror \
70	strtonum \
71	timespec_get \
72	timespec_getres \
73	wcslcat \
74	wcslcpy \
75	wcsncasecmp \
76	wcsncasecmp-7344 \
77	wcsncasecmp-7350 \
78	uchar \
79	utimes
80
81SCRIPTS = \
82	aligned_alloc \
83	quick_exit \
84	psignal
85
86CPPFLAGS += -D_REENTRANT
87
88PROGS32 = $(PROGS:%=%.32)
89PROGS64 = \
90	$(PROGS:%=%.64) \
91	printf-6961.64
92
93aligned_alloc.32 :=	CSTD=$(CSTD_GNU17)
94aligned_alloc.64 :=	CSTD=$(CSTD_GNU17)
95aligned_alloc.32 :=	LDLIBS += -lproc
96aligned_alloc.64 :=	LDLIBS64 += -lproc
97posix_memalign.32 :=	LDLIBS += -lproc
98posix_memalign.64 :=	LDLIBS64 += -lproc
99
100asprintf-14933.32 :=	CSTD=$(CSTD_GNU17)
101asprintf-14933.64 :=	CSTD=$(CSTD_GNU17)
102
103memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
104memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
105set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
106set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
107
108isatty.32 :=	CSTD=$(CSTD_GNU17)
109isatty.64 :=	CSTD=$(CSTD_GNU17)
110
111mutex-16200.32 :=	LDLIBS += -lproc
112mutex-16200.64 :=	LDLIBS64 += -lproc
113mutex-16200.32 :=	CSTD=$(CSTD_GNU17)
114mutex-16200.64 :=	CSTD=$(CSTD_GNU17)
115mutex_attr.32 :=	CSTD=$(CSTD_GNU17)
116mutex_attr.64 :=	CSTD=$(CSTD_GNU17)
117
118ptsname.32 :=		LDLIBS += -lsocket
119ptsname.64 :=		LDLIBS64 += -lsocket
120
121stdbit.32 :=	CSTD=$(CSTD_GNU17)
122stdbit.64 :=	CSTD=$(CSTD_GNU17)
123
124strtonum.32 :=		CSTD=$(CSTD_GNU17)
125strtonum.64 :=		CSTD=$(CSTD_GNU17)
126
127timespec_get.32 :=	CSTD=$(CSTD_GNU17)
128timespec_get.64 :=	CSTD=$(CSTD_GNU17)
129timespec_getres.32 :=	CSTD=$(CSTD_GNU17)
130timespec_getres.64 :=	CSTD=$(CSTD_GNU17)
131
132wcslcat.32 :=		CSTD=$(CSTD_GNU17)
133wcslcat.64 :=		CSTD=$(CSTD_GNU17)
134wcslcpy.32 :=		CSTD=$(CSTD_GNU17)
135wcslcpy.64 :=		CSTD=$(CSTD_GNU17)
136
137ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
138ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
139	$(PROGS64:%=$(ROOTOPTDIR)/%) \
140	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
141
142include $(SRC)/cmd/Makefile.cmd
143
144all     :=      TARGET = all
145install :=      TARGET = install
146clean   :=      TARGET = clean
147clobber :=      TARGET = clobber
148lint    :=      TARGET = lint
149
150.KEEP_STATE:
151
152install: $(SUBDIRS) $(ROOTOPTPROGS)
153
154all: $(SUBDIRS) $(PROGS32) $(PROGS64)
155
156clean lint: $(SUBDIRS)
157
158$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
159
160$(ROOTOPTDIR):
161	$(INS.dir)
162
163$(ROOTOPTDIR)/%: %
164	$(INS.file)
165
166$(ROOTOPTDIR)/%: %.ksh
167	$(INS.rename)
168
169%.64: %.c
170	$(LINK64.c) -o $@ $< $(LDLIBS64)
171	$(POST_PROCESS)
172
173%.32: %.c
174	$(LINK.c) -o $@ $< $(LDLIBS)
175	$(POST_PROCESS)
176
177clobber: $(SUBDIRS)
178	$(RM) $(PROGS32) $(PROGS64)
179
180$(SUBDIRS): FRC
181	@cd $@; pwd; $(MAKE) $(TARGET)
182
183FRC:
184