]> git.mdlowis.com Git - proto/gir.git/commitdiff
Switched from make to rscons for build system
authorMike D. Lowis <mike.lowis@gentex.com>
Thu, 28 May 2015 16:19:49 +0000 (12:19 -0400)
committerMike D. Lowis <mike.lowis@gentex.com>
Thu, 28 May 2015 16:19:49 +0000 (12:19 -0400)
.gitignore
.gitmodules
Gemfile [new file with mode: 0644]
Gemfile.lock [new file with mode: 0644]
Makefile [deleted file]
build.rb [new file with mode: 0755]
modules/build-system [new submodule]
source/main.c

index bbf313b25987d0d61b1cea33a8e6188501e221ac..6086a3e576695ec1ad309a1b8152e2fc5cfbde4b 100644 (file)
@@ -30,3 +30,9 @@
 
 # Debug files
 *.dSYM/
+project.vim
+tags
+tags .rsconscache
+source/lex.yy.c
+.rsconscache
+parser
index 09ec1596a3b3118e2017ce5180e467e8c170dd11..5235c74c93da271e24f9585a3a459caec0009b68 100644 (file)
@@ -1,3 +1,6 @@
 [submodule "modules/libcds"]
        path = modules/libcds
        url = https://github.com/mikedlowis/data-structures.git
+[submodule "modules/build-system"]
+       path = modules/build-system
+       url = https://github.com/mikedlowis/build-system.git
diff --git a/Gemfile b/Gemfile
new file mode 100644 (file)
index 0000000..894906d
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+gem 'rake', '>= 0'
+gem 'rscons', '>= 0'
+gem 'rspec', '>= 0'
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644 (file)
index 0000000..88f9e23
--- /dev/null
@@ -0,0 +1,29 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    diff-lcs (1.2.5)
+    json (1.8.2)
+    rake (10.4.2)
+    rscons (1.9.0)
+      json (~> 1.0)
+    rspec (3.2.0)
+      rspec-core (~> 3.2.0)
+      rspec-expectations (~> 3.2.0)
+      rspec-mocks (~> 3.2.0)
+    rspec-core (3.2.2)
+      rspec-support (~> 3.2.0)
+    rspec-expectations (3.2.0)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.2.0)
+    rspec-mocks (3.2.1)
+      diff-lcs (>= 1.2.0, < 2.0)
+      rspec-support (~> 3.2.0)
+    rspec-support (3.2.2)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  rake
+  rscons
+  rspec
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 4bef298..0000000
--- a/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-INCLUDES = \
-    source/ \
-    modules/libcds/source/ \
-    modules/libcds/source/buffer/ \
-    modules/libcds/source/cmp/ \
-    modules/libcds/source/exn/ \
-    modules/libcds/source/list/ \
-    modules/libcds/source/map/ \
-    modules/libcds/source/mem/ \
-    modules/libcds/source/murmur3/ \
-    modules/libcds/source/rbt/ \
-    modules/libcds/source/set/ \
-    modules/libcds/source/string/ \
-    modules/libcds/source/vector/
-
-SOURCES = $(wildcard source/*.c) \
-          $(wildcard modules/libcds/source/*/*.c)
-
-LD = $(CC)
-MAKEDEPEND = $(CPP) -M $(CPPFLAGS) -o  $<
-CCDEPGEN = -MMD -MF $*.d
-CFLAGS = -Wall -Wextra -O3 --std=c99 --pedantic $(addprefix -I,$(INCLUDES))
-
--include $(SOURCES:.c=.d)
-
-parser: source/lex.yy.o $(SOURCES:.c=.o)
-       $(LD) $(LDFLAGS) -o $@ $^
-
-%.o : %.c
-       $(CC) $(CCDEPGEN) $(CFLAGS) -c $< -o $@
-
-source/lex.yy.c: source/lexer.l
-       $(LEX) $(LFLAGS) -o $@ $^
-
-clean:
-       rm -f $(SOURCES:.c=.o)
-       rm -f $(SOURCES:.c=.d)
-       rm -f source/lex.yy.c
-       rm -f parser parser.exe
-
diff --git a/build.rb b/build.rb
new file mode 100755 (executable)
index 0000000..6071448
--- /dev/null
+++ b/build.rb
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+require './modules/build-system/setup'
+
+#------------------------------------------------------------------------------
+# Environment Definitions
+#------------------------------------------------------------------------------
+# Define the default compiler environment
+main_env = BuildEnv.new do |env|
+  env["CFLAGS"]  += ['-Wall', '-Wextra', '--std=c99', '--pedantic']
+  env["CPPPATH"] += Dir['modules/libcds/source/**/'] + [ ]
+end
+
+#------------------------------------------------------------------------------
+# Release Build Targets
+#------------------------------------------------------------------------------
+# Build third party libraries
+main_env.Library('build/lib/libcds.a', FileList['modules/libcds/source/**/*.c'])
+runtime_libs = ['build/lib/libcds.a']
+
+# Build the parser
+main_env.CFile('source/lex.yy.c', 'source/lexer.l')
+main_env.Program('parser', FileList['source/*.c'] + ['source/lex.yy.c'] + runtime_libs)
+
+#------------------------------------------------------------------------------
+# Test Build Targets
+#------------------------------------------------------------------------------
+if Opts[:profile].include? "test"
+#  compiler_libs = ['build/lib/libparse-test.a'] + runtime_libs
+#  test_env.Library('build/lib/libparse-test.a', FileList['source/libparse/*.c'])
+#  test_env.Program('build/bin/sclpl-test', FileList['source/sclpl/*.c'] + compiler_libs)
+#  test_env.Command('RSpec', [], 'CMD' => [
+#      'rspec', '--pattern', 'spec/**{,/*/**}/*_spec.rb', '--format', 'documentation'])
+end
diff --git a/modules/build-system b/modules/build-system
new file mode 160000 (submodule)
index 0000000..f1a522b
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f1a522b4aed7c58ce3c8467ff8a00f00c3e27e64
index 3cb04485a7b5e9ffba4380a011b8a21ca233a377..1aab45e283087db8387e126eabc962aeee875602 100644 (file)
@@ -88,7 +88,7 @@ void reduce(int count) {
     AST* tree = Tree(type, count);
     intptr_t* stack = Token_Stack - (count-1);
     for (int i = 0; i < count; i++) {
-        tree->children[i] = stack[i];
+        tree->children[i] = (void*)stack[i];
     }
     Token_Stack -= count ;
     *(++Token_Stack) = (intptr_t)tree;
@@ -111,7 +111,6 @@ static void keyword_send(void);
 static void binary_send(void);
 static void unary_send(void);
 static void operand(void);
-static void messages(void);
 static void literal(void);
 static void array(void);
 static void object(void);
@@ -253,6 +252,8 @@ int main(int argc, char** argv) {
         PrintTree((AST*)*Token_Stack, 0);
         Token_Stack = Token_Buffer-1;
     }
+    (void)argc;
+    (void)argv;
     return 0;
 }