blob: 73840a3bf653efb8d513dc29ce3ad26fc72d7f2c [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
22MAKEFILE
23
24done
25
Brad Bishopcbdd27b2017-02-09 12:34:46 -050026errors=`find $toplevel_dirs -name "*.errors.yaml"`
27
28for e in ${errors};
29do
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
42MAKEFILE
43
44done
45
Patrick Williams0be05ee2016-12-09 14:30:45 -060046echo "libphosphor_dbus_cpp_SOURCES = \\"
47for i in ${interfaces};
48do
49 echo " ${i%.interface.yaml}/server.cpp \\"
50done
Brad Bishopcbdd27b2017-02-09 12:34:46 -050051for e in ${errors};
52do
53 echo " ${e%.errors.yaml}/error.cpp \\"
54done
Patrick Williams0be05ee2016-12-09 14:30:45 -060055echo
56
57echo "libphosphor_dbus_hpp_SOURCES = \\"
58for i in ${interfaces};
59do
60 echo " ${i%.interface.yaml}/server.hpp \\"
61done
Brad Bishopcbdd27b2017-02-09 12:34:46 -050062for e in ${errors};
63do
64 echo " ${e%.errors.yaml}/error.hpp\\"
65done
66
Patrick Williams0be05ee2016-12-09 14:30:45 -060067echo
68
69cat << MAKEFILE
70libphosphor_dbus.cpp: \$(libphosphor_dbus_cpp_SOURCES)
71 cat \$^ > \$@
72
73nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES)
74
75.PHONY: clean-dbus
76clean-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
84MAKEFILE