Added makext

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-02 20:39:08 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-02 20:39:08 +0200
Commit 6a351ac15e3604b94e39cde39eb63de421a7e0ef (patch)
-rw-r--r-- Makefile 14
-rw-r--r-- content/pages/projects.fossil.md.part 6
-rw-r--r-- content/pages/projects.github.md.part 2
-rw-r--r-- content/pages/projects.md 10
-rw-r--r-- makext.mk 46
-rw-r--r-- static/projects/xmagnify.fossil bin 220.0 KB -> 220.0 KB
-rw-r--r-- templates/page-no-title.html 10
-rw-r--r-- tools/fossil-projects.sh 6
-rw-r--r-- tools/github-projects.py 2
9 files changed, 77 insertions, 19 deletions
diff --git a/Makefile b/Makefile
  
1
include makext.mk
  
2
  
  
3
help: .help
  
4
  
1
MAKEFLAGS+=-j2
5
MAKEFLAGS+=-j2
2
PROJECTS_FILENAME = content/pages/projects.md
6
PROJECTS_FILENAME = content/pages/projects.md
3
  
7
  
4
dev: watch server
8
dev: watch server # Starts a development server
5
  
9
  
6
watch:
10
watch:
7
	find . -type f \( -name "*.html" -o -name "*.js" -o -name "*.md" -o -name "*.yaml" -o -name "*.css" -o -name "*.xml" \) | entr jbmafp -b
11
	find . -type f \( -name "*.html" -o -name "*.js" -o -name "*.md" -o -name "*.yaml" -o -name "*.css" -o -name "*.xml" \) | entr jbmafp -b
...
9
server:
13
server:
10
	jbmafp -s
14
	jbmafp -s
11
  
15
  
12
update-projects: projects-header
16
update-projects: projects-header # Update projects page
13
	cat content/pages/projects.fossil.md.part \
17
	cat content/pages/projects.fossil.md.part \
14
		content/pages/projects.github.md.part >> \
18
		content/pages/projects.github.md.part >> \
15
		content/pages/projects.md
19
		content/pages/projects.md
...
19
	echo "title: Personal projects" >> $(PROJECTS_FILENAME)
23
	echo "title: Personal projects" >> $(PROJECTS_FILENAME)
20
	echo "date: 2024-10-21T12:00:00+02:00" >> $(PROJECTS_FILENAME)
24
	echo "date: 2024-10-21T12:00:00+02:00" >> $(PROJECTS_FILENAME)
21
	echo "url: projects.html" >> $(PROJECTS_FILENAME)
25
	echo "url: projects.html" >> $(PROJECTS_FILENAME)
22
	echo "type: page" >> $(PROJECTS_FILENAME)
26
	echo "type: page-no-title" >> $(PROJECTS_FILENAME)
23
	echo "draft: false" >> $(PROJECTS_FILENAME)
27
	echo "draft: false" >> $(PROJECTS_FILENAME)
24
	echo "---\n" >> $(PROJECTS_FILENAME)
28
	echo "---\n" >> $(PROJECTS_FILENAME)
25
  
29
  
26
update-fossil:
30
update-fossil: # Update Fossil projects
27
	cd tools && bash fossil-projects.sh
31
	cd tools && bash fossil-projects.sh
28
  
32
  
29
update-github:
33
update-github: # Update GitHub projects
30
	cd tools && python github-projects.py
34
	cd tools && python github-projects.py
diff --git a/content/pages/projects.fossil.md.part b/content/pages/projects.fossil.md.part
1
## Fossil repositories
1
# Fossil repositories
2
  
2
  
