1c9d20e65SRichard Lowe#
2c9d20e65SRichard Lowe# This file and its contents are supplied under the terms of the
3c9d20e65SRichard Lowe# Common Development and Distribution License ("CDDL"), version 1.0.
4c9d20e65SRichard Lowe# You may only use this file in accordance with the terms of version
5c9d20e65SRichard Lowe# 1.0 of the CDDL.
6c9d20e65SRichard Lowe#
7c9d20e65SRichard Lowe# A full copy of the text of the CDDL should have accompanied this
8c9d20e65SRichard Lowe# source.  A copy of the CDDL is also available via the Internet at
9c9d20e65SRichard Lowe# http://www.illumos.org/license/CDDL.
10c9d20e65SRichard Lowe#
11c9d20e65SRichard Lowe
12c9d20e65SRichard Lowe# Copyright 2021, Richard Lowe.
13c9d20e65SRichard Lowe
14*7c461073SRichard LoweOBJS= exclude.o unknown-os-exclude.o stub.o
15c9d20e65SRichard Lowe
16c9d20e65SRichard Lowe# Allow building out of the test harness easily too
17c9d20e65SRichard LoweSRCDIR=$(PWD)
18c9d20e65SRichard Lowe
19c9d20e65SRichard Lowe.KEEP_STATE:
20c9d20e65SRichard Lowe
21c9d20e65SRichard Loweall: $(OBJS)
22c9d20e65SRichard Lowe
23*7c461073SRichard Loweunknown-os-exclude.o: exclude.o
24*7c461073SRichard Lowe	cp exclude.o $@;
25*7c461073SRichard Lowe	elfedit -e 'shdr:sh_type .test 0x60000000' $@ # SHT_LOOS
26*7c461073SRichard Lowe
27c9d20e65SRichard Lowe%.o: $(SRCDIR)/%.c
28c9d20e65SRichard Lowe	gcc -m64 -c $< -o $@
29c9d20e65SRichard Lowe
30c9d20e65SRichard Lowe%.o: $(SRCDIR)/%.s
31c9d20e65SRichard Lowe	gcc -D_ASM -m64 -c $< -o $@
32c9d20e65SRichard Lowe
33c9d20e65SRichard Loweclean:
34c9d20e65SRichard Lowe	rm -rf $(OBJS)
35c9d20e65SRichard Lowe
36c9d20e65SRichard Lowetest.kmod: exclude.o stub.o
37c9d20e65SRichard Lowe	gcc -m64 -Wl,-ztype=kmod exclude.o stub.o -o test.kmod
38c9d20e65SRichard Lowe
39c9d20e65SRichard Lowetest.so: exclude.o stub.o
40c9d20e65SRichard Lowe	gcc -m64 -shared exclude.o stub.o -o test.so
41c9d20e65SRichard Lowe
42c9d20e65SRichard Lowetest.exec: exclude.o stub.o
43c9d20e65SRichard Lowe	gcc -m64 exclude.o stub.o -o test.exec
44c9d20e65SRichard Lowe
45c9d20e65SRichard Lowetest.o: exclude.o stub.o
46c9d20e65SRichard Lowe	ld -zfatal-warnings -r exclude.o stub.o -o test.o
47*7c461073SRichard Lowe
48*7c461073SRichard Lowetest.unknown-os: unknown-os-exclude.o stub.o
49*7c461073SRichard Lowe	ld -zfatal-warnings -r unknown-os-exclude.o stub.o -o test.unknown-os
50