Skip to content

Commit

Permalink
Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
nominolo committed May 24, 2009
1 parent 6b744e4 commit 3b12f40
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 103 deletions.
102 changes: 68 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,49 +1,76 @@
.PHONY: default clean install-lib install-deps

default: all
all: build

include config.mk

# If not set in custom config.mk, use the inplace GHC
HC ?= $(GHC_PATH)/ghc/stage2-inplace/ghc
PKG ?= $(GHC_PATH)/utils/ghc-pkg/install-inplace/bin/ghc-pkg
HADDOCK ?= $(GHC_PATH)/utils/haddock/install-inplace/bin/haddock
# If not set in custom config.mk, use the default versions
HC ?= ghc
PKG ?= ghc-pkg
HADDOCK ?= haddock

DIST = dist
DIST = dist
DIST_LIB = $(DIST)/lib
DIST_SERVER = $(DIST)/server
SETUP_DIST = setup-dist
SETUP_CONFIG = $(DIST)/setup-config
SETUP = $(SETUP_DIST)/Setup

CABAL_INSTALL_OPTS += --ghc --with-compiler=$(HC) --with-hc-pkg=$(PKG)
CABAL_FLAGS ?= -ftesting -femacs

CABAL_FLAGS ?=
# -ftesting

$(DIST_LIB)/setup-config: $(SETUP) lib/scion.cabal
@echo === Configuring scion ===
@echo Configure log: $(DIST)/lib-config-log
@cd lib && \
(../$(SETUP) configure -v --builddir=../$(DIST_LIB) \
--with-compiler=$(HC) --with-hc-pkg=$(PKG) \
--user $(CABAL_FLAGS)> ../$(DIST)/lib-config-log)

$(DIST_SERVER)/setup-config: $(SETUP) server/scion-server.cabal $(DIST_LIB)/.installed_tag
@echo === Configuring scion-server ===
@echo Configure log: $(DIST)/server-config-log
@cd server && \
(../$(SETUP) configure -v --builddir=../$(DIST_SERVER) \
--with-compiler=$(HC) --with-hc-pkg=$(PKG) \
--user $(CABAL_FLAGS) > ../$(DIST)/server-config-log)

$(DIST_LIB)/build/libHSscion-0.1.a: $(SETUP) $(DIST_LIB)/setup-config lib/**/*.hs
@echo === Building scion ===
@cd lib && \
../$(SETUP) build --builddir=../$(DIST_LIB)

$(DIST_LIB)/.installed_tag: $(DIST_LIB)/build/libHSscion-0.1.a $(SETUP)
@echo === Installing scion ===
@cd lib && ../$(SETUP) install --user --builddir=../$(DIST_LIB)
@touch $@

$(DIST_SERVER)/build/scion_server/scion_server: $(SETUP) $(DIST_SERVER)/setup-config
@echo === Building scion-server ===
@cd server && \
../$(SETUP) build --builddir=../$(DIST_SERVER)

setup: $(SETUP)
$(SETUP): Setup.hs
@echo === Building Setup ===
@mkdir -p $(SETUP_DIST)
$(HC) --make -odir $(SETUP_DIST) -hidir $(SETUP_DIST) -o $@ $<

configure: $(SETUP_CONFIG)
$(SETUP_CONFIG): scion.cabal setup
$(SETUP) configure -v --with-compiler=$(HC) --with-hc-pkg=$(PKG) --user $(CABAL_FLAGS)
@$(HC) --make -odir $(SETUP_DIST) -hidir $(SETUP_DIST) -o $@ $<

.PHONY: build
build: configure
$(SETUP) build -v
build: $(DIST_LIB)/build/libHSscion-0.1.a $(DIST_SERVER)/build/scion_server/scion_server

install: build
$(SETUP) 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
# 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 || rm -rf $(DIST)
@(cd lib && ../$(SETUP) clean --builddir=../$(DIST_LIB)) || rm -rf $(DIST_LIB)
@(cd server && ../$(SETUP) clean --builddir=../$(DIST_SERVER)) || rm -rf $(DIST_SERVER)

distclean: clean
rm -rf $(SETUP_DIST)
# distclean: clean
# rm -rf $(SETUP_DIST)

doc: configure
$(SETUP) haddock --with-haddock=$(HADDOCK)
# doc: configure
# $(SETUP) haddock --with-haddock=$(HADDOCK)

printvars:
@echo "UseInplaceGhc = $(UseInplaceGhc)"
Expand All @@ -55,12 +82,19 @@ printvars:
@echo " ..._OPTS = $(CABAL_INSTALL_OPTS)"
@echo "CABAL_FLAGS = $(CABAL_FLAGS)"
@echo "---------------------------------------------------------------"
@echo "DIST = $(DIST)"
@echo "SETUP_CONFIG = $(SETUP_CONFIG)"
@echo "DIST_LIB = $(DIST_LIB)"
@echo "SETUP_DIST = $(SETUP_DIST)"

cabal-install:
$(CABAL_INSTALL) install $(CABAL_INSTALL_OPTS) $(CABAL_FLAGS)
install-deps:
cabal install --with-compiler=$(HC) --with-hc-pkg=$(PKG) ghc-paths
cabal install --with-compiler=$(HC) --with-hc-pkg=$(PKG) ghc-syb
cabal install --with-compiler=$(HC) --with-hc-pkg=$(PKG) multiset
cabal install --with-compiler=$(HC) --with-hc-pkg=$(PKG) time
cabal install --with-compiler=$(HC) --with-hc-pkg=$(PKG) uniplate


