File: Makefile

package info (click to toggle)
bnfc 2.9.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,300 kB
  • sloc: haskell: 16,920; yacc: 240; makefile: 91
file content (92 lines) | stat: -rw-r--r-- 2,565 bytes parent folder | download
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
# GHC major.minor
GHC_VERSION := $(shell ghc --numeric-version | cut -d. -f1-2)
BNFC_VERSION=$(shell sed -ne "s/^[Vv]ersion: *\([0-9.]*\).*/\1/p" BNFC.cabal)

# Cabal options (to be overwritten from the command line)
CABAL_OPTS           =
CABAL_BUILDDIR_SUFFIX=
CABAL_BUILD_OPTS     = --enable-tests
# --builddir=dist-ghc-$(GHC_VERSION)$(CABAL_BUILDDIR_SUFFIX)
CABAL_CONFIGURE_OPTS = --enable-tests
CABAL_INSTALL_OPTS   = --overwrite-policy=always
CABAL_TEST_OPTS      = $(CABAL_BUILD_OPTS)

CABAL                = cabal $(CABAL_OPTS)
CABAL_CONFIGURE      = $(CABAL) configure $(CABAL_CONFIGURE_OPTS)
CABAL_BUILD          = $(CABAL) build     $(CABAL_BUILD_OPTS)
CABAL_INSTALL        = $(CABAL) install   $(CABAL_INSTALL_OPTS)
CABAL_TEST           = $(CABAL) test      $(CABAL_TEST_OPTS)

# Name for binary distribution (e.g. bnfc-2.4.5-linux32)
BDIST_TAG=bnfc-${BNFC_VERSION}-$(shell uname -s)-$(shell uname -m)

.PHONY: default build install doc test bdist show-version debug weed TAGS

default: build cabal-test doctest-quick

build:
	$(CABAL_BUILD)

install:
	$(CABAL_INSTALL)

test: build cabal-test doctest

cabal-test:
	$(CABAL_TEST)

doctest: build doctest-install doctest-quick

doctest-install:
	cabal install doctest --ignore-project --program-suffix=-${GHC_VERSION}

doctest-quick:
	cabal repl -w doctest-${GHC_VERSION} --repl-options=-Wno-type-defaults
# --ghc-options=-Wno-type-defaults needed due to OverloadedStrings.
# But it does not get used here, needs to go into cabal file.
# see: https://github.com/sol/doctest/issues/390
# --repl-options seems to work, though

haddock:
	$(CABAL) haddock

# See https://hackage.haskell.org/package/weeder
# weeder can find dead code starting from the .hie files
weed:
	$(CABAL) build --project-file=cabal.project.local
	weeder

TAGS :
	hasktags --etags .

# Binary package (tgz, for linux)
bdist: dist/${BDIST_TAG}.tar.gz

# Source package
# Andreas, 2023-11-03, PR #466: need to remove BNFC/{Lex,Par}.hs,
# otherwise they will be shipped in the sdist package
# and cause compilation to fail.
sdist:
	make -C src clean
	cabal sdist

# OLD goal
dist/%.tar.gz:
	cabal v1-clean
	cabal v1-install ${CABAL_OPTS} --only-dependencies
	cabal v1-configure ${CABAL_OPTS} --prefix=/
	cabal v1-build ${CABAL_OPTS}
	cabal v1-copy --destdir=dist/install
	mkdir dist/$*
	cp dist/install/bin/bnfc dist/$*
	cp LICENSE dist/$*
	tar -cvz -C dist $* > $@

# Print the bnfc version from the cabal file
show-version:
	@echo ${BNFC_VERSION}

debug:
	@echo GHC_VERSION  = $(GHC_VERSION)
	@echo BNFC_VERSION = $(BNFC_VERSION)
# EOF