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