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