Mercurial > pub > dyncall > dyncall
annotate test/dynload_plain/Makefile.generic @ 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 |
---|---|
272
a94a9a83dae6
- dynload_plain test handling symbol aliases, now
Tassilo Philipp
parents:
214
diff
changeset
|
1 # path to default libc.so file, easier to do via shell than in code (see main() in dynload_plain.c) |
273 | 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}" |
272
a94a9a83dae6
- dynload_plain test handling symbol aliases, now
Tassilo Philipp
parents:
214
diff
changeset
|
9 |
308 | 10 APP = dynload_plain |
11 OBJS = dynload_plain.o | |
12 TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...) | |
13 SRCTOP = ${VPATH}/../.. | |
14 BLDTOP = ../.. | |
15 CFLAGS += -I${SRCTOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\" | |
16 LDLIBS_D += -L${BLDTOP}/dynload -ldynload_s | |
272
a94a9a83dae6
- dynload_plain test handling symbol aliases, now
Tassilo Philipp
parents:
214
diff
changeset
|
17 |
214 | 18 # Works on: Darwin, NetBSD. |
19 # Linux: add '-ldl' | |
20 .PHONY: all clean install | |
308 | 21 all: ${APP} ${TEST_U8_SO} |
214 | 22 ${APP}: ${OBJS} |
567
a94b985f9a91
- test/dynload_plain fix for some sunos platforms
Tassilo Philipp
parents:
319
diff
changeset
|
23 ${CC} ${CFLAGS} ${LDFLAGS} ${OBJS} ${LDLIBS_D} ${LDLIBS} -o ${APP} |
308 | 24 ${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
|
25 echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO} |
214 | 26 clean: |
308 | 27 rm -f ${APP} ${OBJS} ${TEST_U8_SO} |
214 | 28 install: |
29 mkdir -p ${PREFIX}/test | |
308 | 30 cp ${APP} ${TEST_U8_SO} ${PREFIX}/test |
214 | 31 |