GNUmakefile 2.58 KB
Newer Older
POTTIER Francois's avatar
POTTIER Francois committed
1 2 3 4 5 6 7
# -------------------------------------------------------------------------

# Private Makefile for package maintenance.

SHELL := bash
export CDPATH=

POTTIER Francois's avatar
POTTIER Francois committed
8
.PHONY: package export opam submit pin unpin
POTTIER Francois's avatar
POTTIER Francois committed
9 10 11 12 13 14 15 16 17 18 19 20 21

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

include Makefile

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

# 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)

POTTIER Francois's avatar
POTTIER Francois committed
22
# The project name on gitlab.
POTTIER Francois's avatar
POTTIER Francois committed
23
PROJECT  := cfml
POTTIER Francois's avatar
POTTIER Francois committed
24 25
# The opam package name.
PACKAGE  := coq-$(PROJECT)
POTTIER Francois's avatar
POTTIER Francois committed
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
# The repository URL (https).
REPO     := https://gitlab.inria.fr/charguer/$(PROJECT)
# The archive URL (https).
ARCHIVE  := $(REPO)/repository/$(DATE)/archive.tar.gz
# The local repository directory.
PWD      := $(shell pwd)

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

# Prepare a release.

package:
# Make sure the correct version can be installed.
	@ make reinstall

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

# Publish a release. (Remember to commit everything first!)

export:
# 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

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

# Updating the opam package.

# This entry assumes that "make package" and "make export"
# have just been run (on the same day).

POTTIER Francois's avatar
POTTIER Francois committed
67 68 69 70
# You need opam-publish:
#   sudo apt-get install libssl-dev
#   opam install tls opam-publish

71 72 73 74 75 76
# In fact, you need a version of opam-publish that supports --subdirectory:
#   git clone git@github.com:fpottier/opam-publish.git
#   cd opam-publish
#   git checkout 1.3
#   opam pin add opam-publish `pwd` -k git

POTTIER Francois's avatar
POTTIER Francois committed
77 78 79
# The following command should have been run once:
#   opam-publish repo add opam-coq-archive coq/opam-coq-archive

80 81 82 83
PUBLISH_OPTIONS := \
  --repo opam-coq-archive \
  --subdirectory released \

POTTIER Francois's avatar
POTTIER Francois committed
84
opam:
85 86
	@ opam lint
	@ opam-publish prepare $(PUBLISH_OPTIONS) $(PACKAGE).$(DATE) $(ARCHIVE)
POTTIER Francois's avatar
POTTIER Francois committed
87

POTTIER Francois's avatar
POTTIER Francois committed
88
submit:
89
	@ opam-publish submit $(PUBLISH_OPTIONS) $(PACKAGE).$(DATE)
POTTIER Francois's avatar
POTTIER Francois committed
90

POTTIER Francois's avatar
POTTIER Francois committed
91 92 93 94 95
# -------------------------------------------------------------------------

# Pinning.

pin:
POTTIER Francois's avatar
POTTIER Francois committed
96
	opam pin add $(PACKAGE) `pwd` -k git
POTTIER Francois's avatar
POTTIER Francois committed
97 98

unpin:
POTTIER Francois's avatar
POTTIER Francois committed
99
	opam pin remove $(PACKAGE)