-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
113 lines (93 loc) · 3.25 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
# husk-scheme
# http://github.com/justinethier/husk-scheme
#
# Written by Justin Ethier
#
# Make file used to build husk and run test cases.
#
SRC=$(wildcard hs-src/Language/Scheme/*.hs hs-src/Language/Scheme/Macro/*.hs)
HUSKC_SRC=$(wildcard hs-src/Compiler/*.hs)
HUSKI_SRC=$(wildcard hs-src/Interpreter/*.hs)
GHCOPTS=-Wall --make -package parsec -package ghc
# Currently have the FFI disabled
GHCFLAGS=-f-useffi
#GHCFLAGS=
# Require for profiling, EG:
#
# +RTS -p -RTS
# or +RTS -sstderr -RTS
#
# In order to get profiling to work, the profiling flags
# also need to be enabled in ~/.cabal/config
#
#CONFIGFLAGS=--ghc-option='-rtsopts' --ghc-option='-auto-all'
CONFIGFLAGS=--ghc-option='-Wall'
#CONFIGFLAGS=
HUSKC = huskc
HUSKI = huski
UNIT_TEST_DIR = tests
# Mark targets as phony since they do not
# correspond to actual files
.PHONY: config build install sdist doc rpm test testc tags clean
all: config build install
config:
cabal configure --prefix=$(HOME) --user $(GHCFLAGS) $(CONFIGFLAGS)
build:
cabal build $(CONFIGFLAGS)
install:
cabal install $(GHCFLAGS) $(CONFIGFLAGS)
sdist:
cabal sdist
doc:
# Create API documentation
cabal haddock
# Build an RPM
rpm:
rpmbuild -ba misc/ghc-husk-scheme.spec
# Run interpreter unit tests
test:
$(HUSKI) $(UNIT_TEST_DIR)/r5rs_pitfall.scm
@cd $(UNIT_TEST_DIR) ; $(HUSKI) run-tests.scm
# @cd $(UNIT_TEST_DIR) ; $(HUSKI) run-tests7.scm
# Run compiler unit tests
testc:
@cd $(UNIT_TEST_DIR) && \
$(HUSKC) compiler-run-tests.scm && \
./compiler-run-tests # && \
# $(HUSKC) -r7 run-tests7.scm && \
# ./run-tests7
# $(HUSKC) $(UNIT_TEST_DIR)/compiler/t-basic.scm
# $(UNIT_TEST_DIR)/compiler/t-basic
# $(HUSKC) $(UNIT_TEST_DIR)/compiler/er-macro.scm
# $(UNIT_TEST_DIR)/compiler/er-macro
# Create tag files to ease souce code browsing
tags:
hasktags $(SRC) $(HUSKI_SRC) $(HUSKC_SRC)
# Delete all temporary files generated by a build
clean:
rm -f huski huskc tags TAGS
rm -rf dist tests/compiler/t-basic tests/compiler/er-macro tests/compiler-run-tests tests/*.hs tests/run-tests7
find . -type f -name "*.hi" -exec rm -f {} \;
find . -type f -name "*.o" -exec rm -f {} \;
###########################################################
# Legacy directives
###########################################################
husk: huski huskc
# Run a "simple" build using GHC directly
# ghc options for profiling: -prof -auto-all -rtsopts
huski: $(SRC) $(HUSKI_SRC)
ghc -fglasgow-exts $(GHCOPTS) -o huski $(SRC) $(HUSKI_SRC)
huskc: $(SRC) $(HUSKC_SRC)
ghc -fglasgow-exts $(GHCOPTS) -o huskc $(SRC) $(HUSKC_SRC)
# An experimental target to create a smaller, dynamically linked executable using GHC directly
# See: http://stackoverflow.com/questions/699908/making-small-haskell-executables
#
husk-small: $(SRC) $(HUSKI_SRC)
ghc $(GHCOPTS) -o huski $(SRC) $(HUSKI_SRC)
# ghc -dynamic $(GHCOPTS) -Wall --make -package parsec -package ghc -fglasgow-exts -o huski $(SRC) $(HUSKI_SRC)
strip -p --strip-unneeded --remove-section=.comment -o huski-small huski
# Create files for distribution
dist:
runhaskell Setup.hs configure --prefix=$(HOME) --user && runhaskell Setup.hs build && runhaskell Setup.hs install && runhaskell Setup.hs sdist
# Note: Use --enable-shared in the configure above, if dynamic linking will be used