blob: a260539072d1a37086d7c93f9b613792137de80e (
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# $OpenBSD: Makefile,v 1.11 2012/07/04 12:46:47 espie Exp $
REGRESS_TARGETS = test-compile-0 test-link-0 test-install-0 \
test-run-0 test-link-1 test-install-1 test-run-1 \
test-link-2 test-link-3 test-run-2 test-run-3 \
error-0 error-1 error-2 error-3 error-4 error-5 test-alternate-0 \
test-implicit-0 test-run-4 test-all-static
LIBTOOL ?= /usr/bin/libtool
DEST = ${.OBJDIR}/dest/usr/local
test-compile-0: ${OBJLA}
test-link-0: liba.la
test-link-1: p1
test-run-0: p1
./p1
test-link-2: liba0.la liba1.la
test-link-3: p2
test-run-2: p2
./p2
test-install-0: ${DEST}/lib/liba.la
test-install-1: ${DEST}/bin/p1
test-run-1: ${DEST}/bin/p1
LD_LIBRARY_PATH=${DEST}/lib ${DEST}/bin/p1
test-run-3: ${DEST}/bin/p2
LD_LIBRARY_PATH=${DEST}/lib ${DEST}/bin/p2
test-run-4: p2
${LIBTOOL} --mode=execute p2
# affects sysutils/nut
test-all-static: s1
file s1 | grep 'statically linked'
s1: c.lo liba.la
${LIBTOOL} --mode=link ${CC} ${CFLAGS} -o s1 c.lo -la -all-static
error-0: liba.la
# this should error out (not absolute directory)
if ${LIBTOOL} --mode=install cp liba.la dest; then exit 1; fi
dummy.c:
@touch dummy.c
error-1: dummy.c
${LIBTOOL} --mode=compile --tag=notatag ${CC} -c -o dummy.lo dummy.c 2>&1|fgrep -q "ignoring unknown tag"
error-2: dummy.c
if ${LIBTOOL} --mode=compile --tag=@ ${CC} -c -o dummy.lo dummy.c; then exit 1; fi
error-3: dummy.c
if ${LIBTOOL} --mode=foo ${CC} -c -o dummy.lo dummy.c; then exit 1; fi
error-4: dummy.c
if ${LIBTOOL} -mode=compile ${CC} -c -o dummy.lo dummy.c; then exit 1; fi
error-5: libbad.la
fgrep -q "library_names=''" libbad.la || exit 1
test-alternate-0: dummy.c
${LIBTOOL} compile ${CC} -c -o dummy.lo dummy.c
${LIBTOOL} comp ${CC} -c -o dummy.lo dummy.c
test-implicit-0: dummy.c
${LIBTOOL} ${CC} -c -o dummy.lo dummy.c
${DEST}/bin/p1: ${DEST}/lib/liba.la
${DEST}/bin/p2: ${DEST}/lib/liba0.la ${DEST}/lib/liba1.la
# basic framework to build/link stuff
SOPTS = --version-info 0:0:0 -rpath /usr/local/lib
LIBS = a a0 a1 bad
PROGS = p1 p2
OBJ_a = a.lo b.lo
a_OPTS = ${SOPTS}
OBJ_a0 = a.lo
a0_OPTS = ${SOPTS}
OBJ_a1 = b.lo
a1_OPTS = ${SOPTS} -la0
OBJ_bad = a.lo b.lo
bad_OPTS = --version-info 0:0:0 --rpath /usr/local/lib
OBJ_p1 = c.lo liba.la
LINK_p1 = c.lo -la
OBJ_p2 = c.lo liba0.la liba1.la
LINK_p2 = c.lo -la1
# stuff to compile/link/install everything
.SUFFIXES: .lo
.c.lo:
${LIBTOOL} --mode=compile ${CC} -c ${CFLAGS} ${.CURDIR}/$*.c
.for p in ${PROGS}
$p: ${OBJ_$p}
${LIBTOOL} --mode=link ${CC} ${CFLAGS} -o $@ ${LINK_$p}
.endfor
.for t in ${PROGS}
${DEST}/bin/$t: $t
mkdir -p ${DEST}/bin
${LIBTOOL} --mode=install cp $t ${DEST}/bin/$t
.endfor
.for t in ${LIBS}
${DEST}/lib/lib$t.la: lib$t.la
mkdir -p ${DEST}/lib
${LIBTOOL} --mode=install cp lib$t.la ${DEST}/lib/lib$t.la
.endfor
.for l in ${LIBS}
lib$l.la: ${OBJ_$l}
${LIBTOOL} --mode=link ${CC} ${CFLAGS} -o $@ ${$l_OPTS} ${OBJ_$l}
.endfor
CLEANFILES += ${PROGS} s1 *.c *.o *.lo *.la .libs/* ${DEST}/bin/* ${DEST}/lib/*
.PHONY: ${REGRESS_TARGETS} regress
.include <bsd.regress.mk>
|