1538aa54dSGarrett D'Amore#
2538aa54dSGarrett D'Amore# This file and its contents are supplied under the terms of the
3538aa54dSGarrett D'Amore# Common Development and Distribution License ("CDDL"), version 1.0.
4538aa54dSGarrett D'Amore# You may only use this file in accordance with the terms of version
5538aa54dSGarrett D'Amore# 1.0 of the CDDL.
6538aa54dSGarrett D'Amore#
7538aa54dSGarrett D'Amore# A full copy of the text of the CDDL should have accompanied this
8538aa54dSGarrett D'Amore# source.  A copy of the CDDL is also available via the Internet at
9538aa54dSGarrett D'Amore# http://www.illumos.org/license/CDDL.
10538aa54dSGarrett D'Amore#
11538aa54dSGarrett D'Amore
12538aa54dSGarrett D'Amore#
13538aa54dSGarrett D'Amore# Copyright (c) 2012 by Delphix. All rights reserved.
14538aa54dSGarrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org>
15538aa54dSGarrett D'Amore#
16538aa54dSGarrett D'Amore
17538aa54dSGarrett D'Amoreinclude $(SRC)/Makefile.master
18538aa54dSGarrett D'Amoreinclude $(SRC)/cmd/Makefile.cmd
19538aa54dSGarrett D'Amoreinclude $(SRC)/test/Makefile.com
20538aa54dSGarrett D'Amore
21538aa54dSGarrett D'Amore$(OBJS_OVERRIDE)OBJS = $(PROG).o test_common.o
22538aa54dSGarrett D'AmoreOBJS32 = $(OBJS:%.o=%.$(MACH).o)
23538aa54dSGarrett D'AmorePROG32 = $(PROG).$(MACH)
24538aa54dSGarrett D'Amore
25538aa54dSGarrett D'Amore$(BUILD64) OBJS64 = $(OBJS:%.o=%.$(MACH64).o)
26538aa54dSGarrett D'Amore$(BUILD64) PROG64= $(PROG).$(MACH64)
27538aa54dSGarrett D'Amore
28538aa54dSGarrett D'Amore$(OBJS_OVERRIDE)SRCS = $(PROG).c ../common/test_common.c
29538aa54dSGarrett D'Amore
30*bd0ce624SYuri PankovCSTD = $(CSTD_GNU99)
31538aa54dSGarrett D'AmoreLINTFLAGS += -I../common -DARCH=\"ARCH\" -DLINT
32de572d98SGarrett D'AmoreCPPFLAGS += -I$(ROOT)/usr/include -I../common
33538aa54dSGarrett D'Amore
34538aa54dSGarrett D'AmoreROOTOPTPKG = $(ROOT)/opt/libc-tests
35de572d98SGarrett D'AmoreTESTDIR = $(ROOTOPTPKG)/tests/$(TESTSUBDIR)
36538aa54dSGarrett D'Amore
37538aa54dSGarrett D'AmoreCMDS = $(PROG32:%=$(TESTDIR)/%) $(PROG64:%=$(TESTDIR)/%) \
38de572d98SGarrett D'Amore	$(KSHPROG:%=$(TESTDIR)/%) $(ARCHPROG:%=$(TESTDIR)/%) \
39de572d98SGarrett D'Amore	$(EXTRAPROG:%=$(TESTDIR)/%)
40de572d98SGarrett D'Amore
41538aa54dSGarrett D'Amore$(CMDS) := FILEMODE = 0555
42538aa54dSGarrett D'Amore
43538aa54dSGarrett D'Amoreall: $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG) $(SUBDIRS)
44538aa54dSGarrett D'Amore
45538aa54dSGarrett D'Amore$(PROG32): $(OBJS32)
46538aa54dSGarrett D'Amore	$(LINK.c) $(OBJS32) -o $@ $(LDLIBS)
47538aa54dSGarrett D'Amore	$(POST_PROCESS)
48538aa54dSGarrett D'Amore
49538aa54dSGarrett D'Amore$(PROG64): $(OBJS64)
50538aa54dSGarrett D'Amore	$(LINK64.c) $(OBJS64) -o $@ $(LDLIBS64)
51538aa54dSGarrett D'Amore	$(POST_PROCESS)
52538aa54dSGarrett D'Amore
53538aa54dSGarrett D'Amore$(KSHPROG): $(KSHPROG).ksh
54538aa54dSGarrett D'Amore	$(RM) $@
55538aa54dSGarrett D'Amore	$(CP) $(KSHPROG).ksh $(@)
56538aa54dSGarrett D'Amore	$(CHMOD) +x $@
57538aa54dSGarrett D'Amore
58538aa54dSGarrett D'Amore$(ARCHPROG): ../common/run_arch_tests.ksh
59538aa54dSGarrett D'Amore	$(RM) $@
60538aa54dSGarrett D'Amore	$(CP) ../common/run_arch_tests.ksh $(@)
61538aa54dSGarrett D'Amore	$(CHMOD) +x $@
62538aa54dSGarrett D'Amore
63538aa54dSGarrett D'Amore%.$(MACH).o: %.c
64538aa54dSGarrett D'Amore	$(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
65538aa54dSGarrett D'Amore
66538aa54dSGarrett D'Amore%.$(MACH).o: ../common/%.c
67538aa54dSGarrett D'Amore	$(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) -DARCH=\"$(MACH)\" $<
68538aa54dSGarrett D'Amore
69538aa54dSGarrett D'Amore%.$(MACH64).o: %.c
70538aa54dSGarrett D'Amore	$(COMPILE64.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
71538aa54dSGarrett D'Amore
72538aa54dSGarrett D'Amore%.$(MACH64).o: ../common/%.c
73538aa54dSGarrett D'Amore	$(COMPILE64.c) -o $@ $(CFLAGS_$(MACH64)) -DARCH=\"$(MACH64)\" $<
74538aa54dSGarrett D'Amore
75538aa54dSGarrett D'Amoreinstall: $(SUBDIRS) $(CMDS)
76538aa54dSGarrett D'Amore
77538aa54dSGarrett D'Amorelint: lint_SRCS
78538aa54dSGarrett D'Amore
79538aa54dSGarrett D'Amoreclobber: clean
80538aa54dSGarrett D'Amore	-$(RM) $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG)
81538aa54dSGarrett D'Amore
82538aa54dSGarrett D'Amoreclean:
83538aa54dSGarrett D'Amore	-$(RM) $(OBJS32) $(OBJS64)
84538aa54dSGarrett D'Amore
85538aa54dSGarrett D'Amore$(CMDS): $(TESTDIR) $(PROG32) $(PROG64) $(KSHPROG) $(ARCHPROG)
86538aa54dSGarrett D'Amore
87538aa54dSGarrett D'Amore$(TESTDIR):
88538aa54dSGarrett D'Amore	$(INS.dir)
89538aa54dSGarrett D'Amore
90538aa54dSGarrett D'Amore$(TESTDIR)/%: %
91538aa54dSGarrett D'Amore	$(INS.file)
92