% METHOD: make make do

% REMEMBER:
% WHAT: Makefile as a method for a promiscuous publication.
% HOW:
% WHEN:
% WHO:
% URGENCY:
    
% WARNING: - 

> It possessed many heads, the exact number of which
> varies according to the source.[@wikipedia:2018:hydra]

% NOTE: - 

May the traditional software workflow of a
[Makefile](http://www.gnu.org/software/make/manual/make.html)
serve as a platform for a hyper flexible constellation of multi-style
mini-programs spread out over files and folders, media and meta-data?

A promiscuous publication is NOT like parallel, hybrid, or cross-media publishing.
It is a multi-headed and polycentric form of making public. It enjoys its various forms,
and embraces their idiosyncracies. As a multi-headed publication it is NOT obsessed with
providing uniform outcomes across diverse media. Having many centers, it can produce
new focal points and obfuscate its origins. It explores playfully a spectral diversity
with sibling outcomes and bastard children that operate out of sync or tune.

% We are interested in breaking the chain of hierarchical and linear editing, and prefer
% distributed responsibility: too often a small team of editors is tasked to correct mistakes,
% deal with legal issues and make selections after the fact, in order to turn a collection of
% notes into a structured publication later.

We are curious about creating pipelines that stir and create currents and behaviours spiraling
outside of the continuity of predictable flows, where their modality switches as their inputs
solidify, evaporate and gelatinize into diverse forms in reactions to conditions,
while influencing and changing the others.

How can the making-public itself be an engaging experience, interactive but with erratic options? 
How could the process of iterating between known sources and diverse and unfamilair pipelines be made tangible? 


% EXAMPLE: - 

% --------

# find all .md files in the directory
md=$(shell ls etherdump/*.md)
# map *.mp => *.html for mdsrc
md2html=$(md:%.md=%.html)
md2pdf=$(md:%.md=%.pdf)

# inputs
# .mdsrcs: A listing of (local) markdown files
mdsrcs=$(shell ls etherdump/*.mdsrcs)
2col=$(mdsrcs:%.mdsrcs=%.2col.pdf)
pdocpdf=$(mdsrcs:%.mdsrcs=%.pdoc.pdf)
pdochtml=$(mdsrcs:%.mdsrcs=%.html)

# .pdfsrc: A listing of local PDF URLS,
# optionally with #page= fragment
pdfsrcs=$(shell ls etherdump/*.pdfsrcs)
scrp=$(pdfsrcs:%.pdfsrcs=%.scrp.pdf)

all: $(md2html) $(md2pdf) $(pdochtml) $(pdocpdf) $(2col) $(scrp)

dump:
        cd etherdump && etherdump pull --all \
        --pub /home/pi/etherdump \
        --css lib/styles.css \
        --script lib/versions.js --no-raw-ext
        cd etherdump && etherdump index *.meta.json \
        --templatepath /home/pi/etherdump/lib \
        --template index.template.html > _index.html

.PHONY: fixnames
fixnames:
        rename "s/ /_/g" *
        rename "s/[\(\)\?\']//g" *
        rename "s/^(\d)([^\d])/0\1\2/g" *

today:
        touch `date +"%Y-%m-%d.md"`

now_folder:
        mkdir `date +"%Y-%m-%d-%H%M%S"`

# .html <== .md using pandoc
%.html: %.md
        pandoc --from markdown \
                --to html \
                --standalone \
                $< \
                -o $@

# .pdf <== .md using pandoc/latex
%.pdf: %.md
        pandoc --from markdown \
                --table-of-contents \
                --standalone \
                $< \
                -o $@

##############################################################
# Recipes for lists of MARKDOWN SOURCES

# pandoc/latex pdf assembled from markdown sources
%.pdoc.pdf: %.mdsrcs
        cat $< | python scripts/urls2paths.py | \
        xargs cat | pandoc --from markdown -o $@

# html from markdown sources
%.pdoc.html: %.mdsrcs
        cat $< | python scripts/urls2paths.py | xargs cat | \
        pandoc --from markdown --to html --standalone -o $@

# 2 column bare bones PDF using Report Lab from markdown sources
%.2col.pdf: %.mdsrcs
        cat $< | \
        python scripts/urls2paths.py | \
        xargs cat | \
        pandoc --from markdown --to html --standalone | \
        python scripts/rl2cols.py --output $@

###############################################################
# Recipes for lists of PDF SOURCES 
# (with possibly #page=start,end fragments)

%.scrp.pdf: %.pdfsrcs
        python scripts/pdfsrcs.py $< $@ | bash

# special rule for debugging variables
print-%:
        @echo '$*=$($*)'

% SRCCODE: make



%!SOURCE: [Etherdump makefile](http://observatory.constantvzw.org/etherdump/makefile.raw.html)
%!SOURCE: Earlier versions of _Make Make Do_ where developed in the context of the [_Promiscuous Pipelines Publication_](https://gitlab.com/fs/pppp)