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