Brad Bishop | a6fcd56 | 2017-02-03 11:00:27 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | yaml_top=$1 |
| 4 | toplevel_dirs=xyz |
| 5 | interfaces= |
| 6 | |
| 7 | if [ -d $yaml_top/$toplevel_dirs ]; then |
| 8 | cd $yaml_top |
| 9 | interfaces=`find $toplevel_dirs -name "*.interface.yaml"` |
| 10 | fi |
| 11 | |
| 12 | for i in ${interfaces}; |
| 13 | do |
| 14 | iface_path=`dirname $i`/`basename $i .interface.yaml` |
| 15 | iface=`echo $iface_path | sed 's/\//./g'` |
| 16 | cat <<MAKEFILE |
| 17 | ${i%.interface.yaml}/server.cpp: \$(extra_yamldir)/${i} ${i%.interface.yaml}/server.hpp |
| 18 | @mkdir -p \`dirname \$@\` |
| 19 | \$(AM_V_GEN)\$(SDBUSPLUSPLUS) -r \$(extra_yamldir) interface server-cpp ${iface} > \$@ |
| 20 | |
| 21 | ${i%.interface.yaml}/server.hpp: \$(extra_yamldir)/${i} |
| 22 | @mkdir -p \`dirname \$@\` |
| 23 | \$(AM_V_GEN)\$(SDBUSPLUSPLUS) -r \$(extra_yamldir) interface server-header ${iface} > \$@ |
| 24 | |
| 25 | MAKEFILE |
| 26 | |
| 27 | done |
| 28 | |
| 29 | echo "extra_ifaces_cpp_SOURCES = \\" |
| 30 | for i in ${interfaces}; |
| 31 | do |
| 32 | echo " ${i%.interface.yaml}/server.cpp \\" |
| 33 | done |
| 34 | echo |
| 35 | |
| 36 | echo "extra_ifaces_hpp_SOURCES = \\" |
| 37 | for i in ${interfaces}; |
| 38 | do |
| 39 | echo " ${i%.interface.yaml}/server.hpp \\" |
| 40 | done |
| 41 | echo |
| 42 | |
| 43 | echo "extra_ifaces.cpp: \$(extra_ifaces_cpp_SOURCES)" |
| 44 | if [ "$interfaces" ]; then |
| 45 | echo " \$(AM_V_GEN)cat \$^ > \$@" |
| 46 | else |
| 47 | echo " \$(AM_V_GEN)touch \$@" |
| 48 | fi |
| 49 | |
| 50 | cat << MAKEFILE |
| 51 | |
| 52 | .PHONY: clean-extra |
| 53 | clean-extra: |
| 54 | for i in \$(extra_ifaces_cpp_SOURCES) \\ |
| 55 | \$(extra_ifaces_hpp_SOURCES); \\ |
| 56 | do \\ |
| 57 | test -e \$\$i && rm \$\$i ; \\ |
| 58 | test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\ |
| 59 | true; \\ |
| 60 | done |
| 61 | MAKEFILE |