summaryrefslogtreecommitdiff
path: root/usr/src/test/elf-tests/tests/sections/shf-exclude/Makefile.test
blob: ed8f00fefba9bfb88f8ccf9bd1bbb37d881d138e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

# Copyright 2021, Richard Lowe.

OBJS= exclude.o unknown-os-exclude.o stub.o

# Allow building out of the test harness easily too
SRCDIR=$(PWD)

.KEEP_STATE:

all: $(OBJS)

unknown-os-exclude.o: exclude.o
	cp exclude.o $@;
	elfedit -e 'shdr:sh_type .test 0x60000000' $@ # SHT_LOOS

%.o: $(SRCDIR)/%.c
	gcc -m64 -c $< -o $@

%.o: $(SRCDIR)/%.s
	gcc -D_ASM -m64 -c $< -o $@

clean:
	rm -rf $(OBJS)

test.kmod: exclude.o stub.o
	gcc -m64 -Wl,-ztype=kmod exclude.o stub.o -o test.kmod

test.so: exclude.o stub.o
	gcc -m64 -shared exclude.o stub.o -o test.so

test.exec: exclude.o stub.o
	gcc -m64 exclude.o stub.o -o test.exec

test.o: exclude.o stub.o
	ld -zfatal-warnings -r exclude.o stub.o -o test.o

test.unknown-os: unknown-os-exclude.o stub.o
	ld -zfatal-warnings -r unknown-os-exclude.o stub.o -o test.unknown-os