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