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