3
- [pats.fossil](/projects/pats.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:24:05</small>
3
- [pats.fossil](/projects/pats.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:30:23</small>
4
- [xmagnify.fossil](/projects/xmagnify.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:24:05</small>
4
- [xmagnify.fossil](/projects/xmagnify.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:37:02</small>
diff --git a/content/pages/projects.github.md.part b/content/pages/projects.github.md.part
1
  
1
  
2
  
2
  
3
## GitHub repositories
3
# GitHub repositories
4
  
4
  
5
<div class='project-list'>
5
<div class='project-list'>
6
  
6
  
...
diff --git a/content/pages/projects.md b/content/pages/projects.md
...
2
title: Personal projects
2
title: Personal projects
3
date: 2024-10-21T12:00:00+02:00
3
date: 2024-10-21T12:00:00+02:00
4
url: projects.html
4
url: projects.html
5
type: page
5
type: page-no-title
6
draft: false
6
draft: false
7
---
7
---
8
  
8
  
9
## Fossil repositories
9
# Fossil repositories
10
  
10
  
11
- [pats.fossil](/projects/pats.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:21:40</small>
11
- [pats.fossil](/projects/pats.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:30:23</small>
12
- [xmagnify.fossil](/projects/xmagnify.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:21:40</small>
12
- [xmagnify.fossil](/projects/xmagnify.fossil)<br><small>Size: 220K, Modified: 2025-08-02 20:37:02</small>
13
  
13
  
14
  
14
  
15
## GitHub repositories
15
# GitHub repositories
16
  
16
  
17
<div class='project-list'>
17
<div class='project-list'>
18
  
18
  
...
diff --git a/makext.mk b/makext.mk
  
1
# Makext is a collection of useful extensions for Makefiles, aimed at
  
2
# simplifying and enhancing the functionality of Make-based projects. These
  
3
# extensions provide additional features and convenience functions to
  
4
# improve the build process, manage dependencies, and streamline common
  
5
# tasks.
  
6
#
  
7
# Visit the GitHub repository at https://github.com/mitjafelicijan/makext
  
8
# to learn more and contribute to the project.
  
9
#
  
10
# `makext` was written by Mitja Felicijan and is released under the BSD
  
11
# two-clause license, see the LICENSE file for more information.
  
12
  
  
13
# Load environmental files from `MEX_ENVIRONMENT`. By default GNU make
  
14
# loads what is already in `env`. This extends it to other files.
  
15
ifdef MEX_ENVIRONMENT
  
16
TEMP_ENV_FILES=$(shell echo $(MEX_ENVIRONMENT) | tr ',' ' ')
  
17
$(foreach file,$(TEMP_ENV_FILES),$(eval include $(file)))
  
18
endif
  
19
  
  
20
# Help extension that lists all the targets with descriptions
  
21
# and adds description and license information if data provided.
  
22
.PHONY: .help
  
23
.help:
  
24
ifdef MEX_DESCRIPTION
  
25
	@printf "%s\n\n" $(MEX_DESCRIPTION) | fmt
  
26
endif
  
27
	@echo "Targets:"
  
28
	@grep -vE '^[[:space:]]' $(MAKEFILE_LIST) | grep -E '^.*:.* #' | sed -E 's/(.*):(.*):.*#(.*)/  \2###\3/' | column -t -s '###'
  
29
ifdef MEX_LICENSE
  
30
	@printf "\n%s" $(MEX_LICENSE) | fmt
  
31
endif
  
32
  
  
33
# Checks `MEX_ASSURE` variable if all the programs declared actually
  
34
# exist on a machine. If not this exists make with error.
  
35
.PHONY: .assure
  
36
.assure:
  
37
ifndef MEX_ASSURE
  
38
	@printf "Variable MEX_ASSURE is not defined. Can not check for programs.\n"
  
39
else
  
40
	@for prog in $(shell echo $(MEX_ASSURE)); do \
  
41
		if ! which $$prog > /dev/null; then \
  
42
			echo "Error: '$$prog' not found on this machine."; \
  
43
			exit 1; \
  
44
		fi; \
  
45
	done
  
46
endif
diff --git a/static/projects/xmagnify.fossil b/static/projects/xmagnify.fossil
diff --git a/templates/page-no-title.html b/templates/page-no-title.html
  
1
{{ template "base.html" . }}
  
2
  
  
3
{{ define "title" }}{{ .Page.Title }}{{ end }}
  
4
{{ define "description" }}{{ .Page.Summary }}{{ end }}
  
5
  
  
6
{{ define "content" }}
  
7
<article>
  
8
	<div>{{ .Page.HTML }}</div>
  
9
</article>
  
10
{{ end }}
diff --git a/tools/fossil-projects.sh b/tools/fossil-projects.sh
1
set -xe
  
2
  
  
3
OUT=../content/pages/projects.fossil.md.part
1
OUT=../content/pages/projects.fossil.md.part
4
  
2
  
5
echo -e "## Fossil repositories\n" > $OUT
3
echo -e "# Fossil repositories\n" > $OUT
6
  
4
  
7
find ~/Projects/ -type f -name "*.fossil" -not -path "*/website/*" | while read -r file; do
5
find ~/Projects/ -type f -name "*.fossil" -not -path "*/website/*" | while read -r file; do
8
	cp $file ../static/projects/
6
	rsync -uv $file ../static/projects/
9
done
7
done
10
  
8
  
11
find ../static/projects/ -type f -name "*.fossil" | while read -r file; do
9
find ../static/projects/ -type f -name "*.fossil" | while read -r file; do
...
diff --git a/tools/github-projects.py b/tools/github-projects.py
...
16
    file = open("../content/pages/projects.github.md.part", "w")
16
    file = open("../content/pages/projects.github.md.part", "w")
17
  
17
  
18
    file.write(DOUBLE_NL)
18
    file.write(DOUBLE_NL)
19
    file.write("## GitHub repositories")
19
    file.write("# GitHub repositories")
20
    file.write(DOUBLE_NL)
20
    file.write(DOUBLE_NL)
21
  
21
  
22
    file.write("<div class='project-list'>")
22
    file.write("<div class='project-list'>")
...