Skip to content

Commit

Permalink
Added support/ directory so that library can use C support files
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Brady committed Apr 10, 2012
1 parent 9e399b2 commit e7906ba
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Setup.hs
Expand Up @@ -26,6 +26,11 @@ installStdLib pkg local verbosity copy
, "TARGET=" ++ idir , "TARGET=" ++ idir
, "IDRIS=" ++ icmd , "IDRIS=" ++ icmd
] ]
make verbosity
[ "-C", "support", "install"
, "TARGET=" ++ idir
, "IDRIS=" ++ icmd
]


checkStdLib local verbosity checkStdLib local verbosity
= do let icmd = ".." </> buildDir local </> "idris" </> "idris" = do let icmd = ".." </> buildDir local </> "idris" </> "idris"
Expand All @@ -34,6 +39,10 @@ checkStdLib local verbosity
[ "-C", "lib", "check" [ "-C", "lib", "check"
, "IDRIS=" ++ icmd , "IDRIS=" ++ icmd
] ]
make verbosity
[ "-C", "support", "check"
, "IDRIS=" ++ icmd
]


-- Install libraries during both copy and install -- Install libraries during both copy and install
-- See http://hackage.haskell.org/trac/hackage/ticket/718 -- See http://hackage.haskell.org/trac/hackage/ticket/718
Expand Down
3 changes: 2 additions & 1 deletion idris.cabal
Expand Up @@ -41,7 +41,8 @@ Cabal-Version: >= 1.6
Build-type: Custom Build-type: Custom


Extra-source-files: lib/Makefile lib/*.idr lib/prelude/*.idr lib/network/*.idr Extra-source-files: lib/Makefile lib/*.idr lib/prelude/*.idr lib/network/*.idr
lib/control/monad/*.idr tutorial/examples/*.idr lib/control/monad/*.idr lib/language/*.idr
tutorial/examples/*.idr


source-repository head source-repository head
type: git type: git
Expand Down
5 changes: 4 additions & 1 deletion lib/Makefile
Expand Up @@ -7,19 +7,22 @@ recheck: clean check
install: check install: check
mkdir -p $(TARGET)/prelude mkdir -p $(TARGET)/prelude
mkdir -p $(TARGET)/network mkdir -p $(TARGET)/network
mkdir -p $(TARGET)/language
mkdir -p $(TARGET)/control/monad mkdir -p $(TARGET)/control/monad
install *.ibc $(TARGET) install *.ibc $(TARGET)
install prelude/*.ibc $(TARGET)/prelude install prelude/*.ibc $(TARGET)/prelude
install network/*.ibc $(TARGET)/network install network/*.ibc $(TARGET)/network
install language/*.ibc $(TARGET)/language
install control/monad/*.ibc $(TARGET)/control/monad install control/monad/*.ibc $(TARGET)/control/monad


clean: .PHONY clean: .PHONY
rm -f *.ibc rm -f *.ibc
rm -f prelude/*.ibc rm -f prelude/*.ibc
rm -f network/*.ibc rm -f network/*.ibc
rm -f language/*.ibc
rm -f control/monad/*.ibc rm -f control/monad/*.ibc


linecount: .PHONY linecount: .PHONY
wc -l *.idr network/*.idr prelude/*.idr control/monad/*.idr wc -l *.idr network/*.idr language/*.idr prelude/*.idr control/monad/*.idr


.PHONY: .PHONY:
2 changes: 2 additions & 0 deletions lib/checkall.idr
Expand Up @@ -25,5 +25,7 @@ import prelude.complex


import network.cgi import network.cgi


import language.reflection

import control.monad.identity import control.monad.identity
import control.monad.state import control.monad.state
11 changes: 11 additions & 0 deletions lib/language/reflection.idr
@@ -0,0 +1,11 @@
module language.reflection

TTName : Set
TTName = String

data TT = Var TTName
| Lam TTName TT TT
| Pi TTName TT TT
| Let TTName TT TT TT
| App TTName TT TT

6 changes: 5 additions & 1 deletion src/Idris/Compiler.hs
Expand Up @@ -16,6 +16,8 @@ import System.IO
import System.Directory import System.Directory
import System.Environment import System.Environment


import Paths_idris

import Epic.Epic hiding (Term, Type, Name, fn, compile) import Epic.Epic hiding (Term, Type, Name, fn, compile)
import qualified Epic.Epic as E import qualified Epic.Epic as E


Expand All @@ -32,13 +34,15 @@ compile f tm
hdrs <- getHdrs hdrs <- getHdrs
let incs = map Include hdrs let incs = map Include hdrs
so <- getSO so <- getSO
ddir <- liftIO $ getDataDir
let ilib = ddir ++ "/libidris.a"
case so of case so of
Nothing -> Nothing ->
do m <- epicMain tm do m <- epicMain tm
let mainval = EpicFn (name "main") m let mainval = EpicFn (name "main") m
liftIO $ compileObjWith [] liftIO $ compileObjWith []
(mkProgram (incs ++ mainval : ds)) (f ++ ".o") (mkProgram (incs ++ mainval : ds)) (f ++ ".o")
liftIO $ link ((f ++ ".o") : objs ++ (map ("-l"++) libs)) f liftIO $ link ((f ++ ".o") : ilib : objs ++ (map ("-l"++) libs)) f
where checkMVs = do i <- get where checkMVs = do i <- get
case idris_metavars i \\ primDefs of case idris_metavars i \\ primDefs of
[] -> return () [] -> return ()
Expand Down
12 changes: 12 additions & 0 deletions support/Makefile
@@ -0,0 +1,12 @@
OBJS = testidr.o
CFLAGS = `epic -includedirs`

LIBTARGET = libidris.a

check: $(OBJS)
ar -r $(LIBTARGET) $(OBJS)

install: check
install $(LIBTARGET) $(TARGET)

.PHONY:
6 changes: 6 additions & 0 deletions support/testidr.c
@@ -0,0 +1,6 @@
#include "testidr.h"
#include <stdio.h>

void testIdr() {
printf("Hello Idris support library!\n");
}
7 changes: 7 additions & 0 deletions support/testidr.h
@@ -0,0 +1,7 @@
#ifndef __TESTIDR_H
#define __TESTIDR_H

void testIdr();

#endif

0 comments on commit e7906ba

Please sign in to comment.