From 9e425d152925904dde9b0434387187b5ba1656f2 Mon Sep 17 00:00:00 2001
From: Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>
Date: Mon, 19 Feb 2024 21:39:04 +0100
Subject: [PATCH] Use el.make

---
 Makefile                             | 83 ++++++++++++++++++++++------
 el.make                              |  1 +
 org-journal.el => src/org-journal.el |  0
 3 files changed, 67 insertions(+), 17 deletions(-)
 create mode 120000 el.make
 rename org-journal.el => src/org-journal.el (100%)

diff --git a/Makefile b/Makefile
index 5edb6c0..585e224 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,72 @@
-EMACS = emacs
-BATCH = $(EMACS) -Q -batch -L .
+# this file is part of el.make.
+#
+# copyright: 2024- christian schwarzgruber (c.schwarzgruber.cs@gmail.com)
+#
+# version: 0.1.0
+#
+# source: https://github.com/casch-at/el.make
+#
+#
+##
+####
+##
+# el.make is free software: you can redistribute it and/or modify it
+# under the terms of the gnu general public license as published by the free
+# software foundation, either version 3 of the license, or
+# (at your option) any later version.
+#
+# el.make is distributed in the hope that it will be useful,
+# but without any warranty; without even the implied warranty of
+# merchantability or fitness for a particular purpose. see the
+# gnu general public license for more details.
+#
+# you should have received a copy of the gnu general public license along
+# with el.make. if not, see <http://www.gnu.org/licenses/>.
+##
+####
+##
+#                     hier koennte ihre werbung stehen
+#
+#                                 el.make
+#
+#                       a emacs lisp `make` file
+##
 
-export LC_ALL=C
+# todo(cschwarzgruber): hmm?
+export LC_ALL = C
 
-all: clean compile gen-autoloads test
+emacs = emacs
+flags = -Q --batch --no-site-file
+batch = $(emacs) $(flags)
 
-# Forcefully remove files ignored by Git.
-clean:
-	git clean -Xf
+## test directory
+testdir = tests
+
+## source directory
+srcdir = src
+
+## all source files
+elfiles = $(wildcard $(srcdir)/*.el)
+
+## all test files
+testfiles = $(wildcard $(testdir)/*.el)
+
+## all compiled files
+elcfiles = $(addprefix $(srcdir)/, $(notdir $(elfiles:.el=.elc)))
 
-compile:
-	$(BATCH) -f batch-byte-compile org-journal.el
+.phony: all compile test clean
 
-gen-autoloads:
-	$(BATCH) \
-		--eval "(require 'autoload)" \
-		--eval '(setq make-backup-files nil)' \
-		--eval "(setq generated-autoload-file (concat command-line-default-directory \"/\" \"org-journal-autoloads.el\"))" \
-		-f batch-update-autoloads "."
+all: compile test
 
-test:
-	$(BATCH) -l tests/org-journal-test -f ert-run-tests-batch-and-exit
+compile: $(elcfiles)
+
+test: $(elcfiles)
+	@echo "running tests... "
+	@$(batch) -L $(srcdir) -l $(testfiles) -f ert-run-tests-batch-and-exit
+
+$(srcdir)/%.elc: $(srcdir)/%.el
+	@echo "compiling $<..."
+	@$(batch) -f batch-byte-compile $<
+
+clean:
+	rm -f $(elcfiles)
diff --git a/el.make b/el.make
new file mode 120000
index 0000000..33ceb8f
--- /dev/null
+++ b/el.make
@@ -0,0 +1 @@
+Makefile
\ No newline at end of file
diff --git a/org-journal.el b/src/org-journal.el
similarity index 100%
rename from org-journal.el
rename to src/org-journal.el