aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-01-04 13:40:21 +0100
committerSébastien Dailly <sebastien@chimrod.com>2021-01-05 11:06:20 +0100
commit1cad4c9044d47c6653d804d7fb58581d92f96cc8 (patch)
tree9696b75a4288976a00dbfc694090768ac93cdd14 /Makefile
parent0c09a00a0b298cbd3bbd0082cc1026e22db9b1c5 (diff)
Change organisation
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile111
1 files changed, 53 insertions, 58 deletions
diff --git a/Makefile b/Makefile
index 8ce88c8..809fb10 100644
--- a/Makefile
+++ b/Makefile
@@ -1,85 +1,80 @@
-PELICAN=pelican
+PY?=python3
+PELICAN?=pelican
PELICANOPTS=
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
-OUTPUTDIR=$(BASEDIR)/output/
+OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py
-#FTP_HOST=localhost
-#FTP_USER=anonymous
-#FTP_TARGET_DIR=/
-
SSH_HOST=vps785951
SSH_PORT=22
SSH_USER=sdailly
SSH_TARGET_DIR=/srv/apache/blog-chimrod/
-#DROPBOX_DIR=~/Dropbox/Public/
+
+DEBUG ?= 0
+ifeq ($(DEBUG), 1)
+ PELICANOPTS += -D
+endif
+
+RELATIVE ?= 0
+ifeq ($(RELATIVE), 1)
+ PELICANOPTS += --relative-urls
+endif
+
+SERVER ?= "0.0.0.0"
+
+PORT ?= 0
+ifneq ($(PORT), 0)
+ PELICANOPTS += -p $(PORT)
+endif
+
help:
- @echo 'Makefile for a pelican Web site '
- @echo ' '
- @echo 'Usage: '
- @echo ' make html (re)generate the web site '
- @echo ' make clean remove the generated files '
- @echo ' make regenerate regenerate files upon modification '
- @echo ' make publish generate using production settings '
- @echo ' make serve serve site at http://localhost:8000'
- @echo ' make devserver start/restart develop_server.sh '
- @echo ' make stopserver stop local server '
- @echo ' ssh_upload upload the web site via SSH '
- @echo ' rsync_upload upload the web site via rsync+ssh '
- @echo ' dropbox_upload upload the web site via Dropbox '
- @echo ' ftp_upload upload the web site via FTP '
- @echo ' github upload the web site via gh-pages '
- @echo ' '
-
-
-html: clean $(OUTPUTDIR)/index.html
- @echo 'Done'
-
-$(OUTPUTDIR)/%.html:
- $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
+ @echo 'Makefile for a pelican Web site '
+ @echo ' '
+ @echo 'Usage: '
+ @echo ' make html (re)generate the web site '
+ @echo ' make clean remove the generated files '
+ @echo ' make regenerate regenerate files upon modification '
+ @echo ' make publish generate using production settings '
+ @echo ' make serve [PORT=8000] serve site at http://localhost:8000'
+ @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
+ @echo ' make devserver [PORT=8000] serve and regenerate together '
+ @echo ' make sync upload the web site via rsync+ssh '
+ @echo ' '
+ @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
+ @echo 'Set the RELATIVE variable to 1 to enable relative urls '
+ @echo ' '
+
+html:
+ "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
clean:
- [ ! -d $(OUTPUTDIR) ] || find $(OUTPUTDIR) -mindepth 1 -delete
+ [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)"
-regenerate: clean
- $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
+regenerate:
+ "$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
serve:
- cd $(OUTPUTDIR) && python -m pelican.server
+ "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
+
+serve-global:
+ "$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER)
devserver:
- $(BASEDIR)/develop_server.sh restart
+ "$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)
-stopserver:
- kill -9 `cat pelican.pid`
- kill -9 `cat srv.pid`
- @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
+devserver-global:
+ $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0
publish:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
-#ssh_upload: publish
-# scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
-
sync: publish
- rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR) $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
-
-#sync: publish
-# swift upload --changed --object-name . blog output
-
-#dropbox_upload: publish
-# cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
-#
-#ftp_upload: publish
-# lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
-#
-#github: publish
-# ghp-import $(OUTPUTDIR)
-# git push origin gh-pages
-
-.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload github
+ rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --include tags --cvs-exclude --delete "$(OUTPUTDIR)"/ "$(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)"
+
+
+.PHONY: html help clean regenerate serve serve-global devserver publish ssh_upload rsync_upload