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