1
0
Fork 0

Update the makefile to properly look for the right targets

The ‘get-multifile-module-version’ and ‘get-module-version’ functions open up
the given Emacs Lisp file and search for a “Version” header, parses it out, and
then returns the file name of the module as it should look in the package
archive.
This commit is contained in:
Tom Willemse 2023-05-25 00:10:31 -07:00
parent e8ac8c4687
commit ae2928e39f

View file

@ -1,6 +1,37 @@
FILES := $(wildcard oni-*.el)
define GUILE_MODULE
(use-modules (ice-9 rdelim)
(ice-9 ports)
(ice-9 regex))
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
(define (convert-version version)
(string-join (map (compose number->string string->number) (string-split version #\.)) "."))
(define (get-multifile-module-version module-name)
(call-with-input-file (format #f "~a/~a.el" module-name module-name)
(lambda (p)
(let loop ((line (read-line p)))
(if (eof-object? line)
"Not found!"
(let ((m (string-match "^;; Version: (.*)" line)))
(if m
(format #f "~a-~a.tar" module-name
(convert-version (match:substring m 1)))
(loop (read-line p)))))))))
(define (get-module-version module-name)
(call-with-input-file (format #f "~a.el" module-name)
(lambda (p)
(let loop ((line (read-line p)))
(if (eof-object? line)
"Not found!"
(let ((m (string-match "^;; Version: (.*)" line)))
(if m
(format #f "~a-~a.el" module-name
(convert-version (match:substring m 1)))
(loop (read-line p)))))))))
endef
$(guile GUILE_MODULE))
define upload =
emacs --quick --batch \
@ -14,55 +45,95 @@ endef
define upload-multi-file =
$(call upload,(car (sort (file-expand-wildcards \"$1/dist/*.tar\") #'string>)))
cp $1/dist/$1-readme.txt bin/
endef
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \
package-oni-haml package-oni-html package-oni-nxml package-oni-org \
package-oni-php package-oni-python package-oni-ruby package-oni-twig \
package-oni-csharp package-oni-bats
package-%: %
$(call upload,\"$^\")
package-oni-bats:
$(call upload-multi-file,oni-bats)
package-oni-conf:
$(call upload-multi-file,oni-conf)
package-oni-css:
$(call upload-multi-file,oni-css)
package-oni-elisp:
$(call upload-multi-file,oni-elisp)
package-oni-haml:
$(call upload-multi-file,oni-haml)
package-oni-html:
$(call upload-multi-file,oni-html)
package-oni-nxml:
$(call upload-multi-file,oni-nxml)
package-oni-org:
$(call upload-multi-file,oni-org)
package-oni-php:
$(call upload-multi-file,oni-php)
package-oni-python:
$(call upload-multi-file,oni-python)
package-oni-ruby:
$(call upload-multi-file,oni-ruby)
package-oni-twig:
$(call upload-multi-file,oni-twig)
package-oni-csharp:
$(call upload-multi-file,oni-csharp)
package: \
bin/$(guile (get-module-version "oni-alert")) \
bin/$(guile (get-module-version "oni-autohotkey")) \
bin/$(guile (get-module-version "oni-bat")) \
bin/$(guile (get-multifile-module-version "oni-bats")) \
bin/$(guile (get-module-version "oni-bookmark")) \
bin/$(guile (get-module-version "oni-browse-url")) \
bin/$(guile (get-module-version "oni-c")) \
bin/$(guile (get-module-version "oni-circe")) \
bin/$(guile (get-module-version "oni-clojure")) \
bin/$(guile (get-module-version "oni-cmake")) \
bin/$(guile (get-module-version "oni-common-lisp")) \
bin/$(guile (get-module-version "oni-company")) \
bin/$(guile (get-module-version "oni-compilation")) \
bin/$(guile (get-multifile-module-version "oni-conf")) \
bin/$(guile (get-module-version "oni-core")) \
bin/$(guile (get-module-version "oni-counsel")) \
bin/$(guile (get-module-version "oni-cpp")) \
bin/$(guile (get-multifile-module-version "oni-csharp")) \
bin/$(guile (get-multifile-module-version "oni-css")) \
bin/$(guile (get-module-version "oni-data-dir")) \
bin/$(guile (get-module-version "oni-diff-hl")) \
bin/$(guile (get-module-version "oni-dired")) \
bin/$(guile (get-module-version "oni-docker")) \
bin/$(guile (get-module-version "oni-ediff")) \
bin/$(guile (get-module-version "oni-elfeed")) \
bin/$(guile (get-multifile-module-version "oni-elisp")) \
bin/$(guile (get-module-version "oni-elm")) \
bin/$(guile (get-module-version "oni-embrace")) \
bin/$(guile (get-module-version "oni-emms")) \
bin/$(guile (get-module-version "oni-epub")) \
bin/$(guile (get-module-version "oni-eshell")) \
bin/$(guile (get-module-version "oni-eww")) \
bin/$(guile (get-module-version "oni-fish")) \
bin/$(guile (get-module-version "oni-flycheck")) \
bin/$(guile (get-module-version "oni-git-commit")) \
bin/$(guile (get-module-version "oni-gnus")) \
bin/$(guile (get-module-version "oni-grep")) \
bin/$(guile (get-module-version "oni-groovy")) \
bin/$(guile (get-module-version "oni-gui")) \
bin/$(guile (get-multifile-module-version "oni-haml")) \
bin/$(guile (get-module-version "oni-haskell")) \
bin/$(guile (get-module-version "oni-highlight-indent-guides")) \
bin/$(guile (get-multifile-module-version "oni-html")) \
bin/$(guile (get-module-version "oni-hydra")) \
bin/$(guile (get-module-version "oni-ivy")) \
bin/$(guile (get-module-version "oni-jabber")) \
bin/$(guile (get-module-version "oni-java")) \
bin/$(guile (get-module-version "oni-js")) \
bin/$(guile (get-module-version "oni-json")) \
bin/$(guile (get-module-version "oni-log-edit")) \
bin/$(guile (get-module-version "oni-lsp")) \
bin/$(guile (get-module-version "oni-lua")) \
bin/$(guile (get-module-version "oni-lui")) \
bin/$(guile (get-module-version "oni-magit")) \
bin/$(guile (get-module-version "oni-makefile")) \
bin/$(guile (get-module-version "oni-notmuch")) \
bin/$(guile (get-multifile-module-version "oni-nxml")) \
bin/$(guile (get-multifile-module-version "oni-org")) \
bin/$(guile (get-module-version "oni-org-roam")) \
bin/$(guile (get-module-version "oni-package")) \
bin/$(guile (get-module-version "oni-paredit")) \
bin/$(guile (get-multifile-module-version "oni-php")) \
bin/$(guile (get-module-version "oni-powershell")) \
bin/$(guile (get-module-version "oni-prescient")) \
bin/$(guile (get-module-version "oni-projectile")) \
bin/$(guile (get-multifile-module-version "oni-python")) \
bin/$(guile (get-multifile-module-version "oni-ruby")) \
bin/$(guile (get-module-version "oni-rust")) \
bin/$(guile (get-module-version "oni-scheme")) \
bin/$(guile (get-module-version "oni-shackle")) \
bin/$(guile (get-module-version "oni-sh")) \
bin/$(guile (get-module-version "oni-shr")) \
bin/$(guile (get-module-version "oni-slack")) \
bin/$(guile (get-module-version "oni-smartparens")) \
bin/$(guile (get-module-version "oni-smt")) \
bin/$(guile (get-module-version "oni-sort")) \
bin/$(guile (get-module-version "oni-termux")) \
bin/$(guile (get-module-version "oni-tramp")) \
bin/$(guile (get-module-version "oni-tui")) \
bin/$(guile (get-multifile-module-version "oni-twig")) \
bin/$(guile (get-module-version "oni-ui")) \
bin/$(guile (get-module-version "oni-vc")) \
bin/$(guile (get-module-version "oni-vterm")) \
bin/$(guile (get-module-version "oni-web")) \
bin/$(guile (get-module-version "oni-yaml")) \
bin/$(guile (get-module-version "oni-yasnippet")) \
install-%:
emacs --batch \
@ -84,5 +155,397 @@ unit-test-%: install-%
integration-test-%: install-%
bats test/integration/$*.bats
clean:
rm -fv $(FILES)
## Single-file packages
bin/$(guile (get-module-version "oni-yasnippet")): oni-yasnippet.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-smartparens")): oni-smartparens.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-flycheck")): oni-flycheck.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-sh")): oni-sh.el \
bin/$(guile (get-module-version "oni-smartparens")) \
bin/$(guile (get-module-version "oni-flycheck"))
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-company")): oni-company.el \
bin/$(guile (get-module-version "oni-prescient"))
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-compilation")): oni-compilation.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-core")): oni-core.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-counsel")): oni-counsel.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-cpp")): oni-cpp.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-prescient")): oni-prescient.el \
bin/$(guile (get-module-version "oni-data-dir"))
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-data-dir")): oni-data-dir.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-diff-hl")): oni-diff-hl.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-dired")): oni-dired.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-docker")): oni-docker.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-ediff")): oni-ediff.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-elfeed")): oni-elfeed.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-elm")): oni-elm.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-embrace")): oni-embrace.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-emms")): oni-emms.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-epub")): oni-epub.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-eshell")): oni-eshell.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-eww")): oni-eww.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-fish")): oni-fish.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-git-commit")): oni-git-commit.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-gnus")): oni-gnus.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-grep")): oni-grep.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-groovy")): oni-groovy.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-gui")): oni-gui.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-haskell")): oni-haskell.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-highlight-indent-guides")): oni-highlight-indent-guides.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-hydra")): oni-hydra.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-ivy")): oni-ivy.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-jabber")): oni-jabber.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-java")): oni-java.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-js")): oni-js.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-json")): oni-json.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-log-edit")): oni-log-edit.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-lsp")): oni-lsp.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-lua")): oni-lua.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-lui")): oni-lui.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-magit")): oni-magit.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-makefile")): oni-makefile.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-markdown")): oni-markdown.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-notmuch")): oni-notmuch.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-org-roam")): oni-org-roam.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-package")): oni-package.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-paredit")): oni-paredit.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-powershell")): oni-powershell.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-projectile")): oni-projectile.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-rust")): oni-rust.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-scheme")): oni-scheme.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-shackle")): oni-shackle.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-shr")): oni-shr.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-slack")): oni-slack.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-smt")): oni-smt.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-sort")): oni-sort.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-termux")): oni-termux.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-tramp")): oni-tramp.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-tui")): oni-tui.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-ui")): oni-ui.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-vc")): oni-vc.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-vterm")): oni-vterm.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-web")): oni-web.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-yaml")): oni-yaml.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-alert")): oni-alert.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-autohotkey")): oni-autohotkey.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-bat")): oni-bat.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-bookmark")): oni-bookmark.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-browse-url")): oni-browse-url.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-c")): oni-c.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-circe")): oni-circe.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-clojure")): oni-clojure.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-cmake")): oni-cmake.el
$(call upload,\"$<\")
bin/$(guile (get-module-version "oni-common-lisp")): oni-common-lisp.el
$(call upload,\"$<\")
## oni-bats
oni-bats/dist/$(guile (get-multifile-module-version "oni-bats")): \
oni-bats/oni-bats.el \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-sh"))
cd oni-bats && eldev package
bin/$(guile (get-multifile-module-version "oni-bats")): \
oni-bats/dist/$(guile (get-multifile-module-version "oni-bats"))
$(call upload-multi-file,oni-bats)
## oni-conf
oni-conf/dist/$(guile (get-multifile-module-version "oni-conf")): \
oni-conf/oni-conf.el \
bin/$(guile (get-module-version "oni-yasnippet"))
cd oni-conf && eldev package
bin/$(guile (get-multifile-module-version "oni-conf")): \
oni-conf/dist/$(guile (get-multifile-module-version "oni-conf"))
$(call upload-multi-file,oni-conf)
## oni-csharp
oni-csharp/dist/$(guile (get-multifile-module-version "oni-csharp")): \
oni-csharp/oni-csharp.el \
bin/$(guile (get-module-version "oni-company")) \
bin/$(guile (get-module-version "oni-flycheck")) \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-hydra")) \
bin/$(guile (get-module-version "oni-lsp")) \
bin/$(guile (get-module-version "oni-smartparens"))
cd oni-csharp && eldev package
bin/$(guile (get-multifile-module-version "oni-csharp")): \
oni-csharp/dist/$(guile (get-multifile-module-version "oni-csharp"))
$(call upload-multi-file,oni-csharp)
## oni-css
oni-css/dist/$(guile (get-multifile-module-version "oni-css")): \
oni-css/oni-css.el \
bin/$(guile (get-module-version "oni-company")) \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-hydra"))
cd oni-css && eldev package
bin/$(guile (get-multifile-module-version "oni-css")): \
oni-css/dist/$(guile (get-multifile-module-version "oni-css"))
$(call upload-multi-file,oni-css)
## oni-elisp
oni-elisp/dist/$(guile (get-multifile-module-version "oni-elisp")): \
oni-elisp/oni-elisp.el \
bin/$(guile (get-module-version "oni-company")) \
bin/$(guile (get-module-version "oni-flycheck")) \
bin/$(guile (get-module-version "oni-paredit")) \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-hydra"))
cd oni-elisp && eldev package
bin/$(guile (get-multifile-module-version "oni-elisp")): \
oni-elisp/dist/$(guile (get-multifile-module-version "oni-elisp"))
$(call upload-multi-file,oni-elisp)
## oni-haml
oni-haml/dist/$(guile (get-multifile-module-version "oni-haml")): \
oni-haml/oni-haml.el \
bin/$(guile (get-module-version "oni-yasnippet"))
cd oni-haml && eldev package
bin/$(guile (get-multifile-module-version "oni-haml")): \
oni-haml/dist/$(guile (get-multifile-module-version "oni-haml"))
$(call upload-multi-file,oni-haml)
## oni-html
oni-html/dist/$(guile (get-multifile-module-version "oni-html")): \
oni-html/oni-html.el \
bin/$(guile (get-module-version "oni-yasnippet"))
cd oni-html && eldev package
bin/$(guile (get-multifile-module-version "oni-html")): \
oni-html/dist/$(guile (get-multifile-module-version "oni-html"))
$(call upload-multi-file,oni-html)
## oni-nxml
oni-nxml/dist/$(guile (get-multifile-module-version "oni-nxml")): \
oni-nxml/oni-nxml.el \
bin/$(guile (get-module-version "oni-yasnippet"))
cd oni-nxml && eldev package
bin/$(guile (get-multifile-module-version "oni-nxml")): \
oni-nxml/dist/$(guile (get-multifile-module-version "oni-nxml"))
$(call upload-multi-file,oni-nxml)
## oni-org
oni-org/dist/$(guile (get-multifile-module-version "oni-org")): \
oni-org/oni-org.el \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-alert")) \
bin/$(guile (get-module-version "oni-hydra"))
cd oni-org && eldev package
bin/$(guile (get-multifile-module-version "oni-org")): \
oni-org/dist/$(guile (get-multifile-module-version "oni-org"))
$(call upload-multi-file,oni-org)
## oni-php
oni-php/dist/$(guile (get-multifile-module-version "oni-php")): \
oni-php/oni-php.el \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-flycheck")) \
bin/$(guile (get-module-version "oni-company")) \
bin/$(guile (get-module-version "oni-prescient")) \
bin/$(guile (get-module-version "oni-data-dir")) \
bin/$(guile (get-module-version "oni-hydra"))
cd oni-php && eldev package
bin/$(guile (get-multifile-module-version "oni-php")): \
oni-php/dist/$(guile (get-multifile-module-version "oni-php"))
$(call upload-multi-file,oni-php)
## oni-python
oni-python/dist/$(guile (get-multifile-module-version "oni-python")): \
oni-python/oni-python.el \
bin/$(guile (get-module-version "oni-yasnippet")) \
bin/$(guile (get-module-version "oni-company")) \
bin/$(guile (get-module-version "oni-flycheck")) \
bin/$(guile (get-module-version "oni-hydra")) \
bin/$(guile (get-module-version "oni-lsp"))
cd oni-python && eldev package
bin/$(guile (get-multifile-module-version "oni-python")): \
oni-python/dist/$(guile (get-multifile-module-version "oni-python"))
$(call upload-multi-file,oni-python)
## oni-ruby
oni-ruby/dist/$(guile (get-multifile-module-version "oni-ruby")): \
oni-ruby/oni-ruby.el \
bin/$(guile (get-module-version "oni-yasnippet"))
cd oni-ruby && eldev package
bin/$(guile (get-multifile-module-version "oni-ruby")): \
oni-ruby/dist/$(guile (get-multifile-module-version "oni-ruby"))
$(call upload-multi-file,oni-ruby)
## oni-twig
oni-twig/dist/$(guile (get-multifile-module-version "oni-twig")): \
oni-twig/oni-twig.el \
bin/$(guile (get-module-version "oni-yasnippet"))
cd oni-twig && eldev package
bin/$(guile (get-multifile-module-version "oni-twig")): \
oni-twig/dist/$(guile (get-multifile-module-version "oni-twig"))
$(call upload-multi-file,oni-twig)