3 #=======================================================================
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
26 " -n "$progname" -- "$@
")"
27 test "$?" = "0" ||
exit 1
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 ;;
40 *) echo $progname: Internal error
>&2; exit 1 ;;
43 opt_verbose
=$
(($opt_verbose - $opt_quiet))
45 if test "$opt_help" = "1"; then
46 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
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
59 Be more quiet. Can be repeated to increase silence.
61 Increase level of verbosity. Can be repeated.
63 Print version information.
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
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
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