cryptol/Makefile

276 lines
9.0 KiB
Makefile
Raw Normal View History

HERE := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
2015-02-06 03:12:36 +03:00
2014-04-18 02:34:25 +04:00
UNAME := $(shell uname -s)
ARCH := $(shell uname -m)
TESTS ?= parser issues regression renamer mono-binds
2014-12-05 01:36:26 +03:00
TEST_DIFF ?= meld
2014-04-18 02:34:25 +04:00
2015-03-31 02:58:33 +03:00
IGNORE_EXPECTED ?= --ignore-expected
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
CABAL_BUILD_FLAGS ?= -j
CABAL_INSTALL_FLAGS ?= $(CABAL_BUILD_FLAGS)
2014-04-18 02:34:25 +04:00
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
CABAL := cabal
CABAL_BUILD := $(CABAL) build $(CABAL_BUILD_FLAGS)
CABAL_INSTALL := $(CABAL) install $(CABAL_INSTALL_FLAGS)
2015-02-06 03:12:36 +03:00
CS := $(HERE)/.cabal-sandbox
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
CS_BIN := $(CS)/bin
2014-04-18 02:34:25 +04:00
# Used only for windows, to find the right Program Files.
PROGRAM_FILES = Program\ Files\ \(x86\)
# Windows installer tools; assumes running on Cygwin and using WiX 3.8
WiX := /cygdrive/c/${PROGRAM_FILES}/WiX\ Toolset\ v3.8
2014-04-18 02:34:25 +04:00
CANDLE := ${WiX}/bin/candle.exe
HEAT := ${WiX}/bin/heat.exe
LIGHT := ${WiX}/bin/light.exe
REV ?= $(shell git rev-parse --short=7 HEAD || echo "unknown")
VERSION := $(shell grep -i ^Version cryptol.cabal | awk '{ print $$2}')
SYSTEM_DESC ?= ${UNAME}-${ARCH}_${REV}
PKG := cryptol-${VERSION}-${SYSTEM_DESC}
2014-04-18 02:34:25 +04:00
# Windows-specific stuff
ifneq (,$(findstring _NT,${UNAME}))
DIST := ${PKG}.msi
EXE_EXT := .exe
adjust-path = '$(shell cygpath -w $1)'
PREFIX ?=
# For a systemwide distribution .msi, use:
# PREFIX ?= ${PROGRAM_FILES}/Galois/Cryptol\ ${VERSION}
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
# split this up because `cabal copy` strips drive letters
PREFIX_ABS := /cygdrive/c/${PREFIX}
# since Windows installs aren't overlapping like /usr/local, we
# don't need this extra prefix
PREFIX_SHARE :=
# goes under the share prefix
PREFIX_DOC := /doc
PKG_PREFIX := ${PKG}/${PREFIX}
2015-03-05 01:53:59 +03:00
ROOT_PATH := /cygdrive/c
2014-04-18 02:34:25 +04:00
else
DIST := ${PKG}.tar.gz ${PKG}.zip
EXE_EXT :=
adjust-path = '$1'
PREFIX ?=
# For a systemwide distribution like an .rpm or .pkg, use something like:
# PREFIX ?= /usr/local
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
PREFIX_ABS := ${PREFIX}
PREFIX_SHARE := /share
# goes under the share prefix
PREFIX_DOC := /doc/cryptol
2015-02-06 03:12:36 +03:00
PKG_PREFIX := ${PKG}${PREFIX}
2015-03-05 01:53:59 +03:00
ROOT_PATH := /
2014-04-18 02:34:25 +04:00
endif
2015-02-06 03:12:36 +03:00
CRYPTOL_EXE := ./dist/build/cryptol/cryptol${EXE_EXT}
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
2014-04-18 02:34:25 +04:00
.PHONY: all
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
all: ${CRYPTOL_EXE}
.PHONY: run
run: ${CRYPTOL_EXE}
CRYPTOLPATH=$(call adjust-path,$(CURDIR)/lib) ${CRYPTOL_EXE}
2014-04-18 02:34:25 +04:00
.PHONY: docs
docs:
(cd docs; make)
.PHONY: dist
dist: ${DIST}
.PHONY: tarball
tarball: ${PKG}.tar.gz
.PHONY: zip
zip: ${PKG}.zip
.PHONY: msi
msi: ${PKG}.msi
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
# TODO: piece this apart a bit more; if right now if something fails
# during initial setup, you have to invoke this target again manually
2014-04-18 02:34:25 +04:00
${CS}:
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
$(CABAL) sandbox init
2014-04-18 02:34:25 +04:00
${CS_BIN}/alex: | ${CS}
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
$(CABAL_INSTALL) alex
2014-04-18 02:34:25 +04:00
${CS_BIN}/happy: | ${CS} ${CS_BIN}/alex
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
$(CABAL_INSTALL) happy
2014-04-18 02:34:25 +04:00
GIT_INFO_FILES :=
ifneq ("$(wildcard .git/index)","")
GIT_INFO_FILES := ${GIT_INFO_FILES} .git/index
endif
ifneq ("$(wildcard .git/HEAD)","")
GIT_INFO_FILES := ${GIT_INFO_FILES} .git/HEAD
endif
ifneq ("$(wildcard .git/packed-refs)","")
GIT_INFO_FILES := ${GIT_INFO_FILES} .git/packed-refs
endif
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
CRYPTOL_SRC := \
$(shell find src cryptol cryptol-server bench \
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
\( -name \*.hs -or -name \*.x -or -name \*.y \) \
-and \( -not -name \*\#\* \) -print) \
$(shell find lib -name \*.cry) \
${GIT_INFO_FILES}
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
print-%:
@echo $* = $($*)
2015-07-21 21:52:17 +03:00
# If CRYPTOL_SERVER is nonempty, build the cryptol-server executable
ifneq (,${CRYPTOL_SERVER})
SERVER_FLAG := -fserver
endif
# We do things differently based on whether we have a PREFIX set by
# the user. If we do, then we know the eventual path it'll wind up in
# (useful for stuff like RPMs or Homebrew). If not, we try to be as
# relocatable as possible.
ifneq (,${PREFIX})
PREFIX_ARG := --prefix=$(call adjust-path,${PREFIX_ABS})
DESTDIR_ARG := --destdir=${PKG}
CONFIGURE_ARGS := -f-relocatable -f-self-contained \
2015-07-21 21:52:17 +03:00
--docdir=$(call adjust-path,${PREFIX}/${PREFIX_SHARE}/${PREFIX_DOC}) \
${SERVER_FLAG}
else
# This is kind of weird: 1. Prefix argument must be absolute; Cabal
# doesn't yet fully support relocatable packages. 2. We have to
# provide *some* prefix here even if we're not using it, otherwise
# `cabal copy` will make a mess in the PKG directory.
PREFIX_ARG := --prefix=$(call adjust-path,${ROOT_PATH})
DESTDIR_ARG := --destdir=${PKG}
CONFIGURE_ARGS := -f-self-contained \
2015-07-21 21:52:17 +03:00
--docdir=$(call adjust-path,${PREFIX_SHARE}/${PREFIX_DOC}) \
${SERVER_FLAG}
endif
dist/setup-config: cryptol.cabal Makefile | ${CS_BIN}/alex ${CS_BIN}/happy
2015-07-28 23:30:20 +03:00
$(CABAL_INSTALL) --only-dependencies ${SERVER_FLAG}
$(CABAL) configure ${PREFIX_ARG} --datasubdir=cryptol \
${CONFIGURE_ARGS}
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
${CRYPTOL_EXE}: $(CRYPTOL_SRC) dist/setup-config
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
$(CABAL_BUILD)
PKG_BIN := ${PKG_PREFIX}/bin
PKG_SHARE := ${PKG_PREFIX}${PREFIX_SHARE}
PKG_CRY := ${PKG_SHARE}/cryptol
PKG_DOC := ${PKG_SHARE}${PREFIX_DOC}
PKG_EXAMPLES := ${PKG_DOC}/examples
PKG_EXCONTRIB := ${PKG_EXAMPLES}/contrib
PKG_EXAMPLE_FILES := docs/ProgrammingCryptol/aes/AES.cry \
docs/ProgrammingCryptol/enigma/Enigma.cry \
examples/DES.cry \
examples/Cipher.cry \
examples/DEStest.cry \
examples/Test.cry \
examples/SHA1.cry \
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
PKG_EXCONTRIB_FILES := examples/contrib/mkrand.cry \
examples/contrib/RC4.cry \
examples/contrib/simon.cry \
examples/contrib/speck.cry
2015-09-28 23:58:39 +03:00
${PKG}: ${CRYPTOL_EXE}
${PKG_BIN}/cryptol: ${CRYPTOL_EXE} \
docs/*.md docs/*.pdf LICENSE LICENSE.rtf \
${PKG_EXAMPLE_FILES} ${PKG_EXCONTRIB_FILES}
$(CABAL) copy ${DESTDIR_ARG} && \
mkdir -p ${PKG_CRY} && \
mkdir -p ${PKG_DOC} && \
mkdir -p ${PKG_EXAMPLES} && \
mkdir -p ${PKG_EXCONTRIB} && \
cp docs/*.md ${PKG_DOC} && \
cp docs/*.pdf ${PKG_DOC} && \
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
for EXAMPLE in ${PKG_EXAMPLE_FILES}; do \
cp $$EXAMPLE ${PKG_EXAMPLES}; done && \
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
for EXAMPLE in ${PKG_EXCONTRIB_FILES}; do \
cp $$EXAMPLE ${PKG_EXCONTRIB}; done
# cleanup unwanted files
# don't want to bundle the cryptol library in the binary distribution
rm -rf ${PKG_PREFIX}/lib; rm -rf ${PKG_PREFIX}/*windows-ghc*
2015-03-25 23:25:32 +03:00
# don't ship haddock
rm -rf ${PKG_DOC}/html
2014-04-18 02:34:25 +04:00
.PHONY: install
install: ${PKG}
[ -n "${PREFIX}" ] \
|| (echo "[error] Can't install without PREFIX set"; false)
(cd ${PKG_PREFIX}; \
find . -type d -exec install -d ${PREFIX}/{} \; ; \
find bin -not -type d -exec install -m 755 {} ${PREFIX}/{} \; ; \
find share -not -type d -exec install -m 644 {} ${PREFIX}/{} \;)
2014-04-18 02:34:25 +04:00
${PKG}.tar.gz: ${PKG}
tar -czvf $@ $<
${PKG}.zip: ${PKG}
zip -r $@ $<
${PKG}.msi: ${PKG} win32/cryptol.wxs
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
${HEAT} dir ${PKG_PREFIX} -o allfiles.wxs -nologo -var var.pkg \
-ag -wixvar -cg ALLFILES -srd -dr INSTALLDIR -sfrag
${CANDLE} -ext WixUIExtension -ext WixUtilExtension \
-dversion=${VERSION} -dpkg=${PKG_PREFIX} win32/cryptol.wxs
${CANDLE} -ext WixUIExtension -ext WixUtilExtension \
-dversion=${VERSION} -dpkg=${PKG_PREFIX} allfiles.wxs
${LIGHT} -ext WixUIExtension -ext WixUtilExtension \
-sval -o $@ cryptol.wixobj allfiles.wixobj
2014-04-18 02:34:25 +04:00
rm -f allfiles.wxs
rm -f *.wixobj
rm -f *.wixpdb
${CS_BIN}/cryptol-test-runner: \
$(CURDIR)/tests/Main.hs \
$(CURDIR)/tests/cryptol-test-runner.cabal
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
$(CABAL_INSTALL) ./tests
2014-04-18 02:34:25 +04:00
.PHONY: test
test: ${CS_BIN}/cryptol-test-runner ${PKG_BIN}/cryptol
2014-04-18 02:34:25 +04:00
( cd tests && \
echo "Testing on $(UNAME)-$(ARCH)" && \
$(realpath $(CS_BIN)/cryptol-test-runner) \
$(TESTS) \
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
-c $(call adjust-path,${CURDIR}/${PKG_BIN}/cryptol${EXE_EXT}) \
2014-04-18 02:34:25 +04:00
-r output \
-T --hide-successes \
-T --jxml=$(call adjust-path,$(CURDIR)/results.xml) \
2015-03-31 02:58:33 +03:00
$(IGNORE_EXPECTED) \
$(if $(TEST_DIFF),-p $(TEST_DIFF),) \
2014-04-18 02:34:25 +04:00
)
2015-09-28 23:58:39 +03:00
print-%:
@echo "$* = $($*)"
# Since this is meant for development rather than end-user builds,
# this tries to stay out of the way of the other targets by
# reconfiguring, then removing dist/setup-config so that other targets
# aren't left in a weird state
.PHONY: bench
bench: cryptol.cabal Makefile | ${CS_BIN}/alex ${CS_BIN}/happy
$(CABAL_INSTALL) --only-dependencies --enable-benchmarks
$(CABAL) configure --enable-benchmarks
$(CABAL) bench --benchmark-option=--junit --benchmark-option=$(call adjust-path,$(CURDIR)/bench.xml)
rm -rf dist/setup-config
2014-04-18 02:34:25 +04:00
.PHONY: clean
clean:
cabal clean
rm -f $(CS_BIN)/cryptol-test-suite
rm -rf cryptol-${VERSION}*/
rm -rf cryptol-${VERSION}*.tar.gz
rm -rf cryptol-${VERSION}*.zip
rm -rf cryptol-${VERSION}*.msi
.PHONY: squeaky
squeaky: clean
Fixes #172 There's now a more sensible hierarchy of locations that Cryptol uses to look for modules. By default, in order it looks for libraries in: 1. The directories specified in the CRYPTOLPATH environment variable 2. The current directory 3. The user data directory (something like `$HOME/.cryptol`) 4. Relative to the executable's install directory 5. The static path used when building the executable (cabal's data-dir) There is also a new command-line flag for the interpreter: `--cryptolpath-only` which makes the interpreter ignore locations 2-5. This commit also reworks the Makefile and build/release process. These are bunched together because they play off each other quite a bit; the build/release process determines the location of the `Cryptol.cry`, which must be found when looking for modules. Rather than leaning on `cabal install`, we now use a combination of `cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots to this: - More of the release staging is handled by cabal -- we don't have to go in and manually copy things out of the sandbox. In fact, the `cryptol` executable never goes into the sandbox. - The testing infrastructure runs on executables that are in place in the staging directory, rather than in the sandbox. This should be more hygienic and realistic. - The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to better reflect the common POSIX structure. This means Cryptol will play nicer in global installs, and mirrors what other interpreted languages do. - The default build settings use a prefix of `/usr/local` rather than using the sandbox directory. This makes them more relocatable for binary distributions. Set PREFIX= before making to change this.
2015-01-22 02:03:16 +03:00
-$(CABAL) sandbox delete
2015-09-15 23:38:06 +03:00
(cd docs; make squeaky)
2014-04-18 02:34:25 +04:00
rm -rf dist
rm -rf tests/dist