move Makefile to root

pull/794/head
Alexander Medvednikov 2019-06-29 12:21:34 +02:00
parent 3ddbe015b4
commit 5b7a1e84a4
2 changed files with 9 additions and 15 deletions

View File

@ -2,16 +2,19 @@ all: clean v
v: v.c
cc -std=gnu11 -w -o v v.c
./v -o v .
./v -o v compiler
rm v.c
echo "V has been successfully built"
v.c:
curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
test: v
./v -prod -o vprod . # Test prod build
find .. -name '*_test.v' -print0 | xargs -0 -n1 ./v
echo "Running V tests..."
find . -name '*_test.v' -print0 | xargs -0 -n1 ./v
echo "Building V examples..."
find ../examples -name '*.v' -print0 | xargs -0 -n1 ./v
find examples -name '*.v' -print0 | xargs -0 -n1 ./v
clean:
-rm -f v.c v vprod

View File

@ -788,22 +788,13 @@ fn new_v(args[]string) *V {
println('Looks like you are running V for the first time.')
// The parent directory should contain vlib if V is run
// from "v/compiler"
cur_dir := os.getwd()
lang_dir = cur_dir.all_before_last('/')
lang_dir = os.getwd()
if os.dir_exists('$lang_dir/vlib/builtin') {
println('Setting VROOT to "$lang_dir".')
os.write_file(TmpPath + '/VROOT', lang_dir)
} else {
println('V repo not found. Cloning...')
exit(1)
os.mv('v', 'v.bin')
os.exec('git clone https://github.com/vlang/v')
if !os.dir_exists('v') {
println('failed to clone github.com/vlang/v')
exit(1)
}
os.mv('v.bin', 'v/compiler/v')
println('Re-launch V from v/compiler')
println('V repo not found. Go to https://vlang.io to download V.zip or')
println('or install V from source.')
exit(1)
}
}