Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Patrick Williams | ad2310e | 2016-12-09 17:47:04 -0600 | [diff] [blame] | 3 | cd $1 |
| 4 | |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 5 | toplevel_dirs=xyz |
| 6 | interfaces=`find $toplevel_dirs -name "*.interface.yaml"` |
| 7 | |
| 8 | for i in ${interfaces}; |
| 9 | do |
| 10 | iface_path=`dirname $i`/`basename $i .interface.yaml` |
| 11 | iface=`echo $iface_path | sed 's/\//./g'` |
| 12 | cat <<MAKEFILE |
| 13 | |
| 14 | ${i%.interface.yaml}/server.cpp: ${i} ${i%.interface.yaml}/server.hpp |
| 15 | @mkdir -p \`dirname \$@\` |
Patrick Williams | e1a8f36 | 2016-12-10 07:42:08 -0600 | [diff] [blame] | 16 | \$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-cpp ${iface} > \$@ |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 17 | |
| 18 | ${i%.interface.yaml}/server.hpp: ${i} |
| 19 | @mkdir -p \`dirname \$@\` |
Patrick Williams | e1a8f36 | 2016-12-10 07:42:08 -0600 | [diff] [blame] | 20 | \$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-header ${iface} > \$@ |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 21 | |
| 22 | MAKEFILE |
| 23 | |
| 24 | done |
| 25 | |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 26 | errors=`find $toplevel_dirs -name "*.errors.yaml"` |
| 27 | |
| 28 | for e in ${errors}; |
| 29 | do |
| 30 | iface_path=`dirname $e`/`basename $e .errors.yaml` |
| 31 | iface=`echo $iface_path | sed 's/\//./g'` |
| 32 | cat <<MAKEFILE |
| 33 | |
| 34 | ${e%.errors.yaml}/error.cpp: ${e} ${e%.errors.yaml}/error.hpp |
| 35 | @mkdir -p \`dirname \$@\` |
| 36 | \$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-cpp ${iface} > \$@ |
| 37 | |
| 38 | ${e%.errors.yaml}/error.hpp: ${e} |
| 39 | @mkdir -p \`dirname \$@\` |
| 40 | \$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-header ${iface} > \$@ |
| 41 | |
| 42 | MAKEFILE |
| 43 | |
| 44 | done |
| 45 | |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 46 | echo "libphosphor_dbus_cpp_SOURCES = \\" |
| 47 | for i in ${interfaces}; |
| 48 | do |
| 49 | echo " ${i%.interface.yaml}/server.cpp \\" |
| 50 | done |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 51 | for e in ${errors}; |
| 52 | do |
| 53 | echo " ${e%.errors.yaml}/error.cpp \\" |
| 54 | done |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 55 | echo |
| 56 | |
| 57 | echo "libphosphor_dbus_hpp_SOURCES = \\" |
| 58 | for i in ${interfaces}; |
| 59 | do |
| 60 | echo " ${i%.interface.yaml}/server.hpp \\" |
| 61 | done |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 62 | for e in ${errors}; |
| 63 | do |
| 64 | echo " ${e%.errors.yaml}/error.hpp\\" |
| 65 | done |
| 66 | |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 67 | echo |
| 68 | |
| 69 | cat << MAKEFILE |
| 70 | libphosphor_dbus.cpp: \$(libphosphor_dbus_cpp_SOURCES) |
| 71 | cat \$^ > \$@ |
| 72 | |
| 73 | nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES) |
| 74 | |
| 75 | .PHONY: clean-dbus |
| 76 | clean-dbus: |
| 77 | for i in \$(libphosphor_dbus_cpp_SOURCES) \\ |
| 78 | \$(libphosphor_dbus_hpp_SOURCES); \\ |
| 79 | do \\ |
| 80 | test -e \$\$i && rm \$\$i ; \\ |
| 81 | test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\ |
| 82 | true; \\ |
| 83 | done |
| 84 | MAKEFILE |