xref: /illumos-gate/usr/src/test/elf-tests/tests/sections/shf-exclude/Makefile.test (revision dd72704bd9e794056c558153663c739e2012d721)
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 2021, Richard Lowe.
13
14OBJS= exclude.o unknown-os-exclude.o stub.o
15
16# Allow building out of the test harness easily too
17SRCDIR=$(PWD)
18
19.KEEP_STATE:
20
21all: $(OBJS)
22
23unknown-os-exclude.o: exclude.o
24	cp exclude.o $@;
25	elfedit -e 'shdr:sh_type .test 0x60000000' $@ # SHT_LOOS
26
27%.o: $(SRCDIR)/%.c
28	gcc -m64 -c $< -o $@
29
30%.o: $(SRCDIR)/%.s
31	gcc -D_ASM -m64 -c $< -o $@
32
33clean:
34	rm -rf $(OBJS)
35
36test.kmod: exclude.o stub.o
37	gcc -m64 -Wl,-ztype=kmod exclude.o stub.o -o test.kmod
38
39test.so: exclude.o stub.o
40	gcc -m64 -shared exclude.o stub.o -o test.so
41
42test.exec: exclude.o stub.o
43	gcc -m64 exclude.o stub.o -o test.exec
44
45test.o: exclude.o stub.o
46	ld -zfatal-warnings -r exclude.o stub.o -o test.o
47
48test.unknown-os: unknown-os-exclude.o stub.o
49	ld -zfatal-warnings -r unknown-os-exclude.o stub.o -o test.unknown-os
50