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