1#!/bin/bash
2
3#
4# Copyright 2016, Data61
5# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
6# ABN 41 687 119 230.
7#
8# This software may be distributed and modified according to the terms of
9# the BSD 2-Clause license. Note that NO WARRANTY is provided.
10# See "LICENSE_BSD2.txt" for details.
11#
12# @TAG(D61_BSD)
13#
14
15libros_xpath='libs/librefos/interface'
16libros_hpath='libs/librefos/include/refos-rpc'
17libros_spath='libs/librefos/src/refos-rpc'
18
19function cidl_libros_interface {    
20    ./cidl_compile -g --client --header $libros_xpath/${1}_interface.xml > $libros_hpath/${1}_client.h || exit 1
21    ./cidl_compile -g --client $libros_xpath/${1}_interface.xml > $libros_spath/${1}_client.c || exit 1
22    ./cidl_compile -g --server --header $libros_xpath/${1}_interface.xml > $libros_hpath/${1}_server.h || exit 1
23    ./cidl_compile -g --server $libros_xpath/${1}_interface.xml > $libros_spath/${1}_server.c || exit 1
24    ./cidl_compile -g --server --dispatcher $libros_xpath/${1}_interface.xml > $libros_spath/${1}_dispatcher.c || exit 1
25}
26
27function clean_libros_interface {
28    rm $libros_hpath/${1}_client.h
29    rm $libros_spath/${1}_client.c
30    rm $libros_hpath/${1}_server.h
31    rm $libros_spath/${1}_server.c
32    rm $libros_spath/${1}_dispatcher.c
33}
34
35if [ $1 == 'make' ]
36then
37    cidl_libros_interface $2
38elif [ $1 == 'clean' ]
39then
40    clean_libros_interface $2
41else
42    echo 'usage: refos_cidl_compile [make|clean] INTERFACE_NAME'
43    exit 1
44fi
45