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