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	isatty \
48	memchr \
49	memset_s \
50	posix_memalign \
51	printf-15294 \
52	printf-9511 \
53	psignal-5097 \
54	quick_exit_order \
55	quick_exit_status \
56	set_constraint_handler_s \
57	strcoll-strxfrm-6907 \
58	timespec_get \
59	wcsncasecmp \
60	wcsncasecmp-7344 \
61	wcsncasecmp-7350 \
62	uchar \
63	utimes
64
65SCRIPTS = \
66	quick_exit \
67	psignal
68
69CPPFLAGS += -D_REENTRANT
70
71PROGS32 = $(PROGS:%=%.32)
72PROGS64 = \
73	$(PROGS:%=%.64) \
74	printf-6961.64
75
76aligned_alloc.32 :=	LDLIBS += -lproc
77aligned_alloc.64 :=	LDLIBS64 += -lproc
78posix_memalign.32 :=	LDLIBS += -lproc
79posix_memalign.64 :=	LDLIBS64 += -lproc
80
81asprintf-14933.32 :=	CSTD=$(GNU_C99)
82asprintf-14933.64 :=	CSTD=$(GNU_C99)
83
84memset_s.32 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
85memset_s.64 :=	CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
86set_constraint_handler_s.32 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
87set_constraint_handler_s.64 := CPPFLAGS += -D__STDC_WANT_LIB_EXT1__=1
88
89isatty.32 :=	CSTD=$(GNU_C99)
90isatty.64 :=	CSTD=$(GNU_C99)
91
92ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
93ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) \
94	$(PROGS64:%=$(ROOTOPTDIR)/%) \
95	$(SCRIPTS:%=$(ROOTOPTDIR)/%)
96
97include $(SRC)/cmd/Makefile.cmd
98
99all     :=      TARGET = all
100install :=      TARGET = install
101clean   :=      TARGET = clean
102clobber :=      TARGET = clobber
103lint    :=      TARGET = lint
104
105.KEEP_STATE:
106
107install: $(SUBDIRS) $(ROOTOPTPROGS)
108
109all: $(SUBDIRS) $(PROGS32) $(PROGS64)
110
111clean lint: $(SUBDIRS)
112
113$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTDIR)
114
115$(ROOTOPTDIR):
116	$(INS.dir)
117
118$(ROOTOPTDIR)/%: %
119	$(INS.file)
120
121$(ROOTOPTDIR)/%: %.ksh
122	$(INS.rename)
123
124%.64: %.c
125	$(LINK64.c) -o $@ $< $(LDLIBS64)
126	$(POST_PROCESS)
127
128%.32: %.c
129	$(LINK.c) -o $@ $< $(LDLIBS)
130	$(POST_PROCESS)
131
132clobber: $(SUBDIRS)
133	$(RM) $(PROGS32) $(PROGS64)
134
135$(SUBDIRS): FRC
136	@cd $@; pwd; $(MAKE) $(TARGET)
137
138FRC:
139