Skip to content

Commit 133c89c

Browse files
committed
Replace github link
1 parent ed43765 commit 133c89c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+78
-63
lines changed

β€ŽMakefileβ€Ž

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SCORM_ORG = "TU-Bergakademie Freiberg"
55
SCORM_SCORE = 80
66

77
.DEFAULT_GOAL := all
8-
all: $(COURSES) git-update-if-needed
8+
all: $(COURSES) prune-pdfs git-update-if-needed
99

1010
# Generic function to build a course
1111
define build_course
@@ -23,7 +23,6 @@ clean-$(1):
2323
@echo "🧹 Cleaning old files for $(1)..."
2424
rm -f $(1).html $(1).zip
2525
rm -rf assets/$(1)/ || true
26-
$(if $(filter $(1),$(PDF_COURSES)),rm -rf assets/pdf/* || true)
2726

2827

2928

@@ -34,9 +33,7 @@ build-$(1):
3433

3534
organize-$(1):
3635
$(if $(filter $(1),$(PDF_COURSES)), \
37-
mkdir -p assets/$(1)/pdf && \
38-
cp assets/pdf/*.pdf assets/$(1)/pdf/ 2>/dev/null || true && \
39-
sed -i 's|assets/pdf/|assets/$(1)/pdf/|g' $(1).html)
36+
echo "πŸ”— Using shared assets/pdf for $(1); skipping duplication" )
4037
endef
4138

4239
# Generate targets for all courses
@@ -78,10 +75,19 @@ update-cache-%:
7875
git-update-if-needed:
7976
@if [ -f .cache/build_occurred ]; then \
8077
echo "πŸ”„ Changes detected - updating git repository..."; \
81-
git add assets/ || true; \
82-
git add -A; \
83-
git commit --amend --no-edit; \
84-
git push origin main -f; \
78+
echo "πŸ“ Staging modified tracked files..."; \
79+
git add -u; \
80+
echo "πŸ“¦ Staging asset changes (including new files)..."; \
81+
git add -A assets/ || true; \
82+
echo "πŸ“„ Staging HTML files..."; \
83+
git add *.html || true; \
84+
if git diff --cached --quiet; then \
85+
echo "🟑 No staged changes; skipping commit"; \
86+
else \
87+
echo "πŸ“ Amending last commit and pushing..."; \
88+
git commit --amend --no-edit; \
89+
git push origin main -f; \
90+
fi; \
8591
rm -f .cache/build_occurred; \
8692
else \
8793
echo "βœ… No courses rebuilt - git repository unchanged"; \
@@ -157,6 +163,7 @@ help:
157163
@echo " clean-cache - Clear only cache files"
158164
@echo " status - Show build status of all courses"
159165
@echo " git-update - Update git repository"
166+
@echo " prune-pdfs - Remove PDFs not referenced by any HTML"
160167
@echo ""
161168
@echo "Individual courses (with change detection):"
162169
@$(foreach course,$(COURSES),echo " $(course)";)
@@ -169,4 +176,12 @@ help:
169176
@echo " SCORM org: $(SCORM_ORG)"
170177
@echo " SCORM score: $(SCORM_SCORE)"
171178

172-
.PHONY: all clean-all clean-cache force-all status git-update help $(COURSES)
179+
.PHONY: all clean-all clean-cache force-all status git-update help prune-pdfs $(COURSES)
180+
181+
prune-pdfs:
182+
@echo "πŸ—‘οΈ Pruning unreferenced PDFs..."
183+
@if [ -x ./prune_pdfs.sh ]; then \
184+
./prune_pdfs.sh || true; \
185+
else \
186+
chmod +x prune_pdfs.sh && ./prune_pdfs.sh || true; \
187+
fi

0 commit comments

Comments
Β (0)