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