xref: /illumos-gate/usr/src/test/util-tests/tests/ctf/test-merge-reduction/Makefile.ctftest (revision f52943a93040563107b95bccb9db87d9971ef47d)
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 2019 Joyent, Inc.
14#
15
16#
17# This makefile could be simplified substantially. However, it does
18# everything explicitly to try and work with a wide variety of different
19# makes.
20#
21# The following values should be passed in by the invoker of the
22# Makefile:
23#
24#	CC		C Compiler to use
25#	CFLAGS32	32-bit CFLAGS
26#	CFLAGS64	64-bit CFLAGS
27#	CTFCONVERT	Path to ctfconvert
28#	CTFMERGE	Path to ctfmerge
29#	DEBUGFLAGS	The set of debug flags to use
30#	BUILDDIR	Directory things should be built in
31#	CHECK32		Program to check 32-bit output
32#	CHECK64		Program to check 64-bit output
33#
34
35OBJS_C_32 =	$(BUILDDIR)/test-global.32.c.o \
36		$(BUILDDIR)/test-scoped.32.c.o
37
38OBJS_C_64 =	$(BUILDDIR)/test-global.64.c.o \
39		$(BUILDDIR)/test-scoped.64.c.o
40
41OBJS_M_32 =	$(BUILDDIR)/test-global.32.m.o \
42		$(BUILDDIR)/test-scoped.32.m.o
43
44OBJS_M_64 =	$(BUILDDIR)/test-global.64.m.o \
45		$(BUILDDIR)/test-scoped.64.m.o
46
47BINS =		$(BUILDDIR)/test-merge-reduction-32c.so.1 \
48		$(BUILDDIR)/test-merge-reduction-32m.so.1 \
49		$(BUILDDIR)/test-merge-reduction-64c.so.1 \
50		$(BUILDDIR)/test-merge-reduction-64m.so.1 \
51
52CFLAGS = -fPIC
53LDFLAGS = -shared -Wl,-Mmapfile-vers -Wl,-ztext -Wl,-zdefs \
54	  -htest-merge-reduction.so.1
55
56build: $(BINS)
57
58$(BUILDDIR)/%.32.c.o: %.c
59	$(CC) $(CFLAGS) $(CFLAGS32) $(DEBUGFLAGS) -o $@ -c $<
60
61$(BUILDDIR)/%.64.c.o: %.c
62	$(CC) $(CFLAGS) $(CFLAGS64) $(DEBUGFLAGS) -o $@ -c $<
63
64$(BUILDDIR)/%.32.m.o: %.c
65	$(CC) $(CFLAGS) $(CFLAGS32) $(DEBUGFLAGS) -o $@ -c $<
66	$(CTFCONVERT) $@
67
68$(BUILDDIR)/%.64.m.o: %.c
69	$(CC) $(CFLAGS) $(CFLAGS64) $(DEBUGFLAGS) -o $@ -c $<
70	$(CTFCONVERT) $@
71
72$(BUILDDIR)/test-merge-reduction-32c.so.1: $(OBJS_C_32)
73	$(CC) $(CFLAGS32) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_C_32)
74	$(CTFCONVERT) $@
75
76$(BUILDDIR)/test-merge-reduction-64c.so.1: $(OBJS_C_64)
77	$(CC) $(CFLAGS64) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_C_64)
78	$(CTFCONVERT) $@
79
80$(BUILDDIR)/test-merge-reduction-32m.so.1: $(OBJS_M_32)
81	$(CC) $(CFLAGS32) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_M_32)
82	$(CTFMERGE) -t -o $@ $(OBJS_M_32)
83
84$(BUILDDIR)/test-merge-reduction-64m.so.1: $(OBJS_M_64)
85	$(CC) $(CFLAGS64) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_M_64)
86	$(CTFMERGE) -t -o $@ $(OBJS_M_64)
87
88run-test:
89	$(CHECK32) $(BUILDDIR)/test-merge-reduction-32c.so.1
90	$(CHECK64) $(BUILDDIR)/test-merge-reduction-64c.so.1
91	$(CHECK32) $(BUILDDIR)/test-merge-reduction-32m.so.1
92	$(CHECK64) $(BUILDDIR)/test-merge-reduction-64m.so.1
93