forked from haskell/happy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (40 loc) · 1.52 KB
/
Makefile
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
CABAL = cabal
HAPPY_VER = `awk '/^version:/ { print $$2 }' happy.cabal`
SDIST_DIR=dist-newstyle/sdist
sdist ::
@case "`$(CABAL) --numeric-version`" in \
2.[2-9].* | [3-9].* ) ;; \
* ) echo "Error: needs cabal 2.2.0.0 or later (but got : `$(CABAL) --numeric-version`)" ; exit 1 ;; \
esac
@if [ "`git status -s`" != '' ]; then \
echo "Error: Tree is not clean"; \
exit 1; \
fi
$(CABAL) v2-sdist all
@if [ ! -f "${SDIST_DIR}/happy-$(HAPPY_VER).tar.gz" ]; then \
echo "Error: source tarball not found: dist/happy-$(HAPPY_VER).tar.gz"; \
exit 1; \
fi
git checkout .
git clean -f
sdist-test :: sdist sdist-test-only
@rm -rf "${SDIST_DIR}/happy-${HAPPY_VER}/"
sdist-test-only ::
@if [ ! -f "${SDIST_DIR}/happy-$(HAPPY_VER).tar.gz" ]; then \
echo "Error: source tarball not found: ${SDIST_DIR}/happy-$(HAPPY_VER).tar.gz"; \
exit 1; \
fi
rm -rf "${SDIST_DIR}/happy-$(HAPPY_VER)/"
tar -xf "${SDIST_DIR}/happy-$(HAPPY_VER).tar.gz" -C ${SDIST_DIR}/
echo "packages: ." > "${SDIST_DIR}/happy-$(HAPPY_VER)/cabal.project"
echo "tests: True" >> "${SDIST_DIR}/happy-$(HAPPY_VER)/cabal.project"
cd "${SDIST_DIR}/happy-$(HAPPY_VER)/" \
&& cabal v2-build all --flag -bootstrap \
&& cabal v2-install --flag -bootstrap --installdir="./bootstrap-root" \
&& cabal v2-test all -j --flag -bootstrap \
&& export PATH=./bootstrap-root:$$PATH \
&& cabal v2-build all --flag +bootstrap \
&& cabal v2-test all -j --flag +bootstrap
@echo ""
@echo "Success! ${SDIST_DIR}/happy-$(HAPPY_VER).tar.gz is ready for distribution!"
@echo ""