annotate Makefile @ 23:e4f02a31925d

New blog post for moving simulators to GitHub.
author Brian Neal <bgneal@gmail.com>
date Thu, 02 Jul 2020 15:20:39 -0500
parents c4ec6945bb86
children
rev   line source
bgneal@0 1 PY=python
bgneal@0 2 PELICAN=pelican
bgneal@0 3 PELICANOPTS=
bgneal@0 4
bgneal@0 5 BASEDIR=$(CURDIR)
bgneal@0 6 INPUTDIR=$(BASEDIR)/content
bgneal@0 7 OUTPUTDIR=$(BASEDIR)/output
bgneal@0 8 CONFFILE=$(BASEDIR)/pelicanconf.py
bgneal@0 9 PUBLISHCONF=$(BASEDIR)/publishconf.py
bgneal@0 10
bgneal@0 11 FTP_HOST=localhost
bgneal@0 12 FTP_USER=anonymous
bgneal@0 13 FTP_TARGET_DIR=/
bgneal@0 14
bgneal@0 15 SSH_HOST=jaguar
bgneal@0 16 SSH_PORT=22
bgneal@0 17 SSH_USER=brian
bgneal@0 18 SSH_TARGET_DIR=/svr/www/deathofagremmie.com/public
bgneal@0 19
bgneal@0 20 S3_BUCKET=my_s3_bucket
bgneal@0 21
bgneal@0 22 CLOUDFILES_USERNAME=my_rackspace_username
bgneal@0 23 CLOUDFILES_API_KEY=my_rackspace_api_key
bgneal@0 24 CLOUDFILES_CONTAINER=my_cloudfiles_container
bgneal@0 25
bgneal@0 26 DROPBOX_DIR=~/Dropbox/Public/
bgneal@0 27
bgneal@0 28 DEBUG ?= 0
bgneal@0 29 ifeq ($(DEBUG), 1)
bgneal@0 30 PELICANOPTS += -D
bgneal@0 31 endif
bgneal@0 32
bgneal@0 33 help:
bgneal@0 34 @echo 'Makefile for a pelican Web site '
bgneal@0 35 @echo ' '
bgneal@0 36 @echo 'Usage: '
bgneal@0 37 @echo ' make html (re)generate the web site '
bgneal@0 38 @echo ' make clean remove the generated files '
bgneal@0 39 @echo ' make regenerate regenerate files upon modification '
bgneal@0 40 @echo ' make publish generate using production settings '
bgneal@0 41 @echo ' make serve [PORT=8000] serve site at http://localhost:8000'
bgneal@0 42 @echo ' make devserver [PORT=8000] start/restart develop_server.sh '
bgneal@0 43 @echo ' make stopserver stop local server '
bgneal@0 44 @echo ' make ssh_upload upload the web site via SSH '
bgneal@0 45 @echo ' make rsync_upload upload the web site via rsync+ssh '
bgneal@0 46 @echo ' make dropbox_upload upload the web site via Dropbox '
bgneal@0 47 @echo ' make ftp_upload upload the web site via FTP '
bgneal@0 48 @echo ' make s3_upload upload the web site via S3 '
bgneal@0 49 @echo ' make cf_upload upload the web site via Cloud Files'
bgneal@0 50 @echo ' make github upload the web site via gh-pages '
bgneal@0 51 @echo ' '
bgneal@0 52 @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
bgneal@0 53 @echo ' '
bgneal@0 54
bgneal@0 55 html:
bgneal@0 56 $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
bgneal@0 57
bgneal@0 58 clean:
bgneal@0 59 [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
bgneal@0 60
bgneal@0 61 regenerate:
bgneal@0 62 $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
bgneal@0 63
bgneal@0 64 serve:
bgneal@0 65 ifdef PORT
bgneal@0 66 cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
bgneal@0 67 else
bgneal@0 68 cd $(OUTPUTDIR) && $(PY) -m pelican.server
bgneal@0 69 endif
bgneal@0 70
bgneal@0 71 devserver:
bgneal@0 72 ifdef PORT
bgneal@0 73 $(BASEDIR)/develop_server.sh restart $(PORT)
bgneal@0 74 else
bgneal@0 75 $(BASEDIR)/develop_server.sh restart
bgneal@0 76 endif
bgneal@0 77
bgneal@0 78 stopserver:
bgneal@0 79 kill -9 `cat pelican.pid`
bgneal@0 80 kill -9 `cat srv.pid`
bgneal@0 81 @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
bgneal@0 82
bgneal@0 83 publish:
bgneal@0 84 $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
bgneal@0 85
bgneal@0 86 ssh_upload: publish
bgneal@0 87 scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
bgneal@0 88
bgneal@0 89 rsync_upload: publish
bgneal@0 90 rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
bgneal@0 91
bgneal@0 92 dropbox_upload: publish
bgneal@0 93 cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
bgneal@0 94
bgneal@0 95 ftp_upload: publish
bgneal@0 96 lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
bgneal@0 97
bgneal@0 98 s3_upload: publish
bgneal@0 99 s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed
bgneal@0 100
bgneal@0 101 cf_upload: publish
bgneal@0 102 cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) .
bgneal@0 103
bgneal@0 104 github: publish
bgneal@0 105 ghp-import $(OUTPUTDIR)
bgneal@0 106 git push origin gh-pages
bgneal@0 107
bgneal@0 108 .PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github