diff options
author | Sunaina Pai <sunainapai.in@gmail.com> | 2019-12-05 12:25:10 +0530 |
---|---|---|
committer | Sunaina Pai <sunainapai.in@gmail.com> | 2019-12-05 12:25:10 +0530 |
commit | 5a3e8b4d588f81427ed2c6abdf48df0abe2cec90 (patch) | |
tree | c44dc55b1aedb31e15e5e06c9962fcb42aab8118 | |
parent | cebbf522931fd6cbdf826a3733af3de36b20574b (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.
-rw-r--r-- | Makefile | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -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 |