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 | |
Matt Spinler | f7616bc | 2019-11-19 09:23:37 -0600 | [diff] [blame] | 5 | toplevel_dirs=$2 |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 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 | |
Lei YU | 5fd7574 | 2020-02-13 17:09:38 +0800 | [diff] [blame] | 22 | ${i%.interface.yaml}/client.hpp: ${i} |
| 23 | @mkdir -p \`dirname \$@\` |
| 24 | \$(SDBUSPLUSPLUS) -r \$(srcdir) interface client-header ${iface} > \$@ |
| 25 | |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 26 | MAKEFILE |
| 27 | |
| 28 | done |
| 29 | |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 30 | errors=`find $toplevel_dirs -name "*.errors.yaml"` |
| 31 | |
| 32 | for e in ${errors}; |
| 33 | do |
| 34 | iface_path=`dirname $e`/`basename $e .errors.yaml` |
| 35 | iface=`echo $iface_path | sed 's/\//./g'` |
| 36 | cat <<MAKEFILE |
| 37 | |
| 38 | ${e%.errors.yaml}/error.cpp: ${e} ${e%.errors.yaml}/error.hpp |
| 39 | @mkdir -p \`dirname \$@\` |
| 40 | \$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-cpp ${iface} > \$@ |
| 41 | |
| 42 | ${e%.errors.yaml}/error.hpp: ${e} |
| 43 | @mkdir -p \`dirname \$@\` |
| 44 | \$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-header ${iface} > \$@ |
| 45 | |
| 46 | MAKEFILE |
| 47 | |
| 48 | done |
| 49 | |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 50 | echo "libphosphor_dbus_cpp_SOURCES = \\" |
| 51 | for i in ${interfaces}; |
| 52 | do |
| 53 | echo " ${i%.interface.yaml}/server.cpp \\" |
| 54 | done |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 55 | for e in ${errors}; |
| 56 | do |
| 57 | echo " ${e%.errors.yaml}/error.cpp \\" |
| 58 | done |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 59 | echo |
| 60 | |
| 61 | echo "libphosphor_dbus_hpp_SOURCES = \\" |
| 62 | for i in ${interfaces}; |
| 63 | do |
| 64 | echo " ${i%.interface.yaml}/server.hpp \\" |
| 65 | done |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 66 | for e in ${errors}; |
| 67 | do |
| 68 | echo " ${e%.errors.yaml}/error.hpp\\" |
| 69 | done |
Lei YU | 5fd7574 | 2020-02-13 17:09:38 +0800 | [diff] [blame] | 70 | echo |
Brad Bishop | cbdd27b | 2017-02-09 12:34:46 -0500 | [diff] [blame] | 71 | |
Lei YU | 5fd7574 | 2020-02-13 17:09:38 +0800 | [diff] [blame] | 72 | echo "libphosphor_dbus_client_hpp_SOURCES = \\" |
| 73 | for i in ${interfaces}; |
| 74 | do |
| 75 | echo " ${i%.interface.yaml}/client.hpp \\" |
| 76 | done |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 77 | echo |
| 78 | |
| 79 | cat << MAKEFILE |
| 80 | libphosphor_dbus.cpp: \$(libphosphor_dbus_cpp_SOURCES) |
| 81 | cat \$^ > \$@ |
| 82 | |
Lei YU | 5fd7574 | 2020-02-13 17:09:38 +0800 | [diff] [blame] | 83 | libphosphor_dbus_client.hpp: \$(libphosphor_dbus_client_hpp_SOURCES) |
| 84 | cat \$^ > \$@ |
| 85 | |
| 86 | nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES) \\ |
| 87 | \$(libphosphor_dbus_client_hpp_SOURCES) |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 88 | |
| 89 | .PHONY: clean-dbus |
| 90 | clean-dbus: |
| 91 | for i in \$(libphosphor_dbus_cpp_SOURCES) \\ |
Lei YU | 5fd7574 | 2020-02-13 17:09:38 +0800 | [diff] [blame] | 92 | \$(libphosphor_dbus_hpp_SOURCES) \\ |
| 93 | \$(libphosphor_dbus_client_hpp_SOURCES); \\ |
Patrick Williams | 0be05ee | 2016-12-09 14:30:45 -0600 | [diff] [blame] | 94 | do \\ |
| 95 | test -e \$\$i && rm \$\$i ; \\ |
| 96 | test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\ |
| 97 | true; \\ |
| 98 | done |
| 99 | MAKEFILE |