1 # Makefile for GNU Emacs Lisp Package Archive.
5 ARCHIVE_TMP=archive-tmp
8 .PHONY: archive-tmp changelogs process-archive archive-full org-fetch clean all do-it
12 ## Deploy the package archive to archive/, with packages in
15 $(MAKE) $(MFLAGS) process-archive
19 mkdir -p $(ARCHIVE_TMP)
20 cp -a packages/. $(ARCHIVE_TMP)/packages
23 # FIXME, we could probably speed this up significantly with
24 # rules like "%.tar: ../%/ChangeLog" so we only rebuild the packages
25 # that have indeed changed.
26 cd $(ARCHIVE_TMP)/packages; \
27 $(EMACS) -l $(CURDIR)/admin/archive-contents.el \
29 @cd $(ARCHIVE_TMP)/packages; \
31 if [ -d $$pt ]; then \
32 echo "Creating tarball $${pt}.tar" && \
33 tar -cf $${pt}.tar $$pt --remove-files; \
36 mkdir -p archive/packages
37 mv archive/packages archive/packages-old
38 mv $(ARCHIVE_TMP)/packages archive/packages
39 chmod -R a+rX archive/packages
40 rm -rf archive/packages-old
43 ## Deploy the package archive to archive/ including the Org daily:
44 archive-full: archive-tmp org-fetch
45 $(MAKE) $(MFLAGS) process-archive
46 #mkdir -p archive/admin
47 #cp admin/* archive/admin/
49 org-fetch: archive-tmp
50 cd $(ARCHIVE_TMP)/packages; \
51 pkgname=`curl -s http://orgmode.org/elpa/|perl -ne 'push @f, $$1 if m/(org-\d{8})\.tar/; END { @f = sort @f; print "$$f[-1]\n"}'`; \
52 wget -q http://orgmode.org/elpa/$${pkgname}.tar -O $${pkgname}.tar; \
53 if [ -f $${pkgname}.tar ]; then \
54 tar xf $${pkgname}.tar; \
55 rm -f $${pkgname}.tar; \
60 rm -rf archive $(ARCHIVE_TMP) $(SITE_DIR)
62 ########## Rules for in-place installation ####################################
63 pkgs := $(foreach pkg, $(wildcard packages/*), \
64 $(if $(shell [ -d "$(pkg)" ] && echo true), $(pkg)))
67 $(shell echo "$(1)" "$(2)" "$(2)" | tr ' ' '\n' | sort | uniq -u)
71 $(filter-out %-autoloads.el %-pkg.el, $(1))
75 $(1): $$(call FILTER-nonsrc, $$(wildcard $$(dir $(1))/*.el))
78 # Compute the set of autolods files and their dependencies.
79 autoloads := $(foreach pkg, $(pkgs), $(pkg)/$(notdir $(pkg))-autoloads.el)
81 $(foreach al, $(autoloads), $(eval $(call RULE-srcdeps, $(al))))
83 @echo 'EMACS -f package-generate-autoloads $@'
85 $(EMACS) -l $(CURDIR)/admin/archive-contents.el \
86 --eval "(archive--refresh-pkg-file)" \
87 --eval "(require 'package)" \
88 --eval "(package-generate-autoloads '$$(basename $$(pwd)) \
91 # Put into elcs the set of elc files we need to keep up-to-date.
92 # I.e. one for each .el file except for the -pkg.el, the -autoloads.el, and
93 # the .el files that are marked "no-byte-compile".
94 els := $(call FILTER-nonsrc, $(wildcard packages/*/*.el))
95 naive_elcs := $(patsubst %.el, %.elc, $(els))
96 current_elcs := $(wildcard packages/*/*.elc)
98 extra_els := $(call SET-diff, $(els), $(patsubst %.elc, %.el, $(current_elcs)))
99 nbc_els := $(foreach el, $(extra_els), \
100 $(if $(shell grep '^;.*no-byte-compile: t' "$(el)"), $(el)))
101 elcs := $(call SET-diff, $(naive_elcs), $(patsubst %.el, %.elc, $(nbc_els)))
103 # '(dolist (al (quote ($(patsubst %, "%", $(autoloads))))) (load (expand-file-name al) nil t))'
105 @echo 'EMACS -f batch-byte-compile $<'
107 --eval "(setq package-directory-list '(\"$(abspath packages)\"))" \
108 --eval '(package-initialize)' \
109 -L $(dir $@) -f batch-byte-compile $<
114 # Remove .elc files that don't have a corresponding .el file any more.
115 extra_elcs := $(call SET-diff, $(current_elcs), $(naive_elcs))
116 .PHONY: $(extra_elcs)
117 $(extra_elcs):; rm $@
119 # # Put into single_pkgs the set of -pkg.el files we need to keep up-to-date.
120 # # I.e. all the -pkg.el files for the single-file packages.
121 # single_pkgs:=$(foreach pkg, $(pkgs), \
122 # $(word $(words $(call FILTER-nonsrc, \
123 # $(wildcard $(pkg)/*.el))), \
124 # $(pkg)/$(notdir $(pkg))-pkg.el))
125 # #$(foreach al, $(single_pkgs), $(eval $(call RULE-srcdeps, $(al))))
127 # @echo 'EMACS -f package-generate-description-file $@'
129 # --eval '(require (quote package))' \
130 # --eval '(setq b (find-file-noselect "$<"))' \
131 # --eval '(setq d (with-current-buffer b (package-buffer-info)))' \
132 # --eval '(package-generate-description-file d "$(dir $@)")'
135 all-in-place: $(extra_elcs) $(autoloads) # $(single_pkgs)
136 # Do them in a sub-make, so that autoloads are done first.
140 ############### Rules to prepare the externals ################################
144 $(EMACS) -l admin/archive-contents.el \
145 -f archive-add/remove/update-externals