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