Improve 2012/hamano/try.sh + add helper make rules

The Makefile rules added:

    hint.pdf
    hint

    hello.pdf
    hello

The hint rules generate the hint.pdf (which is the README.md file
obfuscated in a pdf) by feeding the program README.md and then it
compiles hint.pdf as C code. Running it will print the README.md file!

The hello rules generate hello.pdf which is (inside the pdf) an
obfuscated 'Hello World!' program. This is done by a simple echo piped o
the program which redirects it to hello.pdf. Then hello.pdf will be
compiled as C code which when run (as ./hello2) will print 'Hello
World!'.

The script now uses these rules to do what was once done manually. These
rules are .PHONY rules as otherwise they might not always run.

The clobber rule now removes these files.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-26 09:14:52 -08:00
1 parent c299a5c8e5
commit e7092d77f0
4 files changed
+94 -32

No files matched your search

+18 -5
View File
@@ -28,16 +28,29 @@ One of the PDF files generated is this README.md file as a PDF, obfuscated, and
the PDF file will then be compiled as C (itself!) and executed so that it shows
README.md!
Another PDF file generated is obfuscated C code. Once this is done it will
compile the PDF as if it was C and then run it like:
That procedure looks like:
```sh
./hamano < README.md > hint.pdf
cc -xc hint.pdf -o hint
./hint
```
Another PDF generated is an obfuscated `Hello World!` program (obfuscated inside
the PDF). Once this is done it will compile the PDF as if it was C (itself!). It
will look like:
```sh
echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf
cc -Wno-implicit-function-declaration -xc hello.pdf -o hello2
./hello2 | gcc -Wno-implicit-function-declaration -xc - -o ./hello3
./hello3
cc -xc hello.pdf -o hello
./hello | cc -Wno-implicit-function-declaration -xc - -o ./hello2
./hello2
```
although the `CFLAGS` will be what is in the Makefile as it uses the helper
rules `hint.pdf`, `hint`, `hello.pdf` and `hello` to do this.
## Judges' remarks: