Lib/std/c/src/Makefile: Remove misplaced semicolon from LIBS
[sunny256-utils.git] / create_cproject
blobd87bcaa9363639c8669731815106e0cf3e552f6a
1 #!/usr/bin/env bash
3 #=======================================================================
4 # create_cproject
5 # File ID: 0aa2560c-8683-11e0-bc0d-00023faf1383
7 # Create skeleton for new C project
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname=create_cproject
14 VERSION=0.5.0
16 ARGS="$(getopt -o "\
21 " -l "\
22 help,\
23 quiet,\
24 verbose,\
25 version,\
26 " -n "$progname" -- "$@")"
27 test "$?" = "0" || exit 1
28 eval set -- "$ARGS"
30 opt_help=0
31 opt_quiet=0
32 opt_verbose=0
33 while :; do
34 case "$1" in
35 -h|--help) opt_help=1; shift ;;
36 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
37 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
38 --version) echo $progname $VERSION; exit 0 ;;
39 --) shift; break ;;
40 *) echo $progname: Internal error >&2; exit 1 ;;
41 esac
42 done
43 opt_verbose=$(($opt_verbose - $opt_quiet))
45 if test "$opt_help" = "1"; then
46 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
47 cat <<END
49 Create skeleton for a new C project in the current directory where the
50 main .c file is called PROJECT_NAME.c.
52 Usage: $progname [options] PROJECT_NAME
54 Options:
56 -h, --help
57 Show this help.
58 -q, --quiet
59 Be more quiet. Can be repeated to increase silence.
60 -v, --verbose
61 Increase level of verbosity. Can be repeated.
62 --version
63 Print version information.
65 END
66 exit 0
69 name=$1
70 test -z "$name" && { echo $progname: Name not specified as arg 1 >&2; exit 1; }
72 echo -n "COPYING: " && std COPYING COPYING && echo OK || exit 1
73 for f in .gitignore README.md Makefile; do
74 echo -n "$f: " && std -t exec=$name c/$f $f || exit 1
75 done
77 mkdir src && cd src || exit 1
78 for f in .gitignore Gen-version Makefile gdbrc selftest.c; do
79 echo -n "src/$f: " && std -t exec=$name c/src/$f $f || exit 1
80 done
81 sort -u .gitignore >.gitignore.tmp && mv .gitignore.tmp .gitignore || exit 1
82 echo -n "src/$name.c: " && std -t exec=$name c/src/std.c $name.c &&
83 echo -n "src/$name.h: " && std -t exec=$name c/src/std.h $name.h || exit 1
85 mkdir t && cd t || exit 1
86 echo -n "src/t/Makefile: " && std -t exec=$name c/src/t/Makefile Makefile &&
87 echo -n "src/t/$name.t: " && std c/src/t/std.t $name.t -t progname=$name || exit 1