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