pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

Makefile (890B)


      1 #TITLE := $(shell git branch --show-current)
      2 RND := ""
      3 # https://stackoverflow.com/a/14061796
      4 # If the first argument is "draft"
      5 ifeq (draft,$(firstword $(MAKECMDGOALS)))
      6   # use the rest as arguments for "draft"
      7   ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
      8   # ...and turn them into do-nothing targets
      9   $(eval $(ARGS):;@:)
     10 else
     11 ifeq (preview,$(firstword $(MAKECMDGOALS)))
     12   ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
     13   $(eval $(ARGS):;@:)
     14 else
     15 ifeq (publish,$(firstword $(MAKECMDGOALS)))
     16   ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
     17   $(eval $(ARGS):;@:)
     18 endif
     19 endif
     20 endif
     21 
     22 ifeq ($(ARGS), )
     23 	ARGS := $(shell git branch --show-current)
     24 endif
     25 
     26 prog: # ...
     27     # ...
     28 
     29 .PHONY: draft preview publish
     30 
     31 draft : prog
     32 	scripts/draft $(ARGS) $(RND)
     33 
     34 preview : prog
     35 	scripts/preview $(ARGS)
     36 
     37 publish : prog
     38 	scripts/publish $(ARGS) $(RND)