blob: 5e8f72464d981bc2afdcb5dd9c3a2f9dced91ee0 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#
# 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 2019 Joyent, Inc.
#
#
# This makefile could be simplified substantially. However, it does
# everything explicitly to try and work with a wide variety of different
# makes.
#
# The following values should be passed in by the invoker of the
# Makefile:
#
# CC C Compiler to use
# CFLAGS32 32-bit CFLAGS
# CFLAGS64 64-bit CFLAGS
# CTFCONVERT Path to ctfconvert
# CTFMERGE Path to ctfmerge
# DEBUGFLAGS The set of debug flags to use
# BUILDDIR Directory things should be built in
# CHECK32 Program to check 32-bit output
# CHECK64 Program to check 64-bit output
#
OBJS_C_32 = $(BUILDDIR)/test-global.32.c.o \
$(BUILDDIR)/test-scoped.32.c.o
OBJS_C_64 = $(BUILDDIR)/test-global.64.c.o \
$(BUILDDIR)/test-scoped.64.c.o
OBJS_M_32 = $(BUILDDIR)/test-global.32.m.o \
$(BUILDDIR)/test-scoped.32.m.o
OBJS_M_64 = $(BUILDDIR)/test-global.64.m.o \
$(BUILDDIR)/test-scoped.64.m.o
BINS = $(BUILDDIR)/test-merge-reduction-32c.so.1 \
$(BUILDDIR)/test-merge-reduction-32m.so.1 \
$(BUILDDIR)/test-merge-reduction-64c.so.1 \
$(BUILDDIR)/test-merge-reduction-64m.so.1 \
CFLAGS = -fPIC
LDFLAGS = -shared -Wl,-Mmapfile-vers -Wl,-ztext -Wl,-zdefs \
-Wl,-htest-merge-reduction.so.1 -lc
build: $(BINS)
$(BUILDDIR)/%.32.c.o: %.c
$(CC) $(CFLAGS) $(CFLAGS32) $(DEBUGFLAGS) -o $@ -c $<
$(BUILDDIR)/%.64.c.o: %.c
$(CC) $(CFLAGS) $(CFLAGS64) $(DEBUGFLAGS) -o $@ -c $<
$(BUILDDIR)/%.32.m.o: %.c
$(CC) $(CFLAGS) $(CFLAGS32) $(DEBUGFLAGS) -o $@ -c $<
$(CTFCONVERT) $@
$(BUILDDIR)/%.64.m.o: %.c
$(CC) $(CFLAGS) $(CFLAGS64) $(DEBUGFLAGS) -o $@ -c $<
$(CTFCONVERT) $@
$(BUILDDIR)/test-merge-reduction-32c.so.1: $(OBJS_C_32)
$(CC) $(CFLAGS32) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_C_32)
$(CTFCONVERT) $@
$(BUILDDIR)/test-merge-reduction-64c.so.1: $(OBJS_C_64)
$(CC) $(CFLAGS64) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_C_64)
$(CTFCONVERT) $@
$(BUILDDIR)/test-merge-reduction-32m.so.1: $(OBJS_M_32)
$(CC) $(CFLAGS32) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_M_32)
$(CTFMERGE) -t -o $@ $(OBJS_M_32)
$(BUILDDIR)/test-merge-reduction-64m.so.1: $(OBJS_M_64)
$(CC) $(CFLAGS64) $(CFLAGS) $(LDFLAGS) $(DEBUGFLAGS) -o $@ $(OBJS_M_64)
$(CTFMERGE) -t -o $@ $(OBJS_M_64)
run-test:
$(CHECK32) $(BUILDDIR)/test-merge-reduction-32c.so.1
$(CHECK64) $(BUILDDIR)/test-merge-reduction-64c.so.1
$(CHECK32) $(BUILDDIR)/test-merge-reduction-32m.so.1
$(CHECK64) $(BUILDDIR)/test-merge-reduction-64m.so.1
|