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