Mercurial > pub > dyncall > dyncall
annotate test/dynload_plain/Makefile.embedded @ 319:993550558ac5
- test/dynload_plain build fix for Darwin cc (use flag -dynamiclib instead of -shared to build test .dylib)
author | Tassilo Philipp |
---|---|
date | Wed, 13 Nov 2019 16:13:07 +0100 |
parents | 73b5b9e224e2 |
children | a94b985f9a91 |
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 | |
3 # and thus not override previously set var | |
313
73b5b9e224e2
- dynload_plain test: stability fix for picking right testing lib on build
Tassilo Philipp
parents:
308
diff
changeset
|
4 DEF_C_DYLIB=$(shell ((ldd `which ls` | 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) |
73b5b9e224e2
- dynload_plain test: stability fix for picking right testing lib on build
Tassilo Philipp
parents:
308
diff
changeset
|
5 DEF_C_DYLIB!=((ldd `which ls` | 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 |
308 | 6 |
214 | 7 APP = dynload_plain |
8 OBJS = dynload_plain.o | |
308 | 9 TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...) |
214 | 10 |
11 TOP = ../.. | |
308 | 12 CFLAGS += -I${TOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\" |
214 | 13 LDFLAGS += -L${TOP}/dynload |
14 LDLIBS += -ldynload_s | |
15 # Works on: Darwin, NetBSD. | |
16 # Linux: add '-ldl' | |
17 | |
308 | 18 all: ${APP} ${TEST_U8_SO} |
214 | 19 |
20 .PHONY: all clean | |
21 | |
22 ${APP}: ${OBJS} | |
23 ${CC} ${OBJS} ${LDFLAGS} ${LDLIBS} -o $@ | |
24 | |
308 | 25 ${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
|
26 echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO} |
308 | 27 |
214 | 28 clean: |
308 | 29 rm -f ${APP} ${OBJS} ${TEST_U8_SO} |
214 | 30 |