This repository was archived by the owner on Mar 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (126 loc) · 5.11 KB
/
Makefile
File metadata and controls
151 lines (126 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Makefile for Research and Development Workflow
# This Makefile provides a comprehensive set of targets to support
# research, development, documentation, and publication processes.
# Project Configuration
# Customize these variables to match your project structure
SRC_DIR = src # Source code directory
BUILD_DIR = build # Build output directory
DOC_DIR = doc # Documentation directory
SCHEME_DIR = scheme # Scheme-specific code directory
EXAMPLES_DIR = examples # Examples directory
# Tool Configuration
EMACS = emacs # Emacs executable
EMACS_BATCH = $(EMACS) --batch --quick # Batch mode Emacs command
# Help Target - Dynamically generates help text from target comments
.PHONY: help
help: ## Display this help message with all available targets and their descriptions
@echo "Available targets:"
@echo ""
@awk -F':.*##' '/^[a-zA-Z_-]+:.*##/ {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo ""
@echo "Usage: make [target]"
@echo "Example: make build - Builds the entire project"
# Default goal - runs help if no target is specified
.DEFAULT_GOAL := help
# Simple directories setup for development
.PHONY: setup-dirs
setup-dirs:
@echo "Creating project directories..."
@mkdir -p src scheme doc scripts build data
@echo "Directory structure created."
# High-Level Project Targets
.PHONY: all
all: build docs ## Build entire project (compilation + documentation)
# Build Workflow Targets
.PHONY: build
build: tangle compile ## Complete build process: tangle code + compile
# Tangling Targets (converting literate programming files to source code)
.PHONY: tangle
tangle: tangle-research ## Tangle all project files (currently research.org)
# Research Org Tangling with enhanced logging and error handling
research.org.tangle: research.org ## Tangle research.org into source code
@echo "Tangling research.org..."
@mkdir -p src scheme doc scripts
@$(EMACS_BATCH) --eval "(require 'org)" \
--eval "(setq org-confirm-babel-evaluate nil)" \
--eval "(setq org-babel-tangle-use-relative-file-links nil)" \
--eval "(find-file \"$<\")" \
--eval "(condition-case err (org-babel-tangle) (error (princ (format \"Tangling failed: %s\n\" err))))" \
--kill
@touch $@
@echo "Tangling of research.org completed successfully."
tangle-research: research.org.tangle ## Alias for research.org tangling
# Documentation Generation
.PHONY: docs
docs: research.pdf ## Generate all documentation (currently research PDF)
# LaTeX and PDF Generation
research.tex: research.org ## Convert research.org to LaTeX
@echo "Generating LaTeX from research.org..."
@$(EMACS_BATCH) --eval "(require 'org)" \
--eval "(setq org-confirm-babel-evaluate nil)" \
--eval "(find-file \"$<\")" \
--eval "(org-latex-export-to-latex)" \
--kill
research.pdf: research.tex ## Generate final PDF from LaTeX
@echo "Compiling PDF (first pass)..."
@pdflatex $<
@echo "Generating bibliography..."
@bibtex $(basename $<)
@echo "Compiling PDF (second pass)..."
@pdflatex $<
@pdflatex $<
@echo "PDF generation complete."
# Publication Targets
.PHONY: publish
publish: publish-research ## Publish all documentation (currently research)
publish-research: research.org ## Publish research.org as HTML
@echo "Publishing research.org to HTML..."
@$(EMACS_BATCH) --eval "(require 'org)" \
--eval "(setq org-confirm-babel-evaluate nil)" \
--eval "(find-file \"$<\")" \
--eval "(let ((org-export-show-temporary-export-buffer nil)) (org-html-export-to-html nil nil nil t))" \
--kill
@echo "Research published as HTML successfully."
# Convenience Viewing Target
.PHONY: view-research
view-research: research.pdf ## Open research PDF in default viewer
@echo "Opening research PDF..."
@xpdf $< || evince $< || open $< || echo "Could not find a PDF viewer"
# Compilation Target
.PHONY: compile
compile: ## Compile source files (placeholder for project-specific compilation)
@echo "Compiling source files..."
@mkdir -p $(BUILD_DIR)
# Add your specific compilation commands here
# Example: gcc, g++, javac, etc.
@echo "Compilation complete."
# Templates Target (optional)
templates/els-2025.tex: ## Download ELS 2025 LaTeX template
@echo "Downloading ELS 2025 LaTeX template..."
@mkdir -p $(dir $@)
@wget -O $@ https://european-lisp-symposium.org/static/submission/template.tex
@echo "Template downloaded successfully."
# Data
data:
mkdir -p $@
data/pg2650.txt: data ## Du côté de chez Swann
wget -O $@ https://www.gutenberg.org/cache/epub/2650/pg2650.txt
EXAMPLE ?= examples/freebsd-upgrade.lisp
.PHONY: extract-tokens
extract-tokens: $(EXAMPLE) ## Process an AST to original text
guile extract-tokens.scm $
# Cleanup Targets
.PHONY: clean
clean: ## Remove generated files from the current build
@echo "Cleaning generated files..."
@rm -f research.tex research.pdf research.aux research.log
@rm -f research.bbl research.blg research.out
@rm -f research.org.tangle
@rm -f research.html
@echo "Clean completed."
.PHONY: clean-all
clean-all: clean ## Perform a deep clean, removing all build artifacts
@echo "Performing deep clean..."
@rm -rf $(BUILD_DIR)/*
@echo "Deep clean completed."
# Additional targets can be added here as needed