blob: 036ec021dd729d14279804a5328a32c8beea6647 [file] [log] [blame]
Patrick Williams0be05ee2016-12-09 14:30:45 -06001#!/bin/sh
2
Patrick Williamsad2310e2016-12-09 17:47:04 -06003cd $1
4
Matt Spinlerf7616bc2019-11-19 09:23:37 -06005toplevel_dirs=$2
Patrick Williams0be05ee2016-12-09 14:30:45 -06006interfaces=`find $toplevel_dirs -name "*.interface.yaml"`
7
8for i in ${interfaces};
9do
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 Williamse1a8f362016-12-10 07:42:08 -060016 \$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-cpp ${iface} > \$@
Patrick Williams0be05ee2016-12-09 14:30:45 -060017
18${i%.interface.yaml}/server.hpp: ${i}
19 @mkdir -p \`dirname \$@\`
Patrick Williamse1a8f362016-12-10 07:42:08 -060020 \$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-header ${iface} > \$@
Patrick Williams0be05ee2016-12-09 14:30:45 -060021
Lei YU5fd75742020-02-13 17:09:38 +080022${i%.interface.yaml}/client.hpp: ${i}
23 @mkdir -p \`dirname \$@\`
24 \$(SDBUSPLUSPLUS) -r \$(srcdir) interface client-header ${iface} > \$@
25
Patrick Williams0be05ee2016-12-09 14:30:45 -060026MAKEFILE
27
28done
29
Brad Bishopcbdd27b2017-02-09 12:34:46 -050030errors=`find $toplevel_dirs -name "*.errors.yaml"`
31
32for e in ${errors};
33do
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
46MAKEFILE
47
48done
49
Patrick Williams0be05ee2016-12-09 14:30:45 -060050echo "libphosphor_dbus_cpp_SOURCES = \\"
51for i in ${interfaces};
52do
53 echo " ${i%.interface.yaml}/server.cpp \\"
54done
Brad Bishopcbdd27b2017-02-09 12:34:46 -050055for e in ${errors};
56do
57 echo " ${e%.errors.yaml}/error.cpp \\"
58done
Patrick Williams0be05ee2016-12-09 14:30:45 -060059echo
60
61echo "libphosphor_dbus_hpp_SOURCES = \\"
62for i in ${interfaces};
63do
64 echo " ${i%.interface.yaml}/server.hpp \\"
65done
Brad Bishopcbdd27b2017-02-09 12:34:46 -050066for e in ${errors};
67do
68 echo " ${e%.errors.yaml}/error.hpp\\"
69done
Lei YU5fd75742020-02-13 17:09:38 +080070echo
Brad Bishopcbdd27b2017-02-09 12:34:46 -050071
Lei YU5fd75742020-02-13 17:09:38 +080072echo "libphosphor_dbus_client_hpp_SOURCES = \\"
73for i in ${interfaces};
74do
75 echo " ${i%.interface.yaml}/client.hpp \\"
76done
Patrick Williams0be05ee2016-12-09 14:30:45 -060077echo
78
79cat << MAKEFILE
80libphosphor_dbus.cpp: \$(libphosphor_dbus_cpp_SOURCES)
81 cat \$^ > \$@
82
Lei YU5fd75742020-02-13 17:09:38 +080083libphosphor_dbus_client.hpp: \$(libphosphor_dbus_client_hpp_SOURCES)
84 cat \$^ > \$@
85
86nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES) \\
87 \$(libphosphor_dbus_client_hpp_SOURCES)
Patrick Williams0be05ee2016-12-09 14:30:45 -060088
89.PHONY: clean-dbus
90clean-dbus:
91 for i in \$(libphosphor_dbus_cpp_SOURCES) \\
Lei YU5fd75742020-02-13 17:09:38 +080092 \$(libphosphor_dbus_hpp_SOURCES) \\
93 \$(libphosphor_dbus_client_hpp_SOURCES); \\
Patrick Williams0be05ee2016-12-09 14:30:45 -060094 do \\
95 test -e \$\$i && rm \$\$i ; \\
96 test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\
97 true; \\
98 done
99MAKEFILE