annotate python/pydc/test/Makefile @ 33:ba47a3d709d7

- pydc: added support to get libhandle's path
author Tassilo Philipp
date Sat, 11 Apr 2020 20:00:25 +0200
parents 6cc2b7fc7ea2
children 2682a627168c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
1 #from dynload test
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
2 ## path to default libc.so file, easier to do via shell than in code (see main() in dynload_plain.c)
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
3 ## for compat: first gmake style, then assignment op which will use ! as part of var name on gmake<4
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
4 ## and thus not override previously set var
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
5 #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)
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
6 #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
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
7 #
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
8 #APP = dynload_plain
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
9 #OBJS = dynload_plain.o
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
10 #TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...)
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
11 #SRCTOP = ${VPATH}/../..
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
12 #BLDTOP = ../..
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
13 #CFLAGS += -I${SRCTOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\"
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
14 #LDLIBS_D += -L${BLDTOP}/dynload -ldynload_s
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
15 #
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
16 ## Works on: Darwin, NetBSD.
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
17 # Linux: add '-ldl'
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
18 #.PHONY: all clean install
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
19 #all: ${APP} ${TEST_U8_SO}
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
20 #${APP}: ${OBJS}
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
21 # ${CC} ${LDFLAGS} ${OBJS} ${LDLIBS_D} ${LDLIBS} -o ${APP}
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
22 #${TEST_U8_SO}:
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
23 # echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO}
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
24 #clean:
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
25 # rm -f ${APP} ${OBJS} ${TEST_U8_SO}
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
26 #install:
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
27 # mkdir -p ${PREFIX}/test
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
28 # cp ${APP} ${TEST_U8_SO} ${PREFIX}/test
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
29
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
30 .PHONY: test.so
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
31
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
32 test.so:
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
33 for i in char 'unsigned char' short 'unsigned short' int 'unsigned int' long 'unsigned long' 'long long' 'unsigned long long' float double 'const char*'; do \
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
34 echo "$$i `echo $$i | sed -E 's/(^| )([a-z])[^ ]*/\2/g'`_plus_one($$i v) { return v+1; }"; \
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
35 done | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o $@
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
36 echo Done! Now you can run types.py
6cc2b7fc7ea2 bigger pydc update:
Tassilo Philipp
parents:
diff changeset
37