forked from openbmc/phosphor-dbus-interfaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_makefile.sh
executable file
·84 lines (65 loc) · 1.83 KB
/
generate_makefile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
cd $1
toplevel_dirs=xyz
interfaces=`find $toplevel_dirs -name "*.interface.yaml"`
for i in ${interfaces};
do
iface_path=`dirname $i`/`basename $i .interface.yaml`
iface=`echo $iface_path | sed 's/\//./g'`
cat <<MAKEFILE
${i%.interface.yaml}/server.cpp: ${i} ${i%.interface.yaml}/server.hpp
@mkdir -p \`dirname \$@\`
\$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-cpp ${iface} > \$@
${i%.interface.yaml}/server.hpp: ${i}
@mkdir -p \`dirname \$@\`
\$(SDBUSPLUSPLUS) -r \$(srcdir) interface server-header ${iface} > \$@
MAKEFILE
done
errors=`find $toplevel_dirs -name "*.errors.yaml"`
for e in ${errors};
do
iface_path=`dirname $e`/`basename $e .errors.yaml`
iface=`echo $iface_path | sed 's/\//./g'`
cat <<MAKEFILE
${e%.errors.yaml}/error.cpp: ${e} ${e%.errors.yaml}/error.hpp
@mkdir -p \`dirname \$@\`
\$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-cpp ${iface} > \$@
${e%.errors.yaml}/error.hpp: ${e}
@mkdir -p \`dirname \$@\`
\$(SDBUSPLUSPLUS) -r \$(srcdir) error exception-header ${iface} > \$@
MAKEFILE
done
echo "libphosphor_dbus_cpp_SOURCES = \\"
for i in ${interfaces};
do
echo " ${i%.interface.yaml}/server.cpp \\"
done
for e in ${errors};
do
echo " ${e%.errors.yaml}/error.cpp \\"
done
echo
echo "libphosphor_dbus_hpp_SOURCES = \\"
for i in ${interfaces};
do
echo " ${i%.interface.yaml}/server.hpp \\"
done
for e in ${errors};
do
echo " ${e%.errors.yaml}/error.hpp\\"
done
echo
cat << MAKEFILE
libphosphor_dbus.cpp: \$(libphosphor_dbus_cpp_SOURCES)
cat \$^ > \$@
nobase_include_HEADERS = \$(libphosphor_dbus_hpp_SOURCES)
.PHONY: clean-dbus
clean-dbus:
for i in \$(libphosphor_dbus_cpp_SOURCES) \\
\$(libphosphor_dbus_hpp_SOURCES); \\
do \\
test -e \$\$i && rm \$\$i ; \\
test -d \`dirname \$\$i\` && rmdir -p \`dirname \$\$i\` ; \\
true; \\
done
MAKEFILE