xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile (revision 6bc074b1c1f7d3014541f4c3e3152dcf2b19eed6)
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 2023 Oxide Computer Company
19#
20
21SUBDIRS = \
22	catopen \
23	err \
24	fpround \
25	i18n \
26	newlocale \
27	nl_langinfo \
28	priv_gettext \
29	qsort \
30	random \
31	regex \
32	select \
33	stdio \
34	strerror \
35	symbols \
36	threads \
37	wcsrtombs \
38	wctype
39
40PROGS = \
41	aligned_alloc \
42	asprintf-14933 \
43	c11_threads \
44	c11_tss \
45	call_once \
46	closefrom \
47	endian \
48	env-7076 \
49	fnmatch \
50	isatty \
51	memchr \
52	memset_s \
53	posix_memalign \
54	printf-15294 \
55	printf-9511 \
56	psignal-5097 \
57	quick_exit_order \
58	quick_exit_status \
59	set_constraint_handler_s \
60	strcoll-strxfrm-6907 \
61	strtonum \
62	timespec_get \
63	wcsncasecmp \
64	wcsncasecmp-7344 \
65	wcsncasecmp-7350 \
66	uchar \
67	utimes
68
69SCRIPTS = \
70	quick_exit \
71	psignal
72
73CPPFLAGS += -D_REENTRANT
74
75PROGS32 = $(PROGS:%=%.32)
76PROGS64 = \
77	$(PROGS:%=%.64) \
78	printf-6961.64
79
80aligned_alloc.32 :=	LDLIBS += -lproc
81aligned_alloc.64 :=	LDLIBS64 += -lproc
82posix_memalign.32 :=	LDLIBS += -lproc
83posix_memalign.64 :=	LDLIBS64 += -lproc
84
85asprintf-14933.32 :=	CSTD=$(GNU_C99)
86asprintf-14933.64 :=	CSTD=$(GNU_C99)
87
88memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
89memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
90set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
91set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
92
93isatty.32 :=	CSTD=$(GNU_C99)
94isatty.64 :=	CSTD=$(GNU_C99)
95
96strtonum.32 :=		CSTD=$(GNU_C99)
97strtonum.64 :=		CSTD=$(GNU_C99)
98
99ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
100ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
101	$(PROGS64:%=$(ROOTOPTDIR)/%) \
102	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
103
104include $(SRC)/cmd/Makefile.cmd
105
106all     :=      TARGET = all
107install :=      TARGET = install
108clean   :=      TARGET = clean
109clobber :=      TARGET = clobber
110lint    :=      TARGET = lint
111
112.KEEP_STATE:
113
114install: $(SUBDIRS) $(ROOTOPTPROGS)
115
116all: $(SUBDIRS) $(PROGS32) $(PROGS64)
117
118clean lint: $(SUBDIRS)
119
120$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
121
122$(ROOTOPTDIR):
123	$(INS.dir)
124
125$(ROOTOPTDIR)/%: %
126	$(INS.file)
127
128$(ROOTOPTDIR)/%: %.ksh
129	$(INS.rename)
130
131%.64: %.c
132	$(LINK64.c) -o $@ $< $(LDLIBS64)
133	$(POST_PROCESS)
134
135%.32: %.c
136	$(LINK.c) -o $@ $< $(LDLIBS)
137	$(POST_PROCESS)
138
139clobber: $(SUBDIRS)
140	$(RM) $(PROGS32) $(PROGS64)
141
142$(SUBDIRS): FRC
143	@cd $@; pwd; $(MAKE) $(TARGET)
144
145FRC:
146