forked from gentoo/catalyst
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (43 loc) · 2.18 KB
/
Makefile
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
# Copyright (C) 2011 Sebastian Pipping <[email protected]>
# Licensed under GPL v2 or later
PACKAGE_VERSION = $(shell PYTHONPATH=. python -c 'import catalyst; print(catalyst.__version__)')
MAN_PAGE_SOURCES = $(wildcard doc/*.?.txt)
MAN_PAGES = $(patsubst doc/%.txt,files/%,$(MAN_PAGE_SOURCES))
MAN_PAGE_INCLUDES = doc/subarches.generated.txt doc/targets.generated.txt
DOC_SOURCES = $(filter-out $(MAN_PAGE_SOURCES) $(MAN_PAGE_INCLUDES),$(wildcard doc/*.txt))
DOCS = $(patsubst doc/%.txt,files/%.html,$(DOC_SOURCES))
DOC_SIDE_EFFECTS = files/docbook-xsl.css
EXTRA_DIST = $(MAN_PAGES) $(DOCS) $(DOC_SIDE_EFFECTS)
GENERATED_FILES = $(MAN_PAGES) $(MAN_PAGE_INCLUDES) $(DOCS) $(DOC_SIDE_EFFECTS)
distdir = catalyst-$(PACKAGE_VERSION)
all: $(EXTRA_DIST)
files:
mkdir files
$(MAN_PAGES): files/%: doc/%.txt doc/asciidoc.conf Makefile catalyst | files
a2x --conf-file=doc/asciidoc.conf --attribute="catalystversion=$(PACKAGE_VERSION)" \
--format=manpage -D files "$<"
# Additional dependencies due to inclusion
files/catalyst.1: doc/subarches.generated.txt | files
files/catalyst-spec.5: doc/subarches.generated.txt doc/targets.generated.txt | files
doc/subarches.generated.txt: $(wildcard arch/*.toml) doc/make_subarch_table_guidexml.py
./doc/make_subarch_table_guidexml.py
doc/targets.generated.txt: doc/make_target_table.py $(wildcard catalyst/targets/*.py)
PYTHONPATH=. "./$<" > "$@"
$(DOCS): files/%.html: doc/%.txt doc/asciidoc.conf Makefile | files
a2x --conf-file=doc/asciidoc.conf --attribute="catalystversion=$(PACKAGE_VERSION)" \
--format=xhtml -D files "$<"
$(DOC_SIDE_EFFECTS): $(firstword $(DOCS))
clean:
rm -f $(GENERATED_FILES)
find -name '*.pyo' -delete
check-git-repository:
git diff --quiet || { echo 'STOP, you have uncommitted changes in the working directory' ; false ; }
git diff --cached --quiet || { echo 'STOP, you have uncommitted changes in the index' ; false ; }
dist: check-git-repository $(EXTRA_DIST)
rm -Rf "$(distdir)" "$(distdir)".tar "$(distdir)".tar.bz2
mkdir "$(distdir)"
git ls-files -z | xargs -0 cp --no-dereference --parents --target-directory="$(distdir)" \
$(EXTRA_DIST)
tar cf "$(distdir)".tar "$(distdir)"
bzip2 -9v "$(distdir)".tar
rm -Rf "$(distdir)"