xref: /illumos-gate/usr/src/test/libc-tests/tests/Makefile.com (revision a7cee4e9766ebda975dd156d1f10a70f51c242f0)
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 2014 Garrett D'Amore <garrett@damore.org>
15# Copyright 2026 Bill Sommerfeld <sommerfeld@hamachi.org>
16#
17
18include $(SRC)/Makefile.master
19include $(SRC)/cmd/Makefile.cmd
20include $(SRC)/test/Makefile.com
21
22$(OBJS_OVERRIDE)OBJS = $(PROG).o test_common.o
23OBJS32 = $(OBJS:%.o=%.$(MACH).o)
24PROG32 = $(PROG).32
25
26$(BUILD64) OBJS64 = $(OBJS:%.o=%.$(MACH64).o)
27$(BUILD64) PROG64= $(PROG).64
28
29$(OBJS_OVERRIDE)SRCS = $(PROG).c ../common/test_common.c
30
31CSTD = $(CSTD_GNU99)
32LINTFLAGS += -I../common -DARCH=\"ARCH\" -DLINT
33CPPFLAGS += -I$(ROOT)/usr/include -I../common
34
35ROOTOPTPKG = $(ROOT)/opt/libc-tests
36TESTDIR = $(ROOTOPTPKG)/tests/$(TESTSUBDIR)
37
38CMDS = $(PROG32:%=$(TESTDIR)/%) $(PROG64:%=$(TESTDIR)/%) \
39	$(KSHPROG:%=$(TESTDIR)/%) $(EXTRAPROG:%=$(TESTDIR)/%)
40
41$(CMDS) := FILEMODE = 0555
42
43all: $(PROG32) $(PROG64) $(KSHPROG) $(SUBDIRS)
44
45$(PROG32): $(OBJS32)
46	$(LINK.c) $(OBJS32) -o $@ $(LDLIBS)
47	$(POST_PROCESS)
48
49$(PROG64): $(OBJS64)
50	$(LINK64.c) $(OBJS64) -o $@ $(LDLIBS64)
51	$(POST_PROCESS)
52
53$(KSHPROG): $(KSHPROG).ksh
54	$(RM) $@
55	$(CP) $(KSHPROG).ksh $(@)
56	$(CHMOD) +x $@
57
58%.$(MACH).o: %.c
59	$(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
60
61%.$(MACH).o: ../common/%.c
62	$(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
63
64%.$(MACH64).o: %.c
65	$(COMPILE64.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
66
67%.$(MACH64).o: ../common/%.c
68	$(COMPILE64.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
69
70install: $(SUBDIRS) $(CMDS)
71
72lint: lint_SRCS
73
74clobber: clean
75	-$(RM) $(PROG32) $(PROG64) $(KSHPROG)
76
77clean:
78	-$(RM) $(OBJS32) $(OBJS64)
79
80$(CMDS): $(TESTDIR) $(PROG32) $(PROG64) $(KSHPROG)
81
82$(TESTDIR):
83	$(INS.dir)
84
85$(TESTDIR)/%: %
86	$(INS.file)
87