1#!/bin/sh
2
3cd $1
4
5toplevel_dirs=org
6interfaces=`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 \$@\`
16	\$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-cpp ${iface} > \$@
17
18${i%.interface.yaml}/server.hpp: ${i}
19	@mkdir -p \`dirname \$@\`
20	\$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-header ${iface} > \$@
21
22MAKEFILE
23
24done
25
26errors=`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
46echo "libopenpower_dbus_cpp_SOURCES = \\"
47for i in ${interfaces};
48do
49    echo "	${i%.interface.yaml}/server.cpp \\"
50done
51for e in ${errors};
52do
53    echo "	${e%.errors.yaml}/error.cpp \\"
54done
55echo
56
57echo "libopenpower_dbus_hpp_SOURCES = \\"
58for i in ${interfaces};
59do
60    echo "	${i%.interface.yaml}/server.hpp \\"
61done
62for e in ${errors};
63do
64    echo "	${e%.errors.yaml}/error.hpp\\"
65done
66
67echo
68
69cat << MAKEFILE
70libopenpower_dbus.cpp:
71	touch \$@
72
73nobase_include_HEADERS = \$(libopenpower_dbus_hpp_SOURCES)
74
75.PHONY: clean-dbus
76clean-dbus:
77	for i in \$(libopenpower_dbus_cpp_SOURCES) \\
78	         \$(libopenpower_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
85