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