$NetBSD: patch-Makefile,v 1.3 2024/06/06 17:33:14 ktnb Exp $

- add DragonFly support
- add Solaris support
- honor pkgsrc LDFLAGS
- don't invoke git to obtain version info

--- Makefile.orig	2022-09-06 10:23:53.000000000 +0000
+++ Makefile
@@ -28,8 +28,7 @@ TARGET_UNIX      ?= $(if $(filter UNIX,$
 # ============================================================================
 
 TYR_RELEASE := v0.71
-TYR_GIT := $(shell git describe --dirty 2> /dev/null)
-TYR_VERSION := $(if $(TYR_GIT),$(TYR_GIT),$(TYR_RELEASE))
+TYR_VERSION := TYR_RELEASE
 TYR_VERSION_NUM ?= $(patsubst v%,%,$(TYR_VERSION))
 
 # Ensure the build directory exists
@@ -72,7 +71,7 @@ else
 ifneq (,$(findstring MINGW64,$(SYSNAME)))
 HOST_OS = WIN64
 else
-ifneq (,$(findstring $(SYSNAME),FreeBSD NetBSD))
+ifneq (,$(findstring $(SYSNAME),FreeBSD NetBSD DragonFly))
 HOST_OS = UNIX
 HOST_UNIX = bsd
 else
@@ -90,6 +89,12 @@ ifneq (,$(findstring $(SYSNAME),Linux))
 HOST_OS = UNIX
 HOST_UNIX = linux
 else
+ifneq (,$(findstring $(SYSNAME),SunOS))
+HOST_OS = UNIX
+# enable this if someone can provide a cd_solaris.c with cdrom stuff
+#HOST_UNIX = solaris
+HOST_UNIX = null
+else
 $(error OS type not detected.)
 endif
 endif
@@ -97,6 +102,7 @@ endif
 endif
 endif
 endif
+endif
 
 # --------------------------------------------------------------------
 # Setup driver options, choosing sensible defaults based on target OS
@@ -468,7 +474,7 @@ endef
 endif
 endif
 
-git_date = $(shell git log -1 --date=short --format="%ad" -- $< 2>/dev/null)
+git_date = 2022-09-06
 doc_version = $(git_date) $(TYR_VERSION)
 
 quiet_cmd_man2man = '  MAN2MAN  $@'
@@ -1074,23 +1080,23 @@ ALL_QWSV_LFLAGS += $(patsubst %,-l%,$(AL
 # ============================================================================
 
 $(BIN_DIR)/tyr-quake$(EXT):	$(patsubst %,$(NQSWDIR)/%,$(ALL_NQSW_OBJS))
-	$(call do_cc_link,$(ALL_NQSW_LFLAGS))
+	$(call do_cc_link,$(ALL_NQSW_LFLAGS)) $(LDFLAGS)
 	$(call do_strip,$@)
 
 $(BIN_DIR)/tyr-glquake$(EXT):	$(patsubst %,$(NQGLDIR)/%,$(ALL_NQGL_OBJS))
-	$(call do_cc_link,$(ALL_NQGL_LFLAGS))
+	$(call do_cc_link,$(ALL_NQGL_LFLAGS)) $(LDFLAGS)
 	$(call do_strip,$@)
 
 $(BIN_DIR)/tyr-qwcl$(EXT):	$(patsubst %,$(QWSWDIR)/%,$(ALL_QWSW_OBJS))
-	$(call do_cc_link,$(ALL_QWSW_LFLAGS))
+	$(call do_cc_link,$(ALL_NQGL_LFLAGS)) $(LDFLAGS)
 	$(call do_strip,$@)
 
 $(BIN_DIR)/tyr-glqwcl$(EXT):	$(patsubst %,$(QWGLDIR)/%,$(ALL_QWGL_OBJS))
-	$(call do_cc_link,$(ALL_QWGL_LFLAGS))
+	$(call do_cc_link,$(ALL_NQGL_LFLAGS)) $(LDFLAGS)
 	$(call do_strip,$@)
 
 $(BIN_DIR)/tyr-qwsv$(EXT):	$(patsubst %,$(QWSVDIR)/%,$(ALL_QWSV_OBJS))
-	$(call do_cc_link,$(ALL_QWSV_LFLAGS))
+	$(call do_cc_link,$(ALL_NQGL_LFLAGS)) $(LDFLAGS)
 	$(call do_strip,$@)
 
 # Build man pages, text and html docs from source
