xref: /illumos-gate/usr/src/test/libc-tests/tests/printf-intmax/Makefile (revision 81e874d2d1a5be29bb118956027e1ea70e79e530)
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 2025 Hans Rosenfeld
14#
15
16SCRIPTS = printf-intmax
17
18PROG = printf-intmax
19
20PROG32 = $(PROG:%=%.32)
21PROG64 = $(PROG:%=%.64)
22PROGC89 = $(PROG:%=%.c89)
23
24OBJS = printf-intmax.o
25
26OBJS32 = $(OBJS:%.o=%.32.o)
27OBJS64 = $(OBJS:%.o=%.64.o)
28OBJSC89 = $(OBJS:%.o=%.c89.o)
29
30ROOTOPTDIR = $(ROOT)/opt/libc-tests/tests
31ROOTOPTPROGS =	$(PROG32:%=$(ROOTOPTDIR)/%) \
32		$(PROG64:%=$(ROOTOPTDIR)/%) \
33		$(PROGC89:%=$(ROOTOPTDIR)/%)
34ROOTOPTSCRIPTS = $(SCRIPTS:%=$(ROOTOPTDIR)/%)
35
36$(ROOTOPTSCRIPTS) := FILEMODE = 0555
37
38include $(SRC)/cmd/Makefile.cmd
39include $(SRC)/test/Makefile.com
40
41# We decidedly want to build the C89 test using the C89 standard, but for the
42# other cases the only requirement is to have something newer than C89. We'll
43# use C99 for being next newer C standard.
44#
45# For the lack of CSTD_C{8,9}9 we'll use GNU variants of these C standards,
46# the difference shouldn't matter at all.
47$(PROGC89) := CSTD = $(CSTD_GNU89)
48CSTD = $(CSTD_GNU99)
49
50.KEEP_STATE:
51
52all: $(PROG32) $(PROG64) $(PROGC89)
53
54install: $(ROOTOPTPROGS) $(ROOTOPTSCRIPTS) $(ROOTOPTDIR)
55
56$(ROOTOPTDIR):
57	$(INS.dir)
58
59$(ROOTOPTDIR)/%: %
60	$(INS.file)
61
62$(ROOTOPTDIR)/%: %.ksh
63	$(INS.rename)
64
65%.c89.o: %.c
66	$(COMPILE.c) -o $@ $<
67	$(POST_PROCESS_O)
68
69%.c89: $(OBJSC89)
70	$(LINK.c) -o $@ $(OBJSC89) $(LDLIBS)
71	$(POST_PROCESS)
72
73%.32.o: %.c
74	$(COMPILE.c) -o $@ $<
75	$(POST_PROCESS_O)
76
77%.32: $(OBJS32)
78	$(LINK.c) -o $@ $(OBJS32) $(LDLIBS)
79	$(POST_PROCESS)
80
81%.64.o: %.c
82	$(COMPILE64.c) -o $@ $<
83	$(POST_PROCESS_O)
84
85%.64: $(OBJS64)
86	$(LINK64.c) -o $@ $(OBJS64) $(LDLIBS64)
87	$(POST_PROCESS)
88
89clean:
90	-$(RM) $(OBJS32) $(OBJS64) $(OBJSC89)
91
92clobber: clean
93	-$(RM) $(PROG32) $(PROG64) $(PROGC89)
94
95
96