# haqistan.net MULTIMARKDOWN?=multimarkdown flags?= # make flags=-d site ... FLOG_FLAGS?=-BP ${flags} FLOG?=./flog.pl ${FLOG_FLAGS} #FLOG?=flog ${FLOG_FLAGS} PERLDOC?=perldoc SH=/bin/sh RM?=rm BASE?=./tmp TAR?=gtar VHOST_branch!=git branch --no-color | fgrep '*' | awk '{print $$2}' VHOST_trunk?=www.haqistan.net VHOST_master?=www.haqistan.net VHOST_staging?=flog.haqistan.net VHOST_flogger?=flogger VHOST_?=local VHOST?=${VHOST_${VHOST_branch}} DOCROOT_ROOT?=/var/www/htdocs DOCROOT=${DOCROOT_ROOT}/${VHOST} #DOCROOT_trunk?=${DOCROOT_ROOT}/www.haqistan.net #DOCROOT_master?=${DOCROOT_ROOT}/www.haqistan.net #DOCROOT_staging?=${DOCROOT_ROOT}/flog.haqistan.net #DOCROOT_flogger?=${DOCROOT_ROOT}/flogger #DOCROOT=${DOCROOT_${VHOST}} WEB_BUG?=fnrd.gif STATIC=flogger.css meta.md header.md footer.md flog.pl dump_wordpress.pl \ robots.txt Makefile ${WEB_BUG} images haqistan.png CP?=cp CONTENT_DIRS?=pages posts papers books ECHO?=/bin/echo '... ' grep_opts?=-i # OpenBSD-style make show=foo .if defined(show) .MAIN: show .elif defined(search) .MAIN: search .elif defined(find) .MAIN: find .else .MAIN: all .endif all: ${BASE} static ${BASE}/index.md mung-archives-index # make show=draft, make show=featured, ... searches metadata show: .for _s in ${show} . for _d in ${CONTENT_DIRS} -@find ${_d} -name '*.md' | xargs grep ${grep_opts} '^${_s}:' . endfor .endfor # search contents by regexp search: .for _t in ${search} . for _d in ${CONTENT_DIRS} -@find ${_d} -name '*.md' | xargs grep ${grep_opts} ${_t} . endfor .endfor # find a file by pattern find: .for _f in ${find} . for _d in ${CONTENT_DIRS} -@find ${_d} -name "${_f}" . endfor .endfor ${BASE}: mkdir -p ${BASE} static: flog.html @${ECHO} Copying Static Content @-${TAR} -cf - ${STATIC} flog.html | ${TAR} -C ${BASE} -xf - flog.html: flog.pl @${ECHO} Regenerating flog POD @${PERLDOC} -o html flog.pl > flog.html @-${RM} -f tmp.sed @echo '3i\\' > tmp.sed @echo '' >> tmp.sed @sed -i -f tmp.sed flog.html $(BASE)/index.md: # ${FLOG} -D ${BASE} | ${SH} @${ECHO} "Generating Site ..." @/bin/echo -n '... ' @-time ${FLOG} | ${SH} clean: @-${RM} -f flog.html tmp.sed @-[ -d ${BASE} ] && ${RM} -rf ${BASE}/* site: clean all update: site @${ECHO} Copying to docroot: ${DOCROOT} @-${TAR} -C ${BASE} -cf - . | ${TAR} -C ${DOCROOT} -xf - update-cmd: @echo "# "BASE=${BASE} BRANCH=${BRANCH} DOCROOT=${DOCROOT} @echo '${TAR} -C ${BASE} -cf - . | ${TAR} -C ${DOCROOT} -xf -' # SKULDUGGERY alert # # Multimarkdown gets upset about embedded HTML