xref: /illumos-gate/usr/src/test/os-tests/tests/stackalign/Makefile (revision 8226594fdd4479be135127f43632f1f995074654)
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 Oxide Computer Company
14# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
15#
16
17PROGS = stackalign
18
19PROGS32 = $(PROGS:%=%.32)
20PROGS64 = $(PROGS:%=%.64)
21
22OBJS = $(PROGS32:%=%.o) $(PROGS64:%=%.o)
23$(INTEL_BLD)OBJS += stack_i386.o stack_amd64.o
24$(SPARC_BLD)OBJS += stack_sparc.o stack_sparcv9.o
25
26ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
27ROOTOPTSTACK = $(ROOTOPTDIR)/stackalign
28ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTSTACK)/%) $(PROGS64:%=$(ROOTOPTSTACK)/%)
29
30include $(SRC)/cmd/Makefile.cmd
31
32ASFLAGS += -D_ASM
33ASFLAGS64 += -D_ASM
34CFLAGS += -D_REENTRANT
35$(INTEL_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
36$(SPARC_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
37
38.KEEP_STATE:
39
40all: $(PROGS32) $(PROGS64)
41
42install: $(ROOTOPTPROGS)
43
44clean:
45	-$(RM) $(OBJS)
46
47$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTSTACK)
48
49$(ROOTOPTDIR):
50	$(INS.dir)
51
52$(ROOTOPTSTACK): $(ROOTOPTDIR)
53	$(INS.dir)
54
55$(ROOTOPTSTACK)/%: %
56	$(INS.file)
57
58%.64.o: %.c
59	$(COMPILE64.c) $< -o $@
60
61%.32.o: %.c
62	$(COMPILE.c) $< -o $@
63
64stack_$(MACH).o: stack_$(MACH).S
65	$(COMPILE.s) $< -o $@
66
67stack_$(MACH64).o: stack_$(MACH64).S
68	$(COMPILE64.s) $< -o $@
69
70%.64: %.64.o stack_$(MACH64).o
71	$(LINK64.c) -o $@ $^ $(LDLIBS64)
72	$(POST_PROCESS)
73
74%.32: %.32.o stack_$(MACH).o
75	$(LINK.c) -o $@ $^ $(LDLIBS)
76	$(POST_PROCESS)
77
78clobber: clean
79	$(RM) $(PROGS32) $(PROGS64)
80
81FRC:
82