Mercurial > pub > dyncall > dyncall
annotate test/dynload_plain/Makefile.generic @ 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 | 0bb9c03ff617 |
rev | line source |
---|---|
308 | 1 APP = dynload_plain |
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 | 4 TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...) |
5 SRCTOP = ${VPATH}/../.. | |
6 BLDTOP = ../.. | |
7 CFLAGS += -I${SRCTOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\" | |
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 | 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 |
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 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
|
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 | 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 | 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 | 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 | 26 install: |
27 mkdir -p ${PREFIX}/test | |
308 | 28 cp ${APP} ${TEST_U8_SO} ${PREFIX}/test |
214 | 29 |