Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate.sh -> Makefile #12

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*~
.DS_Store
13 changes: 13 additions & 0 deletions Makefile.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
TEMPLATES ?= templates

index.html: index.md
@echo "Generating $@..."
pandoc -s -o $@ $<

%.opam: meta.yml $(TEMPLATES)/coq.opam.mustache
@echo "Generating $@..."
mustache $^ > $@

%: meta.yml $(TEMPLATES)/%.mustache
@echo "Generating $@..."
mustache $^ > $@
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ Other projects using the templates in a similar way include

You can generate the standard files from the templates, provided
you have already written `meta.yml`, in the following way:
```shell
cd <your_coq_project> && cd ..
git clone https://github.com/coq-community/templates.git
cd -
../templates/generate.sh
git add <the_generated_files>
```

1. Clone https://github.com/coq-community/templates.git as subdirectory or submodule.
2. Include [`Makefile.meta`](Makefile.meta) in your `Makefile`.
3. (Optional) Add rules for extracted OPAM file.
4. Specify build targets.

See [example](example) for more details.

Keeping generated files under version control is not ideal, but `README.md` has to exist,
and generally this is a common practice when using build systems such as Autotools.
To get a `mustache` tool in, e.g., NixOS, you can run `nix-env -i mustache-go`.
Expand Down
6 changes: 6 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.travis.yml
README.md
coq-chapar-stores.opam
coq-chapar.opam
default.nix
index.html
20 changes: 20 additions & 0 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
TEMPLATES ?= templates

TARGETS= \
.travis.yml \
README.md \
coq-chapar.opam \
coq-chapar-stores.opam \
default.nix \
index.html

all: $(TARGETS)

clean:
$(RM) $(TARGETS)

coq-chapar-stores.opam: meta.yml $(TEMPLATES)/extracted.opam.mustache
@echo "Generating $@..."
mustache $^ > $@

include $(TEMPLATES)/Makefile.meta
Loading