xref: /illumos-gate/usr/src/test/libc-tests/tests/stdio/Makefile (revision 15fa1d047e03d3f123546d72f130c5ce4b278eba)
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 2020 Robert Mustacchi
14#
15
16PROGS = \
17	fileno \
18	fmemopentest \
19	ftell_ungetc \
20	memstream \
21	memstream_reopen \
22	open_memstreamtest \
23	orientation_test \
24	test_mbrtowc
25
26PROGS32 = $(PROGS:%=%.32)
27PROGS64 = $(PROGS:%=%.64)
28
29ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
30ROOTOPTSTDIO = $(ROOTOPTDIR)/stdio
31ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTSTDIO)/%) \
32	$(PROGS64:%=$(ROOTOPTSTDIO)/%)
33
34include $(SRC)/cmd/Makefile.cmd
35
36CPPFLAGS += -D_REENTRANT -D__EXTENSIONS__
37
38#
39# libumem is used to interpose on all of these tests to modify the
40# behavior of libc's malloc for additional debugging. Each of the tests
41# enables umem debugging in their program text.
42#
43LDLIBS += -lumem
44LDLIBS64 += -lumem
45
46#
47# This test requires C99/xpg6 behavior. Therefore we build it explicitly
48# with c99 and XPG7 so it has access to the required functions.
49#
50memstream_reopen.32 := CPPFLAGS += -D_XOPEN_SOURCE=700
51memstream_reopen.64 := CPPFLAGS += -D_XOPEN_SOURCE=700
52memstream_reopen.32 := CSTD = $(CSTD_GNU99)
53memstream_reopen.64 := CSTD = $(CSTD_GNU99)
54
55# Third-party code
56orientation_test.32 := SMOFF += all_func_returns
57orientation_test.64 := SMOFF += all_func_returns
58
59.KEEP_STATE:
60
61install: $(ROOTOPTPROGS)
62
63all: $(PROGS32) $(PROGS64)
64
65clean:
66
67$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTSTDIO)
68
69$(ROOTOPTDIR):
70	$(INS.dir)
71
72$(ROOTOPTSTDIO): $(ROOTOPTDIR)
73	$(INS.dir)
74
75$(ROOTOPTSTDIO)/%: %
76	$(INS.file)
77
78%.64: %.c
79	$(LINK64.c) -o $@ $< $(LDLIBS64)
80	$(POST_PROCESS)
81
82%.32: %.c
83	$(LINK.c) -o $@ $< $(LDLIBS)
84	$(POST_PROCESS)
85
86clobber:
87	$(RM) $(PROGS32) $(PROGS64)
88
89FRC:
90