annotate test/dynload_plain/Makefile.generic @ 595:82aa83f09264

- test/dynload_plain build fixes: * erroneously used zero based loop in awk which is one based * missed embedded makefile changes
author Tassilo Philipp
date Tue, 20 Sep 2022 10:29:23 +0200
parents 0bb9c03ff617
children 1586812f8eed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
1 APP = dynload_plain
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
2 OBJS = dynload_plain.o
570
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
3 TEST_C_LD = dynload_plain_c_ld # helper to deduce default c lib apps are linked with
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
4 TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...)
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
5 SRCTOP = ${VPATH}/../..
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
6 BLDTOP = ../..
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
7 CFLAGS += -I${SRCTOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\"
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
8 LDLIBS_D += -L${BLDTOP}/dynload -ldynload_s
272
a94a9a83dae6 - dynload_plain test handling symbol aliases, now
Tassilo Philipp
parents: 214
diff changeset
9
214
Tassilo Philipp
parents:
diff changeset
10 .PHONY: all clean install
570
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
11 all: ${TEST_C_LD} ${TEST_U8_SO}
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
12 # deduce path to default libc.so file, easier to do via shell than in code
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
13 # (see main() in dynload_plain.c); get from what ${TEST_C_LD} is linked
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
14 # against, then reinvoke make with actual build
595
82aa83f09264 - test/dynload_plain build fixes:
Tassilo Philipp
parents: 594
diff changeset
15 export X=`((ldd ${TEST_C_LD} | awk '/libc\.so/{for(i=1;i<=NF;++i){if($$i ~ "^/")print $$i}}' || ls /lib*/libc.so* || ls /usr/lib/libc.so*) | grep -v '\.a$$' | (sort -V -r || sort -t . -n -k 2)) 2>/dev/null | head -1`; \
570
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
16 ${MAKE} DEF_C_DYLIB="$$X" ${APP}
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
17 ${TEST_C_LD}:
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
18 # dummy bin built with same toolchain and flags to deduce default c lib this is linked with
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
19 echo 'int main() { return 0; }' | ${CC} -x c ${CFLAGS} ${LDFLAGS} -o ${TEST_C_LD} -
214
Tassilo Philipp
parents:
diff changeset
20 ${APP}: ${OBJS}
567
a94b985f9a91 - test/dynload_plain fix for some sunos platforms
Tassilo Philipp
parents: 319
diff changeset
21 ${CC} ${CFLAGS} ${LDFLAGS} ${OBJS} ${LDLIBS_D} ${LDLIBS} -o ${APP}
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
22 ${TEST_U8_SO}:
571
996424e8a5fc test/dynload_plain: use same CFLAGS to build UTF-8 path helper lib with as for main build (fixes building this helper lib w/ incompatible instruction set on some platforms)
Tassilo Philipp
parents: 570
diff changeset
23 echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} ${CFLAGS} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO}
214
Tassilo Philipp
parents:
diff changeset
24 clean:
570
3155ccc33cae - test/dynload_plain: simplify makefile based build by deducing default c lib to test with from a simple helper build
Tassilo Philipp
parents: 569
diff changeset
25 rm -f ${APP} ${OBJS} ${TEST_C_LD} ${TEST_U8_SO}
214
Tassilo Philipp
parents:
diff changeset
26 install:
Tassilo Philipp
parents:
diff changeset
27 mkdir -p ${PREFIX}/test
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 285
diff changeset
28 cp ${APP} ${TEST_U8_SO} ${PREFIX}/test
214
Tassilo Philipp
parents:
diff changeset
29