-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.am
More file actions
150 lines (137 loc) · 5.2 KB
/
Copy pathMakefile.am
File metadata and controls
150 lines (137 loc) · 5.2 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
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = include src flare cli emacs tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ditty.pc
dittydatadir = $(datadir)/ditty/lisp
dittydata_DATA = lisp/lisp-fmt.lisp lisp/tui-events.lisp
# App icon and desktop entry
icondir = $(datadir)/icons/hicolor/scalable/apps
icon_DATA = icons/hicolor/scalable/apps/ditty.svg
applicationsdir = $(datadir)/applications
applications_DATA = ditty.desktop
EXTRA_DIST = \
autogen.sh \
build-aux/git-version.sh \
ditty.pc.in \
ditty.desktop.in \
README.md \
LANGUAGE_GUIDE.md \
COPYING \
.clang-format \
lisp/lisp-fmt.lisp \
lisp/tui-events.lisp \
scripts/gen-docstrings.sh \
scripts/gen-builtin-ref.sh \
scripts/make-dist-zip.sh \
scripts/make-dist-app.sh \
icons/hicolor/scalable/apps/ditty.svg \
icons/ditty.ico \
cli/ditty.rc \
docstrings/arithmetic.md \
docstrings/characters.md \
docstrings/comparison.md \
docstrings/errors.md \
docstrings/file-io.md \
docstrings/filesystem.md \
docstrings/functions.md \
docstrings/hash-tables.md \
docstrings/lists.md \
docstrings/packages.md \
docstrings/printing.md \
docstrings/regex.md \
docstrings/special-forms.md \
docstrings/string-ports.md \
docstrings/strings.md \
docstrings/symbols.md \
docstrings/time-and-profiling.md \
docstrings/tui.md \
docstrings/type-predicates.md \
docstrings/vectors.md \
emacs/README.md \
emacs/COPYING \
emacs/ditty-mode.el \
emacs/ditty-mode-tests.el
# Keep the version file in sync with the current git state (or DITTY_VERSION
# from configure). The recipe always runs but only rewrites the file when
# the version actually changes, so a subsequent autoreconf picks up the right
# PACKAGE_VERSION without needing to run autogen.sh first.
.PHONY: version_force
version: version_force
@v=`"$(srcdir)/build-aux/git-version.sh" "$(srcdir)" 2>/dev/null`; \
test -n "$$v" || v="$(DITTY_VERSION)"; \
test -n "$$v" || v="unknown"; \
if test "x$$v" != "x$$(cat "$(srcdir)/version" 2>/dev/null)" \
&& test -w "$(srcdir)"; then \
printf '%s' "$$v" > "$(srcdir)/version"; \
echo " GEN $@ ($$v)"; \
fi
version_force:
all-local: version
# Stamp the version file in the dist tarball so tarball builds produce the
# correct version without .git.
dist-hook:
printf '%s' '$(DITTY_VERSION)' > "$(distdir)/version"
# Format target — clang-format on C, shfmt on shell, prettier on Markdown,
# and the Lisp formatter (lisp/lisp-fmt.lisp) on .lisp files via ditty.
.PHONY: format
format:
@if command -v clang-format >/dev/null 2>&1; then \
echo "Formatting C with clang-format..."; \
find $(top_srcdir)/src $(top_srcdir)/include $(top_srcdir)/cli $(top_srcdir)/flare $(top_srcdir)/tests \
\( -name '*.c' -o -name '*.h' \) -print0 \
| xargs -0 clang-format -i; \
else \
echo "clang-format not found - skipping C formatting." >&2; \
fi
@if command -v shfmt >/dev/null 2>&1; then \
echo "Formatting shell scripts with shfmt..."; \
find $(top_srcdir) -maxdepth 2 -name '*.sh' -print0 2>/dev/null \
| xargs -0 -r shfmt -w; \
else \
echo "shfmt not found - skipping shell script formatting." >&2; \
fi
@if command -v prettier >/dev/null 2>&1; then \
echo "Formatting Markdown with prettier..."; \
find $(top_srcdir) -maxdepth 2 -name '*.md' -print0 \
| xargs -0 prettier --write; \
else \
echo "prettier not found - skipping Markdown formatting." >&2; \
fi
@if command -v emacs >/dev/null 2>&1; then \
echo "Formatting Emacs Lisp via emacs..."; \
$(MAKE) -C emacs elisp-format srcdir=$(top_srcdir)/emacs; \
else \
echo "emacs not found - skipping Elisp formatting." >&2; \
fi
@ditty_bin=""; \
if [ -x "$(top_builddir)/cli/ditty" ]; then ditty_bin="$(top_builddir)/cli/ditty"; \
elif command -v ditty >/dev/null 2>&1; then ditty_bin=ditty; fi; \
if [ -n "$$ditty_bin" ]; then \
echo "Formatting Lisp via $$ditty_bin ..."; \
find $(top_srcdir)/lisp $(top_srcdir)/tests -name '*.lisp' -print0 \
| xargs -0 -r -n 1 "$$ditty_bin" $(top_srcdir)/lisp/lisp-fmt.lisp -- -i; \
else \
echo "ditty not found - skipping Lisp formatting (build first)." >&2; \
fi
# Portable Windows ZIP target — stages the exes, data files, runtime DLLs,
# and a launcher .cmd into a self-contained ZIP. Only meaningful on Windows
# (MSYS2 UCRT64), where ldd is available.
.PHONY: dist-portable
dist-portable:
@sh "$(top_srcdir)/scripts/make-dist-zip.sh" "$(abs_builddir)" "$(top_srcdir)"
# Portable macOS .app target — stages the binaries, data files, runtime
# dylibs, and an Info.plist into a self-contained .app bundle inside a ZIP.
# Only meaningful on macOS, where otool/install_name_tool are available.
.PHONY: dist-app
dist-app:
@sh "$(top_srcdir)/scripts/make-dist-app.sh" "$(abs_builddir)" "$(top_srcdir)"
# Bear target — produce compile_commands.json for clangd by intercepting
# the build. Cleans first so bear sees every compile invocation.
.PHONY: bear
bear:
@command -v bear >/dev/null 2>&1 || { \
echo "bear not installed - install via your package manager." >&2; \
exit 1; \
}
$(MAKE) clean
bear --output $(top_srcdir)/compile_commands.json -- $(MAKE)