# cabal-install:
# $(CABAL_INSTALL) install $(CABAL_INSTALL_OPTS) $(CABAL_FLAGS)

run-emacs: build
./$(DIST)/build/scion_emacs/scion_emacs
# run-emacs: build
# ./$(DIST)/build/scion_emacs/scion_emacs
5 changes: 3 additions & 2 deletions config.mk.sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ UseInplaceGhc = NO
ifeq "$(UseInplaceGhc)" "YES"

GHC_PATH = /absolute/path/to/ghc
HC ?= $(GHC_PATH)/inplace/bin/ghc-stage2
PKG ?= $(GHC_PATH)/inplace/bin/ghc-pkg
HADDOCK ?= $(GHC_PATH)/inplace/bin/haddock

else

Expand All @@ -22,5 +25,3 @@ endif

# path to 'cabal' program from the 'cabal-install' tool.
CABAL_INSTALL = cabal

run: run-emacs
69 changes: 2 additions & 67 deletions lib/scion.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: scion
version: 0.1
license: BSD3
license-file: LICENSE
license-file: ../LICENSE
author: Thomas Schilling <nominolo@googlemail.com>
maintainer: Thomas Schilling <nominolo@googlemail.com>
homepage: http://github.com/nominolo/scion
Expand All @@ -11,21 +11,11 @@ category: Development
stability: provisional
build-type: Simple
cabal-version: >= 1.4
-- tested-with: GHC ==6.10.1
extra-source-files: README.markdown emacs/scion.el

flag testing
description: Enable Debugging things like QuickCheck properties, etc.
default: False

flag emacs
description: Build emacs-specific parts
default: True

flag examples
description: Build examples
default: False

library
build-depends: ghc >= 6.10 && < 6.12,
ghc-paths == 0.1.*,
Expand All @@ -38,7 +28,7 @@ library
time == 1.1.*,
filepath == 1.1.*,
multiset == 0.1.*
hs-source-dirs: src
hs-source-dirs: .
extensions: CPP, PatternGuards
exposed-modules:
Scion.Types,
Expand Down Expand Up @@ -66,60 +56,5 @@ library
if impl(ghc == 6.10.*)
cpp-options: -DWPINLINE

if flag(emacs)
build-depends: network >= 2.1 && < 2.3,
network-bytestring == 0.1.*,
bytestring == 0.9.*
exposed-modules: Scion.Server.Emacs,
Scion.Server.Commands,
Scion.Server.Protocol
ghc-options: -Wall

executable test_get_imports
if !flag(examples)
buildable: False
main-is: GetImports.hs
hs-source-dirs: examples
src
other-modules: Scion
if flag(testing)
build-depends: QuickCheck == 2.*
cpp-options: -DDEBUG

executable test_call_graph
if !flag(examples)
buildable: False
main-is: CallGraph0.hs
hs-source-dirs: examples
src
other-modules: Scion
if flag(testing)
build-depends: QuickCheck == 2.*
cpp-options: -DDEBUG

executable test_thing_at_point
if !flag(examples)
buildable: False
main-is: ThingAtPoint.hs
hs-source-dirs: examples
src
other-modules: Scion
if flag(testing)
build-depends: QuickCheck == 2.*
cpp-options: -DDEBUG

executable scion_emacs
main-is: EmacsServer.hs
hs-source-dirs: programs src
if !flag(emacs)
buildable: False
other-modules: Scion.Server.Emacs
if flag(testing)
build-depends: QuickCheck == 2.*
cpp-options: -DDEBUG
if impl(ghc > 6.11)
cpp-options: -DHAVE_PACKAGE_DB_MODULES

-- TODO: drop after 6.10.2 is out
if impl(ghc >= 6.11.20081113) || impl(ghc == 6.10.* && >= 6.10.2)
cpp-options: -DRECOMPILE_BUG_FIXED
File renamed without changes.
32 changes: 32 additions & 0 deletions server/scion-server.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: scion-server
version: 0.1
license: BSD3
license-file: ../LICENSE
author: Thomas Schilling <nominolo@googlemail.com>
maintainer: Thomas Schilling <nominolo@googlemail.com>
homepage: http://github.com/nominolo/scion
description: Haskell Source Code Inspection and Interaction library
synopsis: Haskell IDE library
category: Development
stability: provisional
build-type: Simple
cabal-version: >= 1.4
extra-source-files: README.markdown emacs/scion.el

executable scion_server
main-is: Main.hs

build-depends: base == 4.*,
network >= 2.1 && < 2.3,
network-bytestring == 0.1.*,
containers == 0.2.*,
bytestring == 0.9.*,
ghc >= 6.10 && < 6.12,
ghc-syb == 0.1.*,
Cabal >= 1.5 && < 1.8,
scion == 0.1.*,
multiset == 0.1.*

other-modules: Scion.Server.Emacs,
Scion.Server.Commands,
Scion.Server.Protocol

0 comments on commit 3b12f40

Please sign in to comment.