From 359354cde8c35fdd9a475182986b7a634498ea3c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 12 Dec 2023 05:09:50 -0800 Subject: [PATCH] Simplify how to redefine macros in 2014/birken Now one can do make clobber PORT=31337 TIME=50000 alt or whatever. --- 2014/birken/Makefile | 8 ++++++++ 2014/birken/README.md | 6 +++--- thanks-for-help.md | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/2014/birken/Makefile b/2014/birken/Makefile index 35e4a8375..13e5b7768 100644 --- a/2014/birken/Makefile +++ b/2014/birken/Makefile @@ -139,6 +139,14 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +# Variables to control port and timing constant in alt code +# +PORT= 1701 +TIME= 500000 + +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} -DNCC=${PORT} -DSTARDATE=${TIME} $< -o $@ ${LDFLAGS} + # data files # data: ${DATA} diff --git a/2014/birken/README.md b/2014/birken/README.md index c168af240..92073487a 100644 --- a/2014/birken/README.md +++ b/2014/birken/README.md @@ -56,13 +56,13 @@ described by the author. See [configuration](#configuration) below. To specify the port to say, 31337, try: ```sh -make clobber CDEFINE="-DNCC=31337" alt +make clobber PORT=31337 alt ``` -To change the `STARDATE` timing constant, try: +To change the timing constant, `STARDATE`, try: ```sh -make clobber CDEFINE="-DSTARDATE=5000000" alt +make clobber TIME=5000000 alt ``` You can combine them both of course. diff --git a/thanks-for-help.md b/thanks-for-help.md index 0c4ffcacd..b0b464957 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3677,7 +3677,8 @@ code](/2014/birken/README.md#alternate-code) that lets one redefine the port to bind to in case there is a firewall issue or there is some other reason to not have the default port. Remember that ports < 1024 are privileged. It also lets you redefine the timing constant `STARDATE` (see the author's remarks for more -details). +details on this macro). The Makefile was made to use variables so it's easier to +redefine the port and timing constant. ## [2014/deak](/2014/deak/prog.c) ([README.md](/2014/deak/README.md))