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; $(EMACS) -batch -l $(CURDIR)/admin/archive-contents.el -f batch-make-archive
27 @cd $(ARCHIVE_TMP)/packages; \
29 if [ -d $$pt ]; then \
30 echo "Creating tarball $${pt}.tar" && \
31 tar -cf $${pt}.tar $$pt --remove-files; \
34 mkdir -p archive/packages
35 mv archive/packages archive/packages-old
36 mv $(ARCHIVE_TMP)/packages archive/packages
37 chmod -R a+rX archive/packages
38 rm -rf archive/packages-old
41 ## Deploy the package archive to archive/ including the Org daily:
42 archive-full: archive-tmp org-fetch
43 $(MAKE) $(MFLAGS) process-archive
44 #mkdir -p archive/admin
45 #cp admin/* archive/admin/
47 org-fetch: archive-tmp
48 cd $(ARCHIVE_TMP)/packages; \
49 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"}'`; \
50 wget -q http://orgmode.org/elpa/$${pkgname}.tar -O $${pkgname}.tar; \
51 if [ -f $${pkgname}.tar ]; then \
52 tar xf $${pkgname}.tar; \
53 rm -f $${pkgname}.tar; \
58 rm -rf archive $(ARCHIVE_TMP) $(SITE_DIR)
60 ########## Rules for in-place installation ####################################
61 pkgs := $(foreach pkg, $(wildcard packages/*), \
62 $(if $(shell [ -d "$(pkg)" ] && echo true), $(pkg)))
65 $(shell echo "$(1)" "$(2)" "$(2)" | tr ' ' '\n' | sort | uniq -u)
69 $(filter-out %-autoloads.el %-pkg.el, $(1))
73 $(1): $$(call FILTER-nonsrc, $$(wildcard $$(dir $(1))/*.el))
76 # Compute the set of autolods files and their dependencies.
77 autoloads := $(foreach pkg, $(pkgs), $(pkg)/$(notdir $(pkg))-autoloads.el)
79 $(foreach al, $(autoloads), $(eval $(call RULE-srcdeps, $(al))))
81 @echo 'EMACS -f package-generate-autoloads $@'
84 -l $(CURDIR)/admin/archive-contents.el \
85 --eval "(archive--refresh-pkg-file)" \
86 --eval "(require 'package)" \
87 --eval "(package-generate-autoloads '$$(basename $$(pwd)) \
90 # Put into elcs the set of elc files we need to keep up-to-date.
91 # I.e. one for each .el file except for the -pkg.el, the -autoloads.el, and
92 # the .el files that are marked "no-byte-compile".
93 els := $(call FILTER-nonsrc, $(wildcard packages/*/*.el))
94 naive_elcs := $(patsubst %.el, %.elc, $(els))
95 current_elcs := $(wildcard packages/*/*.elc)
97 extra_els := $(call SET-diff, $(els), $(patsubst %.elc, %.el, $(current_elcs)))
98 nbc_els := $(foreach el, $(extra_els), \
99 $(if $(shell grep '^;.*no-byte-compile: t' "$(el)"), $(el)))
100 elcs := $(call SET-diff, $(naive_elcs), $(patsubst %.el, %.elc, $(nbc_els)))
102 # '(dolist (al (quote ($(patsubst %, "%", $(autoloads))))) (load (expand-file-name al) nil t))'
104 @echo 'EMACS -f batch-byte-compile $<'
106 --eval "(setq package-directory-list '(\"$(abspath packages)\"))" \
107 --eval '(package-initialize)' \
108 -L $(dir $@) -f batch-byte-compile $<
113 # Remove .elc files that don't have a corresponding .el file any more.
114 extra_elcs := $(call SET-diff, $(current_elcs), $(naive_elcs))
115 .PHONY: $(extra_elcs)
116 $(extra_elcs):; rm $@
118 # # Put into single_pkgs the set of -pkg.el files we need to keep up-to-date.
119 # # I.e. all the -pkg.el files for the single-file packages.
120 # single_pkgs:=$(foreach pkg, $(pkgs), \
121 # $(word $(words $(call FILTER-nonsrc, \
122 # $(wildcard $(pkg)/*.el))), \
123 # $(pkg)/$(notdir $(pkg))-pkg.el))
124 # #$(foreach al, $(single_pkgs), $(eval $(call RULE-srcdeps, $(al))))
126 # @echo 'EMACS -f package-generate-description-file $@'
127 # @$(EMACS) --batch \
128 # --eval '(require (quote package))' \
129 # --eval '(setq b (find-file-noselect "$<"))' \
130 # --eval '(setq d (with-current-buffer b (package-buffer-info)))' \
131 # --eval '(package-generate-description-file d "$(dir $@)")'
134 all-in-place: $(extra_elcs) $(autoloads) # $(single_pkgs)
135 # Do them in a sub-make, so that autoloads are done first.
139 ############### Rules to prepare the externals ################################