DIRS=$(filter-out .,$(subst ./,,$(shell find . -maxdepth 1 -type d)))
-## alas "all" is an ELPA package, so this is going to break
-all: build-all
+## dependent on makefile
+all: pkg-all $(EMACS)
-build-all: $(DIRS) $(EMACS)
# define package_template
# test: $(patsubst %,%-test,$(DIRS))
-include gnumakefile.mk
-
+include gnumakefile-inc.mk
clean:
find . -name "*pkg.el" -exec rm -v {} \;
(defun package-makefile--package-dirs (directory)
(directory-files directory nil "[^.].*"))
+
+(defun package-makefile--target-pkg-el (top-dir base-dir)
+ (format
+ "%s-pkg: %s/%s/%s-pkg.el
+
+%s/%s/%s-pkg.el:
+\t$(EMACS) --batch --directory=admin \\
+\t\t--load admin/package-build.el \\
+\t\t--eval '(package-build-prepare \"%s/%s\")'
+"
+
+ base-dir top-dir base-dir base-dir
+ top-dir base-dir base-dir
+ top-dir base-dir))
+
+(defun package-makefile--makefile-pkg-targets (top-dir)
+ (concat
+ "pkg-all: "
+ (mapconcat
+ 'identity
+ (package-makefile--package-dirs top-dir) "" "-pkg ")
+ "\n\n"
+ (mapconcat
+ (lambda (base-dir)
+ (package-makefile--target-pkg-el top-dir base-dir))
+ (package-makefile--package-dirs top-dir)
+ "\n")))
+
+(defun package-makefile--makefile ()
+ (mapconcat
+ (lambda (top-dir)
+ (package-makefile--makefile-pkg-targets top-dir))
+ package-makefile-archives
+ "\n"))
+
+
+(defun package-makefile ()
+ (with-temp-buffer
+ (insert
+ (package-makefile--makefile))
+
+ (write-file "gnumakefile-inc.mk")))
+
;; example: core/example/example-pkg.el
;; core/example/example-pkg.el
;; $(EMACS) --batch --load package-build.el --eval '(package-build-prepare "core/example"")'
core/example/example-pkg.el:
$(EMACS) --batch --directory=admin \
--load admin/package-build.el \
- --eval '(package-build-prepare "core/example"")'
+ --eval '(package-build-prepare "core/example")'
(package-makefile--package-dirs "core")
(package-makefile--package-dirs "/home/phillord/src/git/elpa/master/packages")
+
+
+(package-makefile--target-pkg-el "core" "example")
+(package-makefile--makefile-pkg-targets "core")
+(package-makefile--makefile)
+
+(package-build-prepare "core/example")
+
+(defun temp ()
+ (interactive)
+ (package-makefile))