xref: /illumos-gate/usr/src/test/bhyve-tests/tests/Makefile.in_guest (revision 71815ce76261aa773c97600750fdce92334d1990)
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# Copyright 2022 Oxide Computer Company
13
14PAYLOAD_CLEANFILES =	payload_start.o	\
15		$(PAYLOADS:%=payload_%)		\
16		$(PAYLOADS:%=payload_%.o)		\
17		$(PAYLOADS:%=pobj_%.o)		\
18		$(PAYLOADS:%=pobj_%.s)
19
20$(PAYLOADS:%=payload_%.o) := AS_CPPFLAGS += -I../common
21
22payload_%: payload_start.o payload_%.o
23	$(LD) -dn -e _start -M ../common/Mapfile.payload -o $@ $^
24
25pobj_%.s: payload_%
26	@echo " .data"                                  > $@
27	@echo " .globl payload_data"                    >> $@
28	@echo "payload_data:"                           >> $@
29	$(ELFEXTRACT) $^                                >> $@
30	@echo " .size  payload_data, [.-payload_data]"  >> $@
31	@echo " .align 4"                               >> $@
32	@echo " .globl payload_size"                    >> $@
33	@echo " .size payload_size, 4"                  >> $@
34	@echo "payload_size:"                           >> $@
35	@echo " .data"                                  >> $@
36	@echo " .long  [.-payload_data]"                >> $@
37
38pobj_%.o: pobj_%.s
39	$(COMPILE.s) -o $@ $^
40	$(POST_PROCESS)
41
42%.o: ../common/%.s
43	$(COMPILE.s) -o $@ $^
44	$(POST_PROCESS)
45
46%.o: ../common/%.c
47	$(COMPILE.c) -o $@ $^
48	$(POST_PROCESS)
49