~martijnbraam/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH among-sus v2] Print version of among-sus on client connection

Ultracoolguy
Details
Message ID
<20201115202200.29320-1-ultracoolguy@disroot.org>
DKIM signature
pass
Download raw message
Patch: +12 -0
---
Use ifneq instead.

 Makefile | 6 ++++++
 main.c   | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/Makefile b/Makefile
index ae01955..736377a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,10 @@
.POSIX:
GIT_VERSION:=$(shell git rev-parse --short HEAD 2> /dev/null || false)

ifneq ($(strip $(GIT_VERSION)),)
	CFLAGS+=-DVERSION=\"$(GIT_VERSION)\"
endif

all:
	$(CC) -o among-sus $(CFLAGS) main.c $(LDFLAGS)

diff --git a/main.c b/main.c
index 8f7ed26..33f8e35 100644
--- a/main.c
+++ b/main.c
@@ -17,6 +17,9 @@
#include <unistd.h>
#include <getopt.h>

#ifndef VERSION
#define VERSION "uknown"
#endif
#define NUM_PLAYERS 10
#define NUM_SHORT 6
#define NUM_LONG 2
@@ -1371,6 +1374,9 @@ welcome_player(int fd)
			continue;
		}

		snprintf(buf, sizeof(buf), "among-sus server: version %s\n", VERSION);
		write(fd, buf, strlen(buf));

		if(state.stage != STAGE_LOBBY) {
			snprintf(buf, sizeof(buf), "There is a game in progress, waiting for the match to finish...\n");
			write(fd, buf, strlen(buf));
--
2.29.2
Details
Message ID
<C77ESYPJRAMU.24EU8KSJK9DO2@jungfrau>
In-Reply-To
<20201115202200.29320-1-ultracoolguy@disroot.org> (view parent)
DKIM signature
pass
Download raw message
This doesn't work with BSD make:

bmake: "/home/ecs/src/among-sus/Makefile" line 4: Missing dependency operator
bmake: "/home/ecs/src/among-sus/Makefile" line 6: Need an operator
bmake: Fatal errors encountered -- cannot continue
bmake: stopped in /home/ecs/src/among-sus

I think it's cause ifneq isn't supported, can you replace that bit with
something like:

$(CC) -o among-sus $(CFLAGS) $$(git rev-parse --short HEAD &>/dev/null && printf -- "-DVERSION=%s" "$$(git rev-parse --short HEAD) main.c $$(LDFLAGS)
Reply to thread Export thread (mbox)