blob: 17236a75f48fddba5d8cd157eeab866f7c98a8dc [file] [log] [blame]
Brad Bishopa6fcd562017-02-03 11:00:27 -05001#!/bin/sh
2
3yaml_top=$1
4toplevel_dirs=xyz
5interfaces=
6
7if [ -d $yaml_top/$toplevel_dirs ]; then
8 cd $yaml_top
9 interfaces=`find $toplevel_dirs -name "*.interface.yaml"`
10fi
11
12for i in ${interfaces};
13do
14 iface_path=`dirname $i`/`basename $i .interface.yaml`
15 iface=`echo $iface_path | sed 's/\//./g'`
16 cat <<MAKEFILE
17${i%.interface.yaml}/server.cpp: \$(extra_yamldir)/${i} ${i%.interface.yaml}/server.hpp
18 @mkdir -p \`dirname \$@\`
19 \$(AM_V_GEN)\$(SDBUSPLUSPLUS) -r \$(extra_yamldir) interface server-cpp ${iface} > \$@
20
21${i%.interface.yaml}/server.hpp: \$(extra_yamldir)/${i}
22 @mkdir -p \`dirname \$@\`
23 \$(AM_V_GEN)\$(SDBUSPLUSPLUS) -r \$(extra_yamldir) interface server-header ${iface} > \$@
24
25MAKEFILE
26
27done
28
29echo "extra_ifaces_cpp_SOURCES = \\"
30for i in ${interfaces};
31do
32 echo " ${i%.interface.yaml}/server.cpp \\"
33done
34echo
35
36echo "extra_ifaces_hpp_SOURCES = \\"
37for i in ${interfaces};
38do
39 echo " ${i%.interface.yaml}/server.hpp \\"
40done
41echo
42
43echo "extra_ifaces.cpp: \$(extra_ifaces_cpp_SOURCES)"
44if [ "$interfaces" ]; then
45 echo " \$(AM_V_GEN)cat \$^ > \$@"
46else
47 echo " \$(AM_V_GEN)touch \$@"
48fi
49
50cat << MAKEFILE
51
52.PHONY: clean-extra
53clean-extra:
54 for i in \$(extra_ifaces_cpp_SOURCES) \\
55 \$(extra_ifaces_hpp_SOURCES); \\
56 do \\
57 test -e \$\$i && rm \$\$i ; \\
58 test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\
59 true; \\
60 done
61MAKEFILE