6 echo "Usage: $0 [--exec] [--prefix pf] args.."
7 echo " $0 --build modname.so cppsources.."
9 echo "Replecement args:"
11 echo " --cxxflags $( echo '@CXXFLAGS@' | fmt -w60 | sed ':a;N;$!ba;s/\n/ \\\n /g' )"
12 echo " --ldflags @LDFLAGS@"
13 echo " --ldlibs @LDLIBS@"
14 echo " --bindir @BINDIR@"
15 echo " --datdir @DATDIR@"
17 echo "All other args are passed through as they are."
19 echo "Use --exec to call a command instead of generating output. Example usage:"
21 echo " yosys-config --exec --cxx --cxxflags --ldflags -o plugin.so -shared plugin.cc --ldlibs"
23 echo "The above command can be abbreviated as:"
25 echo " yosys-config --build plugin.so plugin.cc"
27 echo "Use --prefix to change the prefix for the special args from '--' to"
28 echo "something else. Example:"
30 echo " yosys-config --prefix @ bindir: @bindir"
32 echo "The args --bindir and --datdir can be directly followed by a slash and"
33 echo "additional text. Example:"
35 echo " yosys-config --datdir/simlib.v"
45 if [ "$1" == "--build" ]; then
47 set -- --exec --cxx --cxxflags --ldflags -o "$modname" -shared "$@" --ldlibs
63 tokens
=( "${tokens[@]}" @CXX@
) ;;
65 tokens
=( "${tokens[@]}" @CXXFLAGS@
) ;;
67 tokens
=( "${tokens[@]}" @LDFLAGS@
) ;;
69 tokens
=( "${tokens[@]}" @LDLIBS@
) ;;
71 tokens
=( "${tokens[@]}" '@BINDIR@' ) ;;
73 tokens
=( "${tokens[@]}" '@DATDIR@' ) ;;
75 tokens
=( "${tokens[@]}" '@BINDIR@'"${opt#${prefix}bindir}" ) ;;
77 tokens
=( "${tokens[@]}" '@DATDIR@'"${opt#${prefix}datdir}" ) ;;
79 if [ ${#tokens[@]} -eq 0 ]; then
82 tokens
=( "${tokens[@]}" "$opt" )
85 if [ ${#tokens[@]} -eq 0 ]; then
88 tokens
=( "${tokens[@]}" "$opt" )
91 if [ ${#tokens[@]} -eq 0 ]; then
94 tokens
=( "${tokens[@]}" "$opt" )
97 tokens
=( "${tokens[@]}" "$opt" )