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