Put built ttcs in build/ttc, rather than build

This is so that we can put other build artefacts (e.g. executables) in
properly organised subdirectories of build, e.g. build/bin/chez,
build/bin/js, etc.
This commit is contained in:
Edwin Brady 2019-09-04 12:41:16 +01:00
parent 68b0d64879
commit 65db4fbf96
11 changed files with 14 additions and 15 deletions

View File

@ -1,7 +1,7 @@
PREFIX ?= ${HOME}/.idris2 PREFIX ?= ${HOME}/.idris2
IDRIS_VERSION := $(shell idris --version) IDRIS_VERSION := $(shell idris --version)
VALID_IDRIS_VERSION_REGEXP = "1.3.2.*" VALID_IDRIS_VERSION_REGEXP = "1.3.2.*"
export IDRIS2_PATH = ${CURDIR}/libs/prelude/build:${CURDIR}/libs/base/build export IDRIS2_PATH = ${CURDIR}/libs/prelude/build/ttc:${CURDIR}/libs/base/build/ttc
export IDRIS2_DATA = ${CURDIR}/support export IDRIS2_DATA = ${CURDIR}/support
-include custom.mk -include custom.mk

View File

@ -31,7 +31,6 @@ LIBTARGET = $(LIBNAME).a
TARGET=${HOME}/.idris2 TARGET=${HOME}/.idris2
build: $(DYLIBTARGET) $(IDRIS_SRCS) build: $(DYLIBTARGET) $(IDRIS_SRCS)
@if ! [ -d build ]; then echo "creating 'build' directory"; mkdir build ; else echo "directory 'build' exists"; fi
@if [ -z "${IDRIS2}" ]; then echo 'variable $$IDRIS2 is not set, aborting'; exit 1; fi @if [ -z "${IDRIS2}" ]; then echo 'variable $$IDRIS2 is not set, aborting'; exit 1; fi
${IDRIS2} --build network.ipkg ${IDRIS2} --build network.ipkg

View File

@ -81,7 +81,7 @@ nsToPath loc ns
= do d <- getDirs = do d <- getDirs
let fnameBase = showSep (cast sep) (reverse ns) let fnameBase = showSep (cast sep) (reverse ns)
let fs = map (\p => p ++ cast sep ++ fnameBase ++ ".ttc") let fs = map (\p => p ++ cast sep ++ fnameBase ++ ".ttc")
(build_dir d :: extra_dirs d) ((build_dir d ++ cast sep ++ "ttc") :: extra_dirs d)
Just f <- firstAvailable fs Just f <- firstAvailable fs
| Nothing => pure (Left (ModuleNotFound loc ns)) | Nothing => pure (Left (ModuleNotFound loc ns))
pure (Right f) pure (Right f)
@ -151,7 +151,7 @@ makeBuildDirectory ns
[] => [] [] => []
(n :: ns) => ns -- first item is file name (n :: ns) => ns -- first item is file name
let fname = showSep (cast sep) (reverse ndirs) let fname = showSep (cast sep) (reverse ndirs)
Right _ <- coreLift $ mkdirs (build_dir d :: reverse ndirs) Right _ <- coreLift $ mkdirs (build_dir d :: "ttc" :: reverse ndirs)
| Left err => throw (FileErr (bdir ++ cast sep ++ fname) err) | Left err => throw (FileErr (bdir ++ cast sep ++ fname) err)
pure () pure ()
@ -167,7 +167,7 @@ getTTCFileName inp ext
let ns = pathToNS (working_dir d) inp let ns = pathToNS (working_dir d) inp
let fname = showSep (cast sep) (reverse ns) ++ ext let fname = showSep (cast sep) (reverse ns) ++ ext
let bdir = build_dir d let bdir = build_dir d
pure $ bdir ++ cast sep ++ fname pure $ bdir ++ cast sep ++ "ttc" ++ cast sep ++ fname
-- Given a root executable name, return the name in the build directory -- Given a root executable name, return the name in the build directory
export export

View File

@ -234,9 +234,9 @@ installFrom : {auto c : Ref Ctxt Defs} ->
String -> String -> String -> List String -> Core () String -> String -> String -> List String -> Core ()
installFrom _ _ _ [] = pure () installFrom _ _ _ [] = pure ()
installFrom pname builddir destdir ns@(m :: dns) installFrom pname builddir destdir ns@(m :: dns)
= do let ttcfile = showSep "/" (reverse ns) = do let ttcfile = showSep dirSep (reverse ns)
let ttcPath = builddir ++ dirSep ++ ttcfile ++ ".ttc" let ttcPath = builddir ++ dirSep ++ "ttc" ++ dirSep ++ ttcfile ++ ".ttc"
let destPath = destdir ++ dirSep ++ showSep "/" (reverse dns) let destPath = destdir ++ dirSep ++ showSep dirSep (reverse dns)
let destFile = destdir ++ dirSep ++ ttcfile ++ ".ttc" let destFile = destdir ++ dirSep ++ ttcfile ++ ".ttc"
Right _ <- coreLift $ mkdirs (reverse dns) Right _ <- coreLift $ mkdirs (reverse dns)
| Left err => throw (FileErr pname err) | Left err => throw (FileErr pname err)

View File

@ -1,4 +1,4 @@
$1 --yaffle Interp.yaff < input $1 --yaffle Interp.yaff < input
$1 --yaffle build/Interp.ttc < input $1 --yaffle build/ttc/Interp.ttc < input
rm -rf build rm -rf build

View File

@ -1,4 +1,4 @@
$1 --yaffle Hole.yaff < input $1 --yaffle Hole.yaff < input
$1 --yaffle build/Hole.ttc < input $1 --yaffle build/ttc/Hole.ttc < input
rm -rf build rm -rf build

View File

@ -1,5 +1,5 @@
$1 --yaffle Lazy.yaff < input $1 --yaffle Lazy.yaff < input
$1 --yaffle LazyInf.yaff < input $1 --yaffle LazyInf.yaff < input
$1 --yaffle build/LazyInf.ttc < input $1 --yaffle build/ttc/LazyInf.ttc < input
rm -rf build rm -rf build

View File

@ -1,4 +1,4 @@
$1 --yaffle Record.yaff < input $1 --yaffle Record.yaff < input
$1 --yaffle build/Record.ttc < input $1 --yaffle build/ttc/Record.ttc < input
rm -rf build rm -rf build

View File

@ -1,4 +1,4 @@
$1 --yaffle Auto.yaff < input $1 --yaffle Auto.yaff < input
$1 --yaffle build/Auto.ttc < input $1 --yaffle build/ttc/Auto.ttc < input
rm -rf build rm -rf build

View File

@ -1,4 +1,4 @@
$1 --yaffle FakeTC.yaff < input $1 --yaffle FakeTC.yaff < input
$1 --yaffle build/FakeTC.ttc < input $1 --yaffle build/ttc/FakeTC.ttc < input
rm -rf build rm -rf build

View File

@ -1,4 +1,4 @@
$1 --yaffle Functor.yaff < input $1 --yaffle Functor.yaff < input
$1 --yaffle build/Functor.ttc < input $1 --yaffle build/ttc/Functor.ttc < input
rm -rf build rm -rf build