From a6aa0332cd34c206eb55bc160f5f6480a5b70cce Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:03:34 -0800 Subject: [PATCH] Improve how to redefine macros in 2006/monge Now one can do make clobber WIDTH=500 HEIGHT=500 ITERATIONS=512 alt or whatever. --- 2006/monge/Makefile | 8 +++++++- 2006/monge/README.md | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/2006/monge/Makefile b/2006/monge/Makefile index 3b6fc5d4a..f1e5045bf 100644 --- a/2006/monge/Makefile +++ b/2006/monge/Makefile @@ -143,8 +143,14 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +# variables to help redefine width, height or iterations in alt version +# +WIDTH= 400 +HEIGHT= 300 +ITERATIONS= 128 + ${PROG}.alt: ${PROG}.alt.c - ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} + ${CC} ${CFLAGS} -DW=${WIDTH} -DH=${HEIGHT} -DI=${ITERATIONS} $< -o $@ ${LDFLAGS} # data files # diff --git a/2006/monge/README.md b/2006/monge/README.md index 4fe28852b..8f2574df5 100644 --- a/2006/monge/README.md +++ b/2006/monge/README.md @@ -6,8 +6,8 @@ Make sure you have the SDL1 (not SDL2!) development environment installed. make ``` -There is alternate code that lets you redefine the width and height and number -of iterations to use. See [alternate code](#alternate-code) below. +There is alternate version that lets you redefine the width and height and number +of iterations to use. See [Alternate code](#alternate-code) below. ### Bugs and (Mis)features: @@ -67,13 +67,13 @@ of the variables `W`, `H` and `I`. The defaults are (respectively) 400, 300 and the same then do: ```sh -make clobber CDEFINE="-DW=500 -DH=500" alt +make clobber WIDTH=500 HEIGHT=500 alt ``` If you wish to keep the dimensions the same but change the iterations to 512: ```sh -make clobber CDEFINE="-DI=512" alt +make clobber ITERATIONS=512 alt ``` If you specify a value less than 1 for any of these it sets it back to the