From 1badbd59423861ee1feb3150aea4bb18bb1dd29b Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Tue, 10 Sep 2024 21:48:14 -0400 Subject: [PATCH] Improved the makefile dramatically and updated the README to use it. --- Makefile | 8 +++++++- README.md | 44 +++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 069c269..1040bdd 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,17 @@ all: build test +reset: + powershell -executionpolicy bypass .\scripts\reset_build.ps1 + patch: powershell "cp ./patches/process.h ./subprojects/libgit2-1.8.1/src/util/process.h" -build: +build: patch meson compile -j 4 -C builddir +config: + powershell "cp tarpit_sample.json .tarpit.json" + test: meson test -C builddir --suite turings_tarpit diff --git a/README.md b/README.md index c2c00f4..9443d95 100644 --- a/README.md +++ b/README.md @@ -79,29 +79,22 @@ git clone https://git.learnjsthehardway.com/learn-code-the-hard-way/turings-tarp Then change into the directory and run my setup script: ```shell -powershell -executionpolicy bypass .\scripts\reset_build.ps1 +make reset ``` That should setup your meson build with everything you need, so now you run it: ```shell -meson compile -C builddir +make ``` -One thing I ran into is that there's an error in `libgit2`'s code. If you get a build error in -`utils\process.h` then run this command to fix it: - -```shell -cp .\patches\process.h .\subprojects\libgit2-1.8.1\src\util\process.h -``` +This will build it assuming you used my setup scripts and have `make`. If you don't then look in the `Makefile` for the commands to run. The next dumb as hell thing is even though I've told `meson` to build a static binary it refuses. You have to copy a couple .dll files to your local directory for the easiest way to play with it: ```shell -cp .\builddir\subprojects\libgit2-1.8.1\*.dll . -cp .\builddir\subprojects\efsw\*.dll . -ls *.dll +make install ``` You should then see the `libefsw.dll` and `liblibgit2package.dll` files in the local directory which @@ -112,33 +105,34 @@ will let you run the `escape_turings_tarpit.exe` game locally. > active, so when you build `builddir/escape_turings_tarpit.exe` it'll fail if you're also running > it. Copy it all up and then you can run builds in the game while you work on the game. - Then hang out for a while and it should build. You can then do your first run. First, run the tests: ```shell -.\builddir\runtests +make test ``` -If those run then try to run the game on its own code: +## Configuration + +There's a file `tarpit_sample.json` that configures everything for the game. You can set your own +sounds, the build directory, and the build command to use. Just open it and you'll see. If you +don't want to hear me laughing at you then set the sounds to `nothing.mp3` and it'll be silent. + +I have an example file `tarpit_example.json` which you can copy to `.tarpit.json` to get started: ```shell -cp .\builddir\escape_turings_tarpit.exe . ; .\escape_turings_tarpit.exe .\ "meson compile -C builddir" +make config ``` -Now it's playing, so all you have to do is open one of the .cpp files, make a mistake, save it, and watch the game play. - -## Configuration +You can edit the `.tarpit.json` file to change the build command and sounds used during building, +just in case my silky smooth radio quality voice is not to your liking. -There's a file `.tarpit.json` that configures everything for the game. You can set your own sounds, -the build directory, and the build command to use. Just open it and you'll see. If you don't want -to hear me laughing at you then set the sounds to `nothing.mp3` and it'll be silent. +## Running -I have an example file `tarpit_example.json` which you can copy to `.tarpit.json` to get started: +If those run then try to run the game on its own code: ```shell -cp tarpit_example.json .tarpit.json +make run ``` -You can edit this file to change the build command and sounds used during building, just in case my -silky smooth radio quality voice is not to your liking. +Now it's playing, so all you have to do is open one of the .cpp files, make a mistake, save it, and watch the game play.