diff --git a/2014/morgan/README.md b/2014/morgan/README.md index 0bf6e193f..27ab21e19 100644 --- a/2014/morgan/README.md +++ b/2014/morgan/README.md @@ -15,20 +15,7 @@ make ### Try: ```sh -make -cp -f prog morgan -./morgan clobber -ls - -./morgan all install -ls - -./prog love haste waste supernova -ls - -make -./prog magic -ls +./try.sh ``` @@ -36,38 +23,41 @@ ls Think of this as a Maker Faire's make. :-) -It works reasomably well. While not super ultra-featured, it does fair well with the Makefile we supplied. -Not only that, it helped uncover a bug we had in our special Makefile rules. +It works reasonably well. While not super ultra-featured, it does fair well +with the Makefile we supplied. Not only that, it helped uncover a bug we had in +our special Makefile rules. ## Author's remarks: ### Remarks -This program is a tiny `make` clone. +This program is a tiny `make(1)` clone. -It is able to parse a subset of the `make` syntax and will execute rules for +It is able to parse a subset of the `make(1)` syntax and will execute rules for goals given in arguments if they need to (based on timestamp of dependencies of rule targets). + ## Supported features * Variable assignments (only recursive ones). Variable references with recursion. * Environment variables are available. * It is possible to specify variables in command line: `name=value`. * Variables given in command line will have precedence over variables defined - in makefile, which will have precedence over environment variables. -* If no goal given in command line, the first target defined will be used. + in Makefile, which will have precedence over environment variables. +* If no target given in command line, the first target defined will be used. * Comments, escaped comments, escaped new lines. It should be able to build programs of previous years with the provided `Makefile` found in previous contest archives. Simply use this program instead of `make`. -It will recursively use itself for submake (the `MAKE=` assignment inside +It will recursively use itself for sub-make (the `MAKE=` assignment inside `Makefile` will be ignored to continue using itself). + ## Limitations / Known issues -* There is a lot of memory leak (not a single free). +* There are a lot of memory leaks (not a single free). * The opened file is not closed. * The input file shall be named `Makefile`. * No diagnostic message, but the exit status is non zero to indicates failure @@ -82,13 +72,16 @@ It will recursively use itself for submake (the `MAKE=` assignment inside * No built-in variables (except the one from environment). * No conditional directives. + ### Compilation warnings -with gcc 4.8.2 on Linux Ubuntu 14.04 64-bit : -* prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default] -* prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare] -* prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] +With gcc 4.8.2 on Linux Ubuntu 14.04 64-bit : +``` +prog.c:22:15: warning: return makes integer from pointer without a cast [enabled by default] +prog.c:23:72: warning: signed and unsigned type in conditional expression [-Wsign-compare] +prog.c:12:11: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] +``` ## Copyright and CC BY-SA 4.0 License: diff --git a/2014/morgan/try.sh b/2014/morgan/try.sh new file mode 100755 index 000000000..a464cbb3e --- /dev/null +++ b/2014/morgan/try.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2014/morgan +# + +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + + +echo "$ cp -f prog morgan" 1>&2 +cp -f prog morgan +echo "$ ls" 1>&2 +ls + +read -r -n 1 -p "Press any key to run: ./morgan all install: " +echo 1>&2 +./morgan all install +echo 1>&2 +echo "$ ls" 1>&2 +ls +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./prog love haste waste supernova: " +echo 1>&2 +./prog love haste waste supernova +echo 1>&2 +echo "$ ls" 1>&2 +ls +echo 1>&2 + +read -r -n 1 -p "Press any key to run: ./prog magic: " +echo 1>&2 +./prog magic +echo 1>&2 +echo "$ ls" 1>&2 +ls diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index cdafd46cd..daadd39c0 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3716,6 +3716,11 @@ it is a file with spoilers (and too close to README.md?). [SDL2](https://www.libsdl.org) but SDL1 so there were linking errors. +## [2014/morgan](2014/morgan/prog.c) ([README.md](2014/morgan/README.md)) + +[Cody](#cody) added the [try.sh](2014/morgan/try.sh) script. + + ## [2014/sinon](2014/sinon/prog.c) ([README.md](2014/sinon/README.md)) [Cody](#cody) fixed the code so that the game can play automatically like it