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