summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSunaina Pai <sunainapai.in@gmail.com>2019-12-05 12:25:10 +0530
committerSunaina Pai <sunainapai.in@gmail.com>2019-12-05 12:25:10 +0530
commit5a3e8b4d588f81427ed2c6abdf48df0abe2cec90 (patch)
treec44dc55b1aedb31e15e5e06c9962fcb42aab8118 /Makefile
parentcebbf522931fd6cbdf826a3733af3de36b20574b (diff)
Replace GNU Make 'ifeq' with POSIX shell 'if'
This project tries to keep the Makefile as generic as possible by conforming to POSIX make specification, so this commit removes ifeq-statements that are GNU-specific extensions to make and replaces them with if-statements that are available in any POSIX shell.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 12 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index e7156fa..62a8ed4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,19 @@
-PYTHON3_AVAILABLE := $(shell python3 --version 2>&1)
-
site:
./makesite.py
serve: site
-ifeq ('$(PYTHON3_AVAILABLE)','')
- cd _site && python -m SimpleHTTPServer
-else
- cd _site && python3 -m http.server
-endif
+ if python3 -c 'import http.server' 2> /dev/null; then \
+ echo Running Python3 http.server ...; \
+ python3 -m http.server; \
+ elif python -c 'import http.server' 2> /dev/null; then \
+ echo Running Python http.server ...; \
+ python -m http.server; \
+ elif python -c 'import SimpleHTTPServer' 2> /dev/null; then \
+ echo Running Python SimpleHTTPServer ...; \
+ python -m SimpleHTTPServer; \
+ else \
+ echo Cannot find Python http.server or SimpleHTTPServer; \
+ fi
venv2:
virtualenv ~/.venv/makesite