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