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