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:
|
||||
|
||||
```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:
|
||||
|
||||
|
||||
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
|
||||
Reference in new issue
Block a user