Skip to content
Snippets Groups Projects
Commit d113f960 authored by Max Ole Elliger's avatar Max Ole Elliger :penguin:
Browse files

Merge branch 'more_folder_extension' into 'main'

Improved Makefile structure

See merge request oc59yqul/template_coq!3
parents 4fe47f9f 1475e10a
Branches main
No related tags found
1 merge request!3Improved Makefile structure
Pipeline #122704 passed
......@@ -12,5 +12,6 @@ lia.cache
Makefile.coq
Makefile.coq.conf
.Makefile.coq.d
.coq-html.mk
public/*
_CoqProject
#TODO: Die folgenden 4 Zeilen konfigurieren.
SRC := src
MODULES :=
LIB := CoMoProj
HTML := public
# Configuration
VS := $(MODULES:%=$(SRC)/%.v)
#TODO Change the following lines for configuration.
PROJNAME = CoMoProj
HTMLDIR = public/
COMPONENTS := src:SRC
.PHONY: all html coq clean clean_html clean_all
COQDOC_FLAGS = --utf8
all: coq html _CoqProject
html: coq $(SRC)
mkdir -p public
coqdoc -R $(SRC) $(LIB) $(VS) -d $(HTML) \
-utf8 --lib-name File --toc
coq: Makefile.coq
$(MAKE) -f Makefile.coq all
clean: $(SRC)
rm -f $(SRC)/*.vo
rm -f $(SRC)/*.vok
rm -f $(SRC)/*.vos
rm -f $(SRC)/*.glob
rm -f $(SRC)/.*.aux
Makefile.coq: _CoqProject Makefile
coq_makefile -f $< -o $@
GENERATED_HTML = .coq-html.mk
clean: Makefile.coq $(SRC)
$(MAKE) -f $< cleanall
rm -f Makefile.coq
rm -f Makefile.coq.conf
rm -f .Makefile.coq.d
rm -f _CoqProject
clean_html: clean
rm -f -r $(HTML)
clean_html: clean $(HTMLDIR)
rm -f $(GENERATED_HTML)
rm -f -r $(HTMLDIR)
clean_all: clean clean_html
$(SRC):
mkdir -p $(SRC)
define GENCoqPr
BEGIN { RS="[[:space:]]"; FS=":" }\
{ \
dirname = $$1; \
libname = $$2; \
print "-R " dirname " " libname; \
find = "find " dirname " -name '*.v' -maxdepth 1"; \
while ((find | getline) > 0) { \
print; \
} \
close(find); \
}
endef
_CoqProject: Makefile
echo "-R $(SRC) $(LIB)\n\n$(SRC)" > _CoqProject
echo $(COMPONENTS) | awk '$(GENCoqPr)' > $@
$(HTMLDIR):
mkdir -p $(HTMLDIR)
html: $(HTMLDIR)/toc.html
Makefile.coq: Makefile $(VS) $(SRC)
@coq_makefile -o Makefile.coq -R $(SRC) $(LIB) $(VS)
define GENIndex
BEGIN { \
print "<html><body><h1>Table of Contents for $(PROJNAME)</h1>"; \
}\
{\
printf("<h2><a href=\"%s.html\">%s</a></h2>\n", $$1, $$1);\
}
endef
$(HTMLDIR)/toc.html: $(HTMLDIR)
find $(HTMLDIR) -name '*.html' -print0 | xargs -0 basename -a -s .html | grep -Fxv 'toc' | sort | awk '$(GENIndex)' > $@
define GENMakefile
BEGIN { RS="[[:space:]]"; FS=":" } \
{ \
dirname = $$1; \
libname = $$2; \
find = "find " dirname " -name '*.v' -maxdepth 1"; \
while ((find | getline line) > 0) { \
match(line, /\/([^\/]+).v/, part); \
html = HTMLDIR libname "." part[1] ".html"; \
print html ": " line " " HTMLDIR; \
print "\tcoqdoc -o $$@ $$< --lib-name $(PROJNAME) $(COQDOC_FLAGS)";\
htmls = htmls " " html; \
} \
close(find); \
} \
END { \
print "html:" htmls; \
print HTMLDIR "/toc.html: " htmls; \
}
endef
$(GENERATED_HTML): Makefile $(HTMLDIR)
echo $(COMPONENTS) | awk -v HTMLDIR="$(HTMLDIR)" '$(GENMakefile)' > $@
-include $(GENERATED_HTML)
.PHONY: all html coq clean clean_html clean_all
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment