Add 2014/morgan/try.sh + format/typo checks
This commit is contained in:
1 parent
c93dc6e9f6
commit
a74674e214
3 files changed
+69
-26
No files matched your search
+19
-26
@@ -15,20 +15,7 @@ make
|
|||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make
|
./try.sh
|
||||||
cp -f prog morgan
|
|
||||||
./morgan clobber
|
|
||||||
ls
|
|
||||||
|
|
||||||
./morgan all install
|
|
||||||
ls
|
|
||||||
|
|
||||||
./prog love haste waste supernova
|
|
||||||
ls
|
|
||||||
|
|
||||||
make
|
|
||||||
./prog magic
|
|
||||||
ls
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -36,38 +23,41 @@ ls
|
|||||||
|
|
||||||
Think of this as a Maker Faire's make. :-)
|
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.
|
It works reasonably well. While not super ultra-featured, it does fair well
|
||||||
Not only that, it helped uncover a bug we had in our special Makefile rules.
|
with the Makefile we supplied. Not only that, it helped uncover a bug we had in
|
||||||
|
our special Makefile rules.
|
||||||
|
|
||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
### 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
|
goals given in arguments if they need to (based on timestamp of dependencies
|
||||||
of rule targets).
|
of rule targets).
|
||||||
|
|
||||||
|
|
||||||
## Supported features
|
## Supported features
|
||||||
|
|
||||||
* Variable assignments (only recursive ones). Variable references with recursion.
|
* Variable assignments (only recursive ones). Variable references with recursion.
|
||||||
* Environment variables are available.
|
* Environment variables are available.
|
||||||
* It is possible to specify variables in command line: `name=value`.
|
* It is possible to specify variables in command line: `name=value`.
|
||||||
* Variables given in command line will have precedence over variables defined
|
* Variables given in command line will have precedence over variables defined
|
||||||
in makefile, which will have precedence over environment variables.
|
in Makefile, which will have precedence over environment variables.
|
||||||
* If no goal given in command line, the first target defined will be used.
|
* If no target given in command line, the first target defined will be used.
|
||||||
* Comments, escaped comments, escaped new lines.
|
* Comments, escaped comments, escaped new lines.
|
||||||
|
|
||||||
It should be able to build programs of previous years with the provided `Makefile`
|
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`.
|
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).
|
`Makefile` will be ignored to continue using itself).
|
||||||
|
|
||||||
|
|
||||||
## Limitations / Known issues
|
## 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 opened file is not closed.
|
||||||
* The input file shall be named `Makefile`.
|
* The input file shall be named `Makefile`.
|
||||||
* No diagnostic message, but the exit status is non zero to indicates failure
|
* 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 built-in variables (except the one from environment).
|
||||||
* No conditional directives.
|
* No conditional directives.
|
||||||
|
|
||||||
|
|
||||||
### Compilation warnings
|
### Compilation warnings
|
||||||
|
|
||||||
with gcc 4.8.2 on Linux Ubuntu 14.04 64-bit :
|
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]
|
|
||||||
|
|
||||||
|
```
|
||||||
|
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:
|
## Copyright and CC BY-SA 4.0 License:
|
||||||
|
|
||||||
|
|||||||
Executable
+45
@@ -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
|
||||||
@@ -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.
|
[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))
|
## [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
|
[Cody](#cody) fixed the code so that the game can play automatically like it
|
||||||
|
|||||||
Reference in new issue
Block a user