changeset 2388:e845f54be995

Autodetect curl or wget.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Nov 2021 18:11:40 +0200
parents 53c34aaf4515
children 9a95ee5f48ae
files config.mak world/Makefile
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/config.mak	Sat Nov 06 18:01:23 2021 +0200
+++ b/config.mak	Sat Nov 06 18:11:40 2021 +0200
@@ -16,8 +16,9 @@
 COLORMAP_HTML=-f html5
 
 
-HTTPGET = wget -O
-#HTTPGET = curl -o
+# Wget or curl are autodetected but you can force them here
+#HTTPGET ?= curl -o
+#HTTPGET ?= wget -O
 
 
 ###
--- a/world/Makefile	Sat Nov 06 18:01:23 2021 +0200
+++ b/world/Makefile	Sat Nov 06 18:11:40 2021 +0200
@@ -2,6 +2,25 @@
 include config.mak
 
 ###
+### Detect curl or wget
+###
+HAVE_CURL ?= $(shell curl --version > /dev/null && echo "yes")
+HAVE_WGET ?= $(shell wget --version > /dev/null && echo "yes")
+
+ifeq ($(HAVE_CURL),yes)
+HTTPGET ?= curl -o
+else
+ifeq ($(HAVE_WGET),yes)
+HTTPGET ?= wget -O
+else
+ifeq ($(HTTPGET),)
+$(error Required utility 'curl' or 'wget' not found in PATH. You can configure HTTPGET variable in config.mak.)
+endif
+endif
+endif
+
+
+###
 ### Main targets
 ###
 TARGETS=$(addsuffix .html,$(WORLD_MAPS)) \