aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-15 04:41:58 +0000
committerDavid Robillard <d@drobilla.net>2011-10-15 04:41:58 +0000
commit7bdf853545a3d1bcaf7ae028a0409007862c3382 (patch)
tree4d3a55ef5cf4bafe7a686e66b46d41f5f1b6d6d3
parentbb38a51d0f50b79e1b362203c7f12c9f76e7ee31 (diff)
downloadresp-7bdf853545a3d1bcaf7ae028a0409007862c3382.tar.gz
resp-7bdf853545a3d1bcaf7ae028a0409007862c3382.tar.bz2
resp-7bdf853545a3d1bcaf7ae028a0409007862c3382.zip
Waf build system
git-svn-id: http://svn.drobilla.net/resp/trunk@432 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r--Makefile74
-rwxr-xr-xtest.sh38
-rwxr-xr-xtest_coverage.sh11
-rwxr-xr-xwafbin0 -> 89530 bytes
-rw-r--r--wscript114
5 files changed, 114 insertions, 123 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index f1279b2..0000000
--- a/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-LLVM_CXXFLAGS=`llvm-config-2.8 --cppflags core jit native codegen ipo`
-LLVM_LDFLAGS=`llvm-config-2.8 --ldflags --libs core jit native codegen ipo`
-#LLVM_CXXFLAGS=`llvm-config-2.8 --cppflags all`
-#LLVM_LDFLAGS=`llvm-config-2.8 --ldflags --libs all`
-
-COMMON_FLAGS=-fPIC
-COMMON_FLAGS+=-Wall -Wextra -Wno-unused-parameter
-COMMON_FLAGS+=-O0 -g
-#COMMON_FLAGS+=-O2 -march=nocona -fomit-frame-pointer
-
-CFLAGS=$(COMMON_FLAGS) -std=c99
-CXXFLAGS=$(COMMON_FLAGS) -ansi
-LDFLAGS=-rdynamic -lm -ldl
-
-# Test coverage
-#COMMON_FLAGS+=-fprofile-arcs -ftest-coverage
-#LDFLAGS+=-lgcov
-
-CC=gcc
-CXX=g++
-
-all: builddir build/resp
-
-builddir:
- mkdir -p build
-
-#build/c.o
-
-OBJECTS = \
- build/compile.o \
- build/constrain.o \
- build/cps.o \
- build/expand.o \
- build/flatten.o \
- build/gc.o \
- build/lift.o \
- build/parse.o \
- build/pprint.o \
- build/repl.o \
- build/resp.o \
- build/simplify.o \
- build/tlsf.o \
- build/unify.o
-
-LLVM_OBJECTS = build/llvm.o
-
-build/resp: $(OBJECTS) $(LLVM_OBJECTS)
- $(CXX) -o $@ $(OBJECTS) $(LLVM_OBJECTS) $(LDFLAGS) $(LLVM_LDFLAGS)
-
-build/%.o: src/%.cpp src/resp.hpp
- $(CXX) $(CXXFLAGS) -o $@ -c $<
-
-build/tlsf.o: src/tlsf.c src/tlsf.h
- $(CC) $(CFLAGS) -o $@ -c $<
-
-build/llvm.o: src/llvm.cpp src/resp.hpp
- $(CXX) $(CXXFLAGS) $(LLVM_CXXFLAGS) -o $@ -c src/llvm.cpp
-
-build/%.so: src/%.cpp src/resp.hpp
- $(CXX) -shared $(CXXFLAGS) -o $@ $^
-
-clean:
- rm -rf build
-
-check:
- ./test.sh
-
-doc:
- doxygen ./resp.dox
-
-install-support:
- install -d ~/.vim/indent ~/.vim/syntax
- install -m 644 ./support/vim/indent/resp.vim ~/.vim/indent/resp.vim
- install -m 644 ./support/vim/syntax/resp.vim ~/.vim/syntax/resp.vim
diff --git a/test.sh b/test.sh
deleted file mode 100755
index fa66812..0000000
--- a/test.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-run() {
- prog=$1
- desired=$2
- out=`./build/resp $prog`
- if [ "$out" != "$desired" ]; then
- echo "FAIL: $prog";
- echo " Expected: \"$desired\"";
- echo " Output: \"$out\"";
- else
- echo "PASS: $prog"
- fi
-}
-
-# Basic lexical sanity
-run './test/def.resp' '4 : Int'
-run './test/deffn.resp' '3 : Int'
-run './test/inlinefn.resp' '2 : Int'
-run './test/nest.resp' '8 : Int'
-
-# Basic data types
-run './test/string.resp' '"Hello, world!" : String'
-run './test/tup.resp' '5 : Int'
-
-# Recursive arithmetic functions
-run './test/fac.resp' '720 : Int'
-run './test/ack.resp' '8189 : Int'
-
-# Closures
-run './test/closure.resp' '6 : Int'
-run './test/let-over-fn.resp' '2 : Int'
-run './test/let.resp' '5 : Int'
-
-# Algebraic data types
-run './test/match.resp' '12.0000 : Float'
-
-#run './test/poly.resp' '#t : Bool'
diff --git a/test_coverage.sh b/test_coverage.sh
deleted file mode 100755
index bd24456..0000000
--- a/test_coverage.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-lcov -d ./src -z
-./test.sh
-lcov -d ./build -d ./src -b . -c > coverage.lcov
-lcov --remove coverage.lcov '*boost/*' 'c++/*' '*llvm/*' > coverage-stripped.lcov
-mkdir -p ./coverage
-genhtml -o coverage coverage-stripped.lcov
-echo "Report written to:"
-echo "coverage/index.html"
-
diff --git a/waf b/waf
new file mode 100755
index 0000000..c97be3e
--- /dev/null
+++ b/waf
Binary files differ
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..f7054a2
--- /dev/null
+++ b/wscript
@@ -0,0 +1,114 @@
+#!/usr/bin/env python
+import filecmp
+import glob
+import os
+import shutil
+import subprocess
+import sys
+
+from waflib.extras import autowaf as autowaf
+import waflib.Logs as Logs, waflib.Options as Options
+
+# Version of this package (even if built as a child)
+RESP_VERSION = '0.0.0'
+RESP_MAJOR_VERSION = '0'
+
+# Library version (UNIX style major, minor, micro)
+# major increment <=> incompatible changes
+# minor increment <=> compatible changes (additions)
+# micro increment <=> no interface changes
+# Resp uses the same version number for both library and package
+RESP_LIB_VERSION = RESP_VERSION
+
+# Variables for 'waf dist'
+APPNAME = 'resp'
+VERSION = RESP_VERSION
+
+# Mandatory variables
+top = '.'
+out = 'build'
+
+def options(opt):
+ opt.load('compiler_c')
+ opt.load('compiler_cxx')
+ autowaf.set_options(opt)
+
+def configure(conf):
+ conf.load('compiler_c')
+ conf.load('compiler_cxx')
+ autowaf.configure(conf)
+ autowaf.display_header('Resp Configuration')
+
+ conf.env.append_unique('CFLAGS', '-std=c99')
+
+ conf.check_cfg(
+ path = 'llvm-config-2.9',
+ args = '--cppflags --ldflags --libs core jit native codegen ipo',
+ package = '',
+ uselib_store = 'LLVM',
+ mandatory = False)
+
+ if not conf.is_defined('HAVE_LLVM'):
+ conf.check_cfg(
+ path = 'llvm-config-2.8',
+ args = '--cppflags --ldflags --libs core jit native codegen ipo',
+ package = '',
+ uselib_store = 'LLVM',
+ mandatory = True)
+
+def build(bld):
+ source = '''
+ src/compile.cpp
+ src/constrain.cpp
+ src/cps.cpp
+ src/expand.cpp
+ src/flatten.cpp
+ src/gc.cpp
+ src/lift.cpp
+ src/parse.cpp
+ src/pprint.cpp
+ src/repl.cpp
+ src/resp.cpp
+ src/simplify.cpp
+ src/tlsf.c
+ src/unify.cpp
+ src/llvm.cpp
+ '''
+
+ obj = bld(features = 'cxx cxxprogram',
+ source = source,
+ target = 'resp',
+ uselib = 'LLVM',
+ linkflags = ['-rdynamic'])
+
+def test(ctx):
+ def run_test(prog, correct_out):
+ out = subprocess.check_output(['./build/resp', prog]).strip()
+ if out == correct_out:
+ Logs.info("PASS: %s" % prog)
+ else:
+ Logs.error("FAIL: %s" % prog)
+ Logs.error("Expected: %s" % correct_out)
+ Logs.error("Got: %s" % out)
+
+ # Basic lexical sanity
+ run_test('./test/def.resp', '4 : Int')
+ run_test('./test/deffn.resp', '3 : Int')
+ run_test('./test/inlinefn.resp', '2 : Int')
+ run_test('./test/nest.resp', '8 : Int')
+
+ # Basic data types
+ run_test('./test/string.resp', '"Hello, world!" : String')
+ run_test('./test/tup.resp', '5 : Int')
+
+ # Recursive arithmetic functions
+ run_test('./test/fac.resp', '720 : Int')
+ run_test('./test/ack.resp', '8189 : Int')
+
+ # Closures
+ run_test('./test/closure.resp', '6 : Int')
+ run_test('./test/let-over-fn.resp', '2 : Int')
+ run_test('./test/let.resp', '5 : Int')
+
+ # Algebraic data types
+ run_test('./test/match.resp', '12.0000 : Float')