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

new Makefile structure to use to generated Makefile for more jobs

parent d113f960
No related branches found
No related tags found
1 merge request!4More use of generated makefile
Pipeline #121582 failed
......@@ -13,5 +13,5 @@ Makefile.coq
Makefile.coq.conf
.Makefile.coq.d
.coq-html.mk
public/*
html/*
_CoqProject
......@@ -2,33 +2,28 @@
#TODO Change the following lines for configuration.
PROJNAME = CoMoProj
HTMLDIR = public/
COMPONENTS := src:SRC
COQDOC_FLAGS = --utf8
all: coq html _CoqProject
all: coq html
coq: Makefile.coq
$(MAKE) -f Makefile.coq all
Makefile.coq: _CoqProject Makefile
html: Makefile.coq
$(MAKE) -f Makefile.coq html
Makefile.coq: _CoqProject
coq_makefile -f $< -o $@
GENERATED_HTML = .coq-html.mk
clean: Makefile.coq $(SRC)
clean: Makefile.coq
$(MAKE) -f $< cleanall
rm -f Makefile.coq
rm -f Makefile.coq.conf
rm -f .Makefile.coq.d
rm -f _CoqProject
clean_html: clean $(HTMLDIR)
rm -f $(GENERATED_HTML)
rm -f -r $(HTMLDIR)
clean_all: clean clean_html
define GENCoqPr
BEGIN { RS="[[:space:]]"; FS=":" }\
{ \
......@@ -46,46 +41,4 @@ endef
_CoqProject: Makefile
echo $(COMPONENTS) | awk '$(GENCoqPr)' > $@
$(HTMLDIR):
mkdir -p $(HTMLDIR)
html: $(HTMLDIR)/toc.html
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
.PHONY: all coq html clean
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