git @ Cat's Eye Technologies Robin / 7caed2e
Have the Makefile use cabal, if available, to build the executable. Chris Pressey 3 years ago
4 changed file(s) with 24 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
44 exe: pkg/stdlib.robin bin/$(PROG).exe
55
66 bin/$(PROG).exe:
7 ifeq (, $(shell command -v ghc 2>/dev/null))
8 echo "ghc not found in PATH, skipping exe build"
7 ifneq (, $(shell command -v cabal 2>/dev/null))
8 cabal v2-build $(PROG)
9 cp -p `find dist-newstyle/ -name $(PROG) -executable -type f` bin/$(PROG).exe
910 else
11 ifneq (, $(shell command -v ghc 2>/dev/null))
1012 (cd src && ghc --make Main.hs -o ../bin/$(PROG).exe)
13 else
14 echo "neither cabal nor ghc found in PATH, skipping exe build"
15 endif
1116 endif
1217
1318 # For the web build to work, you need parsec installed in a way where haste can use it:
4449 find . -name '*.hi' -exec rm {} \;
4550 find . -name '*.jsmod' -exec rm {} \;
4651 find pkg -name '*.robin' -exec rm {} \;
52 rm -rf dist-newstyle
53 rm -f .ghc.environment.*
2828 To use it, you'll need an implementation of Haskell installed (typically either
2929 `ghc` or Hugs).
3030
31 First, clone this repository and `cd` into the repo directory.
31 First, clone this repository and `cd` into the repo directory. Then run
3232
33 If you have `cabal` installed you can run
33 make
3434
35 cabal v2-build
35 If you have `cabal` installed, the Makefile will use it to build the `robin`
36 executable, and this will take care of obtaining and building the dependencies.
3637
37 and the executable will be built somewhere under `dist-newstyle`. The driver
38 script `bin/robin` will look for it and execute it.
38 If you do not have `cabal`, the Makefile will use `ghc` directly to build the
39 executable, but in this case, you will need to ensure you have dependencies
40 like `parsec` and `random` installed, yourself.
3941
40 If you do not have `cabal`, you can run
42 (If you don't have `ghc` at all, no executable will be built; but that's OK,
43 because in this case the `bin/robin` driver script will fall back to using
44 `runhaskell` or `runhugs` instead.)
4145
42 make exe
46 In any case, the Makefile will also build build the standard library
47 (`pkg/stdlib.robin`). And this same Makefile can be used to build the
48 JavaScript version of the interpreter, with `make web`.
4349
44 to build the reference interpreter. (Note that in this case, you will need
45 to ensure you have dependencies like `parsec` and `random` installed, yourself.)
46 It will also build the standard library (`pkg/stdlib.robin`). This same
47 Makefile can be used to build the JavaScript version of the interpreter, with
48 `make web`.
49
50 If you don't have `ghc` at all, no executable will be built; but that's OK,
51 because in this case the `bin/robin` script will fall back to using
52 `runhaskell` or `runhugs` instead.
53
54 After building (if you can), you can run the Robin interpreter using the
50 After running `make`, you can run the Robin interpreter using the
5551 driver script in `bin`, on one of the example Robin sources in `eg` like so:
5652
5753 bin/robin pkg/stdlib.robin eg/hello-world.robin
77 exec runhugs -i$SRC $SRC/HugsMain.hs $*
88 elif [ -x $DIR/$NAME.exe ] ; then
99 exec $DIR/$NAME.exe $*
10 elif [ -d $DIR/../dist-newstyle/ ]; then
11 EXE=`find $DIR/../dist-newstyle/ -name $NAME -executable -type f`
12 exec $EXE $*
1310 elif command -v runhaskell 2>&1 >/dev/null ; then
1411 exec runhaskell -i$SRC $SRC/Main.hs $*
1512 elif command -v runhugs 2>&1 >/dev/null ; then
1414 if [ -x "bin/robin.exe" ]; then
1515 APPLIANCES="${APPLIANCES} appliances/robin.exe.md appliances/robin.exe-no-builtins.md"
1616 fi
17 if [ -d dist-newstyle ]; then
18 APPLIANCES="${APPLIANCES} appliances/cabal-v2-run-robin.md"
19 fi
2017 if command -v runhugs 2>&1 >/dev/null ; then
2118 APPLIANCES="${APPLIANCES} appliances/runhugs-robin.md"
2219 fi
20 echo "Implementations under test: ${APPLIANCES}"
2321 fi
2422
2523 if [ "${FALDERAL}x" = "x" ]; then