xref: /illumos-gate/usr/src/test/os-tests/tests/stackalign/Makefile (revision 49950d9c675502476d8644b1e5bb1bf0d743f53b)
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 += -P -D_ASM
33CFLAGS += -D_REENTRANT
34$(INTEL_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
35$(SPARC_BLD)LDFLAGS += -Wl,-zinitarray=get_stack_at_init
36
37.KEEP_STATE:
38
39all: $(PROGS32) $(PROGS64)
40
41install: $(ROOTOPTPROGS)
42
43clean:
44	-$(RM) $(OBJS)
45
46$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTSTACK)
47
48$(ROOTOPTDIR):
49	$(INS.dir)
50
51$(ROOTOPTSTACK): $(ROOTOPTDIR)
52	$(INS.dir)
53
54$(ROOTOPTSTACK)/%: %
55	$(INS.file)
56
57%.64.o: %.c
58	$(COMPILE64.c) $< -o $@
59
60%.32.o: %.c
61	$(COMPILE.c) $< -o $@
62
63stack_$(MACH).o: stack_$(MACH).s
64	$(COMPILE.s) $< -o $@
65
66stack_$(MACH64).o: stack_$(MACH64).s
67	$(COMPILE64.s) $< -o $@
68
69%.64: %.64.o stack_$(MACH64).o
70	$(LINK64.c) -o $@ $^ $(LDLIBS64)
71	$(POST_PROCESS)
72
73%.32: %.32.o stack_$(MACH).o
74	$(LINK.c) -o $@ $^ $(LDLIBS)
75	$(POST_PROCESS)
76
77clobber: clean
78	$(RM) $(PROGS32) $(PROGS64)
79
80FRC:
81