Mercurial > pub > dyncall > dyncall
annotate test/dynload_plain/Makefile.generic @ 663:127b569978cc default tip
- another tweak handling clang trying to be too smart (see last commit)
author | Tassilo Philipp |
---|---|
date | Sun, 24 Mar 2024 13:52:44 +0100 |
parents | 2012dee097d3 |
children |
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 |
609
f2f0e53d8b02
- test/dynload_plain: fix to make rule for old ksh93 versions, which segfault on nested, forked subshells
Tassilo Philipp
parents:
596
diff
changeset
|
15 export X=`{ (ldd ${TEST_C_LD} | awk '/libc\.so/{for(i=1;i<=NF;++i){if($$i~"^/"){print $$i;++r}}}END{exit !r}' || 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`; \ |
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
|
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} |
663
127b569978cc
- another tweak handling clang trying to be too smart (see last commit)
Tassilo Philipp
parents:
662
diff
changeset
|
24 # clang tries to be too smart, appending .exe on some platforms (e.g. *nix based mingw cross builds), despite -o being explicity |
127b569978cc
- another tweak handling clang trying to be too smart (see last commit)
Tassilo Philipp
parents:
662
diff
changeset
|
25 [ -f "${TEST_U8_SO}.exe" ] && mv "${TEST_U8_SO}.exe" "${TEST_U8_SO}" || true |
214 | 26 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
|
27 rm -f ${APP} ${OBJS} ${TEST_C_LD} ${TEST_U8_SO} |
214 | 28 install: |
29 mkdir -p ${PREFIX}/test | |
308 | 30 cp ${APP} ${TEST_U8_SO} ${PREFIX}/test |
214 | 31 |