Mercurial > pub > dyncall > bindings
comparison python/pydc/test/Makefile @ 34:2682a627168c
- breaking changes:
* restrict 'Z' conversions to immutable types
* restrict 'p' to mutable types (and handles)
| author | Tassilo Philipp |
|---|---|
| date | Sun, 12 Apr 2020 19:37:37 +0200 |
| parents | 6cc2b7fc7ea2 |
| children | 8e905c0798c7 |
comparison
equal
deleted
inserted
replaced
| 33:ba47a3d709d7 | 34:2682a627168c |
|---|---|
| 1 #from dynload test | |
| 2 ## path to default libc.so file, easier to do via shell than in code (see main() in dynload_plain.c) | |
| 3 ## for compat: first gmake style, then assignment op which will use ! as part of var name on gmake<4 | |
| 4 ## and thus not override previously set var | |
| 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) | |
| 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 | |
| 7 # | |
| 8 #APP = dynload_plain | |
| 9 #OBJS = dynload_plain.o | |
| 10 #TEST_U8_SO = dynload_plain_ß_test # @@@ unsure if every platform handles ß, here (ANSI, UTF-8, ...) | |
| 11 #SRCTOP = ${VPATH}/../.. | |
| 12 #BLDTOP = ../.. | |
| 13 #CFLAGS += -I${SRCTOP}/dynload -DDEF_C_DYLIB=\"${DEF_C_DYLIB}\" | |
| 14 #LDLIBS_D += -L${BLDTOP}/dynload -ldynload_s | |
| 15 # | |
| 16 ## Works on: Darwin, NetBSD. | |
| 17 # Linux: add '-ldl' | |
| 18 #.PHONY: all clean install | |
| 19 #all: ${APP} ${TEST_U8_SO} | |
| 20 #${APP}: ${OBJS} | |
| 21 # ${CC} ${LDFLAGS} ${OBJS} ${LDLIBS_D} ${LDLIBS} -o ${APP} | |
| 22 #${TEST_U8_SO}: | |
| 23 # echo 'int dynload_plain_testfunc() { return 5; }' | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o ${TEST_U8_SO} | |
| 24 #clean: | |
| 25 # rm -f ${APP} ${OBJS} ${TEST_U8_SO} | |
| 26 #install: | |
| 27 # mkdir -p ${PREFIX}/test | |
| 28 # cp ${APP} ${TEST_U8_SO} ${PREFIX}/test | |
| 29 | |
| 30 .PHONY: test.so | 1 .PHONY: test.so |
| 31 | 2 |
| 32 test.so: | 3 test.so: |
| 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 \ | 4 (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 \ |
| 34 echo "$$i `echo $$i | sed -E 's/(^| )([a-z])[^ ]*/\2/g'`_plus_one($$i v) { return v+1; }"; \ | 5 echo "$$i `echo $$i | sed -E 's/\*/ p/;s/(^| )([a-z])[^ ]*/\2/g'`_plus_one($$i v) { return v+1; }"; \ |
| 35 done | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o $@ | 6 done; \ |
| 36 echo Done! Now you can run types.py | 7 echo 'void cp_head_incr(char* v) { v[0]+=1; }') | ${CC} -`[ \`uname\` = Darwin ] && echo dynamiclib || echo shared` -x c - -o $@ |
| 8 @echo Done! Now you can run types.py | |
| 37 | 9 |
