-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from hvr/pr/issue-123
Improve Makefile
- Loading branch information
Showing
3 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,47 @@ | ||
CABAL = cabal | ||
|
||
HAPPY = happy | ||
HAPPY_OPTS = -agc | ||
|
||
ALEX = alex | ||
ALEX_OPTS = -g | ||
ALEX_VER = `awk '/^version:/ { print $$2 }' alex.cabal` | ||
|
||
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 Tree is not clean; \ | ||
echo "Error: Tree is not clean"; \ | ||
exit 1; \ | ||
fi | ||
rm -rf dist/ | ||
$(HAPPY) $(HAPPY_OPTS) src/Parser.y -o src/Parser.hs | ||
$(ALEX) $(ALEX_OPTS) src/Scan.x -o src/Scan.hs | ||
mv src/Parser.y src/Parser.y.boot | ||
mv src/Scan.x src/Scan.x.boot | ||
cabal new-run gen-alex-sdist | ||
cabal sdist | ||
$(CABAL) new-run gen-alex-sdist | ||
$(CABAL) sdist | ||
@if [ ! -f "dist/alex-$(ALEX_VER).tar.gz" ]; then \ | ||
echo "Error: source tarball not found: dist/alex-$(ALEX_VER).tar.gz"; \ | ||
exit 1; \ | ||
fi | ||
git checkout . | ||
git clean -f | ||
|
||
sdist-test :: sdist sdist-test-only | ||
@rm -rf "dist/alex-$(ALEX_VER)/" | ||
|
||
sdist-test-only :: | ||
@if [ ! -f "dist/alex-$(ALEX_VER).tar.gz" ]; then \ | ||
echo "Error: source tarball not found: dist/alex-$(ALEX_VER).tar.gz"; \ | ||
exit 1; \ | ||
fi | ||
rm -rf "dist/alex-$(ALEX_VER)/" | ||
tar -xf "dist/alex-$(ALEX_VER).tar.gz" -C dist/ | ||
echo "packages: ." > "dist/alex-$(ALEX_VER)/cabal.project" | ||
cd "dist/alex-$(ALEX_VER)/" && cabal new-test --enable-tests all | ||
@echo "" | ||
@echo "Success! dist/alex-$(ALEX_VER).tar.gz is ready for distribution!" | ||
@echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters