Makefile 2.01 KB
Newer Older
1 2
# ------------------------------------------------------------------------------

3 4 5
# The name of the library.
THIS     := fix

6 7 8 9 10 11 12 13 14 15 16 17
# 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 URL (https).
REPO     := https://gitlab.inria.fr/fpottier/$(THIS)

# The archive URL (https).
ARCHIVE  := $(REPO)/repository/$(DATE)/archive.tar.gz

# ------------------------------------------------------------------------------

18 19 20 21 22 23 24 25 26 27
.PHONY: all
all:
	dune build -p $(THIS)

.PHONY: install
install: all
	dune install -p $(THIS)

.PHONY: clean
clean:
28
	rm -f *~ src/*~
29 30 31 32 33 34 35 36
	dune clean

.PHONY: uninstall
uninstall:
	ocamlfind remove $(THIS) || true

.PHONY: reinstall
reinstall: uninstall
37 38
	@ make install

POTTIER Francois's avatar
POTTIER Francois committed
39 40 41 42
.PHONY: show
show: reinstall
	@ echo "#require \"fix\";;\n#show Fix;;" | ocaml

POTTIER Francois's avatar
POTTIER Francois committed
43 44 45 46 47 48 49 50
.PHONY: pin
pin:
	opam pin add $(THIS) .

.PHONY: unpin
unpin:
	opam pin remove $(THIS)

POTTIER Francois's avatar
POTTIER Francois committed
51 52 53 54
# This requires a version of headache that supports UTF-8; please use
# https://github.com/fpottier/headache

HEADACHE := headache
55
LIBHEAD  := $(shell pwd)/headers/library-header
POTTIER Francois's avatar
POTTIER Francois committed
56 57 58 59
FIND     := $(shell if command -v gfind >/dev/null ; then echo gfind ; else echo find ; fi)

.PHONY: headache
headache:
60
	@ $(FIND) src -regex ".*\.ml\(i\|y\|l\)?" \
POTTIER Francois's avatar
POTTIER Francois committed
61 62
	    -exec $(HEADACHE) -h $(LIBHEAD) "{}" ";"

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
.PHONY: release
release:
# Make sure the current version can be compiled and installed.
	@ make uninstall
	@ make clean
	@ make install
# Check the current package description.
	@ opam lint
# 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

.PHONY: publish
publish:
# Publish an opam description.
88
	@ opam publish -v $(DATE) $(THIS) $(ARCHIVE) .