Mercurial > pub > dyncall > dyncall
annotate test/dynload_plain/Makefile.embedded @ 569:7e00c173519d
- test/dynload_plain: make build deduce native libc to use for testing from more elemental tool (using [(1) now instead of ls(1), reason is that on some x64 sunos platforms, ls is 32bit; yes, hacky fix)
author | Tassilo Philipp |
---|---|
date | Sun, 04 Sep 2022 15:28:13 +0200 |
parents | 4a3fab7712fb |
children | 3155ccc33cae |
rev | line source |
---|---|
308 | 1 # path to default libc.so file, easier to do via shell than in code (see main() in dynload_plain.c) |
2 # for compat: first gmake style, then assignment op which will use ! as part of var name on gmake<4 | |
568
4a3fab7712fb
- test/dynload_plain: fix on some sunos platforms selecting libc to test
Tassilo Philipp
parents:
567
diff
changeset
|
3 # and thus not override previously set var; in a similar vein, the :sh line works on |
4a3fab7712fb
- test/dynload_plain: fix on some sunos platforms selecting libc to test
Tassilo Philipp
parents:
567
diff
changeset
|
4 # sun make flavors and sets the var using sunOS specific deduction if not already set |
4a3fab7712fb
- test/dynload_plain: fix on some sunos platforms selecting libc to test
Tassilo Philipp
parents:
567
diff
changeset
|
5 # (:sh also works on bmake, but != already sets the var) |
569
7e00c173519d
- test/dynload_plain: make build deduce native libc to use for testing from more elemental tool (using [(1) now instead of ls(1), reason is that on some x64 sunos platforms, ls is 32bit; yes, hacky fix)
Tassilo Philipp
parents:
568
diff
changeset
|
6 DEF_C_DYLIB=$(shell ((ldd `which [` | 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) |
7e00c173519d
- test/dynload_plain: make build deduce native libc to use for testing from more elemental tool (using [(1) now instead of ls(1), reason is that on some x64 sunos platforms, ls is 32bit; yes, hacky fix)
Tassilo Philipp
parents:
568
diff
changeset
|
7 DEF_C_DYLIB!=((ldd `which [` | 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 |
568
4a3fab7712fb
- test/dynload_plain: fix on some sunos platforms selecting libc to test
Tassilo Philipp
parents:
567
diff
changeset
|
8 DEF_C_DYLIB:sh=[ -z "${DEF_C_DYLIB}" ] && ls /lib/`isainfo -b`/libc.so || echo "${DEF_C_DYLIB}" |
308 | 9 |
214 | 10 APP = dynload_plain |
11 OBJS = dynload_plain.o | |
308 | 12 TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...) |
214 | 13 |
14 TOP = ../.. | |
308 | 15 CFLAGS += -I${TOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\" |
214 | 16 LDFLAGS += -L${TOP}/dynload |
17 LDLIBS += -ldynload_s | |
18 # Works on: Darwin, NetBSD. | |
19 # Linux: add '-ldl' | |
20 | |
308 | 21 all: ${APP} ${TEST_U8_SO} |
214 | 22 |
23 .PHONY: all clean | |
24 | |
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 | 27 |
308 | 28 ${TEST_U8_SO}: |
319
993550558ac5
- test/dynload_plain build fix for Darwin cc (use flag -dynamiclib instead of -shared to build test .dylib)
Tassilo Philipp
parents:
313
diff
changeset
|
29 echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO} |
308 | 30 |
214 | 31 clean: |
308 | 32 rm -f ${APP} ${OBJS} ${TEST_U8_SO} |
214 | 33 |