annotate test/dynload_plain/Makefile.embedded @ 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)
author Tassilo Philipp
date Sun, 04 Sep 2022 16:29:30 +0200
parents 3155ccc33cae
children 82aa83f09264
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
214
Tassilo Philipp
parents:
diff changeset
1 APP = dynload_plain
Tassilo Philipp
parents:
diff changeset
2 OBJS = dynload_plain.o
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 214
diff changeset
3 TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...)
214
Tassilo Philipp
parents:
diff changeset
4
Tassilo Philipp
parents:
diff changeset
5 TOP = ../..
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 214
diff changeset
6 CFLAGS += -I${TOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\"
214
Tassilo Philipp
parents:
diff changeset
7 LDFLAGS += -L${TOP}/dynload
Tassilo Philipp
parents:
diff changeset
8 LDLIBS += -ldynload_s
Tassilo Philipp
parents:
diff changeset
9 # Works on: Darwin, NetBSD.
Tassilo Philipp
parents:
diff changeset
10 # Linux: add '-ldl'
Tassilo Philipp
parents:
diff changeset
11
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
12 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
13 # 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
14 # (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
15 # against, then reinvoke make with actual build
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 export X=`((ldd ${TEST_C_LD} | grep -o '/.*/libc.so[^ ]*' || 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`; \
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 ${MAKE} DEF_C_DYLIB="$$X" ${APP}
214
Tassilo Philipp
parents:
diff changeset
18
Tassilo Philipp
parents:
diff changeset
19 .PHONY: all clean
Tassilo Philipp
parents:
diff changeset
20
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
21 ${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
22 # 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
23 echo 'int main() { return 0; }' | ${CC} -x c ${CFLAGS} ${LDFLAGS} -o ${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
24
214
Tassilo Philipp
parents:
diff changeset
25 ${APP}: ${OBJS}
567
a94b985f9a91 - test/dynload_plain fix for some sunos platforms
Tassilo Philipp
parents: 319
diff changeset
26 ${CC} ${CFLAGS} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@
214
Tassilo Philipp
parents:
diff changeset
27
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 214
diff changeset
28 ${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
29 echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} ${CFLAGS} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO}
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 214
diff changeset
30
214
Tassilo Philipp
parents:
diff changeset
31 clean:
308
7c6f19d42b31 dynload UTF-8 support for library paths:
Tassilo Philipp
parents: 214
diff changeset
32 rm -f ${APP} ${OBJS} ${TEST_U8_SO}
214
Tassilo Philipp
parents:
diff changeset
33