-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile.pkg
More file actions
198 lines (156 loc) · 5.36 KB
/
Copy pathMakefile.pkg
File metadata and controls
198 lines (156 loc) · 5.36 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
SHELL := bash
export CDPATH=
# -------------------------------------------------------------------------
# [make all] rebuilds the tool [cfmlc] and the basis library.
# It is fast and can be used while developing these components.
# If you wish to work on the examples, then it is recommended to pin
# the packages first, by running [make pin]. If, while working on the
# examples, you find that you need to modify one of the packages, you
# should commit your changes and run [make reinstall].
.PHONY: all
all: coq-cfml-basis generator
@ echo "Okay, I have compiled the generator and the library lib/coq."
@ echo "If you want to go further, you will need to install them:"
@ echo
@ echo " opam pin add cfml ."
@ echo " opam pin add coq-cfml-basis ."
@ echo
@ echo "You should then be able to install also the standard library:"
@ echo
@ echo " opam pin add coq-cfml-stdlib ."
@ echo
@ echo "You can then work on the examples:"
@ echo
@ echo " make -C examples"
.PHONY: coq-cfml-basis
coq-cfml-basis:
$(MAKE) -C lib/coq
.PHONY: generator
generator:
$(MAKE) -C generator
# -------------------------------------------------------------------------
# Cleanup.
.PHONY: clean
clean:
$(MAKE) -C lib/coq $@
$(MAKE) -C lib/stdlib $@
$(MAKE) -C generator $@
if command -v cfmlc >/dev/null ; then $(MAKE) -C examples $@ ; fi
# -------------------------------------------------------------------------
# Compiling under various versions of Coq.
# This assumes that the opam switches coq813, coq814, etc. exist and the
# packages that we need (menhir, coq-tlc, etc.) are installed in them.
VERSIONS := \
coq814 \
coq813 \
.PHONY: versions
versions:
for v in $(VERSIONS) ; do \
opam switch $$v && eval $$(opam env) && make clean && \
make -j && \
(opam remove cfml coq-cfml-basis coq-cfml-stdlib --yes || true) && \
opam pin add cfml . --yes && \
opam pin add coq-cfml-basis . --yes && \
opam pin add coq-cfml-stdlib . --yes && \
true ; \
done
# -------------------------------------------------------------------------
# Installation.
# These commands perform direct installation, without going through opam.
install: all
$(MAKE) -C generator $@
$(MAKE) -C lib/coq $@
$(MAKE) -C lib/stdlib $@
uninstall:
$(MAKE) -C generator $@
$(MAKE) -C lib/coq $@
$(MAKE) -C lib/stdlib $@
# -------------------------------------------------------------------------
# These commands ask opam to install the packages, based on the package
# description files *.opam.
# Note that [opam pin] uses the last committed version of the code, so
# you should commit your changes before using [make pin].
# Use [OPAMYES=1 make pin] to automatically answer "yes" to every
# question asked by opam.
PACKAGES := cfml coq-cfml-basis coq-cfml-stdlib coq-cfml
.PHONY: pin
pin: unpin
@ for p in $(PACKAGES) ; do opam pin add $$p . ; done
.PHONY: unpin
unpin:
@ opam pin remove $(PACKAGES)
.PHONY: reinstall
reinstall:
@ opam reinstall $(PACKAGES)
# -------------------------------------------------------------------------
# Distribution.
# The version number is automatically set to the current date,
# unless DATE is defined on the command line.
DATE := $(shell /bin/date +%Y%m%d)
# The repository's name on gitlab.
PROJECT := cfml2
# The repository URL (https).
REPO := https://gitlab.inria.fr/charguer/$(PROJECT)
# The archive URL (https).
ARCHIVE := $(REPO)/-/archive/$(DATE)/archive.tar.gz
# The local repository directory.
PWD := $(shell pwd)
# -------------------------------------------------------------------------
# Simulating the creation of an archive by git.
.PHONY: archive
archive:
@ git archive HEAD --format=tar.gz -o $(DATE).tar.gz --prefix=$(PROJECT)/
@ tar tvfz $(DATE).tar.gz
# -------------------------------------------------------------------------
# Publish a release. (Remember to commit everything first!)
.PHONY: release
release:
# Check if everything has been committed.
@ if [ -n "$$(git status --porcelain)" ] ; then \
echo "Error: there remain uncommitted changes." ; \
git status ; \
exit 1 ; \
else \
echo "Now making a release..." ; \
fi
# Create a git tag.
@ git tag -a $(DATE) -m "Release $(DATE)."
# Upload. (This automatically makes a .tar.gz archive available on gitlab.)
@ git push
@ git push --tags
# Message.
@ echo "Done. Now (if happy) type make opam."
.PHONY: undo
undo:
# Undo the last release (assuming it was done on the same date).
@ git tag -d $(DATE)
@ git push -u origin :$(DATE)
# -------------------------------------------------------------------------
# Updating the opam package.
# This entry assumes that [make release] has been run on the same day.
# The publication command.
PUBLISH := \
opam publish -v $(DATE)
# The publication command, for a Coq package.
COQPUBLISH := \
$(PUBLISH) \
--repo coq/opam-coq-archive \
--packages-directory released/packages \
.PHONY: opam
opam:
# Check the current package descriptions.
@ opam lint
# Publish the OCaml package.
@ $(PUBLISH) cfml.opam $(ARCHIVE)
# Publish the Coq packages.
# Each package description file is patched on the fly:
# we replace the string DATEDASH with $(DATEDASH).
@ rm -f *.patched.opam
@ \
for package in coq-cfml coq-cfml-basis coq-cfml-stdlib ; do \
cat $$package.opam \
| sed -e 's/DATEDASH/$(DATEDASH)/g' \
> $$package.patched.opam ; \
done
@ $(COQPUBLISH) *.patched.opam $(ARCHIVE)
@ rm -f *.patched.opam