aboutsummaryrefslogtreecommitdiff
path: root/share/templater/basic
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-12-05 09:13:35 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-12-05 09:13:35 -0200
commit8953561798e1eec6731935c578fd212289a72f01 (patch)
treeb8efe4c5714602714f2687fb8365fbcc4da42fd8 /share/templater/basic
parent2c49897d9d2c3c709ad7e7afdd976efab06a867b (diff)
downloadtemplater-8953561798e1eec6731935c578fd212289a72f01.tar.gz
templater-8953561798e1eec6731935c578fd212289a72f01.tar.bz2
Basic module manages global Makefile
Diffstat (limited to 'share/templater/basic')
-rw-r--r--share/templater/basic/files/Makefile47
-rwxr-xr-xshare/templater/basic/setup4
2 files changed, 51 insertions, 0 deletions
diff --git a/share/templater/basic/files/Makefile b/share/templater/basic/files/Makefile
new file mode 100644
index 0000000..6dbbd98
--- /dev/null
+++ b/share/templater/basic/files/Makefile
@@ -0,0 +1,47 @@
+#
+# Global Makefile - https://templater.fluxo.info
+#
+# This Makefile contains basic, common targets and also includes
+# any Makefile.* available in the current folder.
+#
+
+# Port to serve content
+HTTP_PORT="8000"
+HTTP_SERVER="SimpleHTTPServer"
+
+# Set CONTAINER based in what we have available in the system
+# This variable can be user in other, included Makefiles to handle virtualization tasks
+ifeq ($(shell which kvmx > /dev/null && test -s kvmxfile && echo yes), yes)
+ CONTAINER = kvmx
+else ifeq ($(shell which vagrant > /dev/null && test -s Vagrantfile && echo yes), yes)
+ CONTAINER = vagrant
+else ifeq ($(shell which docker > /dev/null && test -s Dockerfile && echo yes), yes)
+ CONTAINER = docker
+else
+ CONTAINER = ''
+endif
+
+# See http://unix.stackexchange.com/questions/32182/simple-command-line-http-server#32200
+# http://php.net/manual/en/features.commandline.webserver.php
+serve:
+ @if [ "$(HTTP_SERVER)" = "SimpleHTTPServer" ]; then python -m SimpleHTTPServer $(HTTP_PORT); fi
+ @if [ "$(HTTP_SERVER)" = "ssi_server" ]; then PYTHONDONTWRITEBYTECODE=0 ssi_server.py $(HTTP_PORT); fi
+ @if [ "$(HTTP_SERVER)" = "http.server" ]; then python3 -m http.server $(HTTP_PORT); fi
+ @if [ "$(HTTP_SERVER)" = "php" ]; then php -S localhost:$(HTTP_PORT); fi
+
+# Configure a git post-receive hook
+post_receive:
+ git config receive.denyCurrentBranch ignore
+ test -s bin/post-receive && cd .git/hooks && ln -sf ../../bin/post-receive
+
+# Process any other Makefile whose filename matches Makefile.*
+# See https://www.gnu.org/software/make/manual/html_node/Include.html
+#
+# Some of those files might even contain local customizations/overrides
+# that can be .gitignore'd, like a Makefile.local for example.
+-include Makefile.*
+
+# Customization examples can be as simple as setting variables:
+#CONTAINER = vagrant
+#CONTAINER = docker
+#DESTDIR ?= vendor
diff --git a/share/templater/basic/setup b/share/templater/basic/setup
index b90f5b2..e0a85a8 100755
--- a/share/templater/basic/setup
+++ b/share/templater/basic/setup
@@ -24,6 +24,10 @@ function templater_basic {
#echo "* Nothing here? :P" >> TODO.md
touch ChangeLog
+
+ if [ ! -e 'Makefile' ]; then
+ cp $SHARE/basic/files/Makefile .
+ fi
else
templater_echo "Basic files already set"
fi