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