[ccan] [PATCH 2/3] Makefile-web: Introduce variable for PHP binary

Andrew Jeffery andrew at aj.id.au
Sat Mar 26 00:12:13 AEDT 2016


I don't have PHP5 installed on my system but I do have PHP7. Allow
selection of the PHP binary through a variable.

Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 Makefile-web | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Makefile-web b/Makefile-web
index a7f9297..fc8d818 100644
--- a/Makefile-web
+++ b/Makefile-web
@@ -1,6 +1,10 @@
 # This can be overridden on cmdline to generate pages elsewhere.
 WEBDIR=/srv/www/ccodearchive.net
 
+# Similarly, override on the commandline to use an alternate PHP interpreter
+# (e.g. php7)
+PHP=php5
+
 ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(MODS))
 DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(MODS))
 DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(MODS))
@@ -36,7 +40,7 @@ $(WEBDIR)/junkcode/%.tar.bz2: junkcode/% $(WEBDIR)/junkcode
 
 $(WEBDIR)/junkcode/%.html: $(WEBDIR)/junkcode/%.tar.bz2
 	cd $(WEBDIR) && tar xfj junkcode/$*.tar.bz2
-	URLPREFIX=../ php5 web/staticjunkcode.php junkcode/$* $* > $@
+	URLPREFIX=../ $(PHP) web/staticjunkcode.php junkcode/$* $* > $@
 
 # We want tarball to contain ccan/; we put junkcode in, but don't depend on it.
 $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files ccan tools licenses)
@@ -45,17 +49,17 @@ $(WEBDIR)/ccan.tar.bz2: config.h Makefile Makefile-ccan $(shell git ls-files cca
 $(ALL_PAGES): tools/doc_extract web/staticmoduleinfo.php
 
 $(WEBDIR)/list.html: web/staticall.php tools/doc_extract $(DIRECT_TARBALLS) $(DEPEND_TARBALLS) $(WEBDIR)/ccan.tar.bz2 $(JUNKBALLS)
-	php5 web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
+	$(PHP) web/staticall.php ccan/ junkcode/ $(WEBDIR) $(MODS) > $@
 
 $(WEBDIR)/upload.html: web/staticupload.php
-	php5 web/staticupload.php > $@
+	$(PHP) web/staticupload.php > $@
 
 # cpp inserts gratuitous linebreaks at start of file, makes for php problems.
 $(WEBDIR)/uploader.php: web/uploader.php.cpp
 	cpp -w -C -P $< | grep . > $@
 
 $(WEBDIR)/index.html: web/staticindex.php
-	php5 web/staticindex.php > $@
+	$(PHP) web/staticindex.php > $@
 
 $(WEBDIR)/example-config.h: config.h
 	cp $< $@
@@ -74,7 +78,7 @@ $(WEBDIR)/ccan.css: web/ccan.css
 
 $(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
 	@mkdir -p `dirname $@`
-	URLPREFIX=../`echo $* | tr -dc '/' | sed s',/,../,g'` php5 web/staticmoduleinfo.php `pwd`/ccan/$* $* > $@
+	URLPREFIX=../`echo $* | tr -dc '/' | sed s',/,../,g'` $(PHP) web/staticmoduleinfo.php `pwd`/ccan/$* $* > $@
 
 $(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info clean-tree
 	@mkdir -p `dirname $@`
-- 
2.7.3



More information about the ccan mailing list