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