melpa/Makefile

89 lines
2 KiB
Makefile
Raw Normal View History

2012-07-19 13:37:06 +00:00
SHELL := /bin/bash
PKGDIR := ./packages
2012-07-21 21:58:46 +00:00
RCPDIR := ./recipes
2012-07-19 13:37:06 +00:00
HTMLDIR := ./html
WORKDIR := ./working
WEBROOT := $$HOME/www
2013-09-01 16:25:16 +00:00
EMACS ?= emacs
SLEEP ?= 0
2012-07-19 13:37:06 +00:00
EVAL := $(EMACS)
## Check for needing to initialize CL-LIB from ELPA
NEED_CL-LIB := $(shell $(EMACS) --no-site-file --batch --eval '(prin1 (version< emacs-version "24.3"))')
ifeq ($(NEED_CL-LIB), t)
EVAL := $(EVAL) --eval "(package-initialize)"
endif
EVAL := $(EVAL) --no-site-file --batch -l package-build.el --eval
2012-07-21 21:58:46 +00:00
TIMEOUT := $(shell which timeout && echo "timeout -k 60 600")
2012-07-19 13:37:06 +00:00
all: packages packages/archive-contents json index
2012-07-21 21:58:46 +00:00
## General rules
html: index
2013-08-24 10:06:45 +00:00
index: json
2012-07-21 21:58:46 +00:00
@echo " • Building html index ..."
2012-07-19 13:37:06 +00:00
$(MAKE) -C $(HTMLDIR)
2012-07-21 21:58:46 +00:00
## Cleanup rules
2012-07-19 13:37:06 +00:00
clean-working:
2012-07-21 21:58:46 +00:00
@echo " • Removing package sources ..."
2012-07-19 13:37:06 +00:00
rm -rf $(WORKDIR)/*
clean-packages:
2012-07-21 21:58:46 +00:00
@echo " • Removing packages ..."
2012-07-19 13:37:06 +00:00
rm -rfv $(PKGDIR)/*
clean-json:
2012-07-21 21:58:46 +00:00
@echo " • Removing json files ..."
2013-08-24 10:06:45 +00:00
-rm -vf html/archive.json html/recipes.json
sync:
rsync -avz --delete $(PKGDIR) $(HTMLDIR)/* $(WEBROOT)/
chmod -R go+rx $(WEBROOT)/packages/*
clean: clean-working clean-packages clean-json
packages: $(RCPDIR)/*
packages/archive-contents: packages/*.entry
@echo " • Updating $@ ..."
cleanup:
$(EVAL) '(package-build-cleanup)'
2012-07-21 21:58:46 +00:00
## Json rules
2013-08-24 10:06:45 +00:00
html/archive.json: packages/archive-contents
2012-07-21 21:58:46 +00:00
@echo " • Building $@ ..."
2013-08-24 10:06:45 +00:00
$(EVAL) '(package-build-archive-alist-as-json "html/archive.json")'
2013-08-24 10:06:45 +00:00
html/recipes.json: $(RCPDIR)/.dirstamp
2012-07-21 21:58:46 +00:00
@echo " • Building $@ ..."
2013-08-24 10:06:45 +00:00
$(EVAL) '(package-build-recipe-alist-as-json "html/recipes.json")'
2013-08-24 10:06:45 +00:00
json: html/archive.json html/recipes.json
2012-07-19 13:37:06 +00:00
2012-07-21 21:58:46 +00:00
$(RCPDIR)/.dirstamp: .FORCE
@[[ ! -e $@ || "$$(find $(@D) -newer $@ -print -quit)" != "" ]] \
&& touch $@ || exit 0
## Recipe rules
$(RCPDIR)/%: .FORCE
@echo " • Building recipe $(@F) ..."
- $(TIMEOUT) $(EVAL) "(package-build-archive '$(@F))"
2012-07-21 21:58:46 +00:00
@echo " ✓ Wrote $$(ls -lsh $(PKGDIR)/$(@F)-*) "
@echo " Sleeping for $(SLEEP) ..."
sleep $(SLEEP)
2012-07-19 13:37:06 +00:00
@echo
2012-07-21 21:58:46 +00:00
.PHONY: clean build index html json
.FORCE: