forked from nominolo/scion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
75 lines (56 loc) · 1.89 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
.PHONY: default clean install-lib install-deps setup
default: all
all: build
include config.mk
# If not set in custom config.mk, use the default versions
HC ?= ghc
PKG ?= ghc-pkg
HADDOCK ?= haddock
DIST = dist
DIST_LIB = $(DIST)/lib
DIST_SERVER = $(DIST)/server
SETUP_DIST = setup-dist
SETUP = $(SETUP_DIST)/Setup
DOTDOTSETUP = cabal
CABAL_INSTALL_OPTS += --ghc --with-compiler=$(HC) --with-hc-pkg=$(PKG)
CABAL_FLAGS ?=
# -ftesting
$(DIST)/setup-config: $(SETUP) scion.cabal $(DIST)
$(SETUP) configure -v --builddir=$(DIST) \
--with-compiler=$(HC) --with-hc-pkg=$(PKG) \
--user $(CABAL_FLAGS) > $(DIST)/lib-config-log
$(DIST)/build/libHSscion-0.1.a: $(SETUP) $(DIST)/setup-config $(wildcard lib/**/*.hs lib/**/**/*.hs server/**/*.hs)
@echo === Building scion ===
$(SETUP) build --builddir=$(DIST)
$(DIST):
mkdir $(DIST)
$(SETUP): Setup.hs $(SETUP_DIST)
$(HC) --make $< -o $@
$(SETUP_DIST):
mkdir $@
setup: $(SETUP)
build: $(DIST)/build/libHSscion-0.1.a
# TODO: dodgy
install: $(DIST)/build/libHSscion-0.1.a
cabal install
# test: build
# echo main | $(HC) --interactive -package ghc -DDEBUG -isrc -idist/build tests/RunTests.hs
# # ./dist/build/test_get_imports/test_get_imports $(GHC_PATH)/compiler dist-stage2 +RTS -s -RTS
clean:
$(SETUP) clean --builddir=$(DIST) || rm -rf $(DIST)
distclean: clean
rm -rf $(SETUP_DIST)
# doc: configure
# $(SETUP) haddock --with-haddock=$(HADDOCK)
printvars:
@echo "UseInplaceGhc = $(UseInplaceGhc)"
@echo "GHC_PATH = $(GHC_PATH)"
@echo "HC = $(HC)"
@echo "PKG = $(PKG)"
@echo "HADDOCK = $(HADDOCK)"
@echo "CABAL_INSTALL = $(CABAL_INSTALL)"
@echo " ..._OPTS = $(CABAL_INSTALL_OPTS)"
@echo "CABAL_FLAGS = $(CABAL_FLAGS)"
@echo "---------------------------------------------------------------"
@echo "DIST_LIB = $(DIST_LIB)"
@echo "SETUP_DIST = $(SETUP_DIST)"