]> git.mdlowis.com Git - proto/sclpl.git/commitdiff
Fix LLVM build on windows and slvm build on all platforms
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 24 Jun 2014 16:17:31 +0000 (12:17 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 24 Jun 2014 16:17:31 +0000 (12:17 -0400)
SConstruct
source/slvm/platforms/C99/pal.c
source/vendor/llvm-3.4.2/projects/LLVMBuild.txt [new file with mode: 0644]
source/vendor/llvm-3.4.2/projects/Makefile [deleted file]

index 7b57b7881241296a1d4aa3249c4d32a691004783..1f144abff5a51da5710c202ab20ab7a358f65236 100644 (file)
-#------------------------------------------------------------------------------
-# Environment Setup and Utilities
-#------------------------------------------------------------------------------
-import platform
-import fnmatch
-import os
-import glob
-
-# Helper function for recursively finding files
-def find_files(path,pattern):
-    matches = []
-    for root, dirs, files in os.walk(path):
-        for filename in fnmatch.filter(files, pattern):
-            matches.append(os.path.join(root, filename))
-    return matches
-
-# Helper function to build scheme programs and test runners
-def SchemeBuildAndTest(target,sources,tests):
-    # Figure out the target names
-    #test_runner  = target + '_tests'
-    #test_output  = target + '_results'
-    #test_sources = [e for e in sources if not e.endswith('main.scm')] + tests
-    # Create the targets
-    scheme.Program( target, sources )
-    #scheme.Program( test_runner, test_sources )
-    #RunTest( test_output, test_runner )
-
-# Helper function to run a test suite and generate a log file
-def RunTest( output, runner ):
-    runner_exe = runner + ('.exe' if (platform.system() == 'Windows') else '')
-    cmd = os.path.basename(runner_exe)
-    scheme.Command( output, runner_exe, cmd + ' > $TARGET')
-
-#------------------------------------------------------------------------------
-# Compiler Environments
-#------------------------------------------------------------------------------
-
-# Base Environment
-#-----------------
-base = Environment(
-    ENV     = os.environ,
-    CCFLAGS = [],
-    LDFLAGS = [],
-    LIBPATH = ['build/lib'])
-
-# On windows use mingw because VS is not C99 compliant
-if platform.system() == 'Windows':
-    base.Append(TOOLS=['mingw'])
-
-# Default C/C++ Environment
-#---------------------------
-c_cpp = base.Clone(CCFLAGS = [ '-Wall', '-Werror', '-std=c99' ])
-
-# C/C++ Environment Minus Standard Lib
-#-------------------------------------
-nostdlib = c_cpp.Clone(LINKFLAGS = [ '-nostdlib' ],
-                       LIBS      = ['gcc'])
-
-# Chicken Scheme Environment
-#---------------------------
-# Scheme Source Compiler
-scheme_compiler = Builder(
-        action        = 'csc $CCFLAGS -c -o $TARGET $SOURCE',
-        suffix        = '.o',
-        src_suffix    = '.scm',
-        single_source = True)
-
-# Scheme Binary Linker
-scheme_linker = Builder(
-        action      = 'csc $LDFLAGS -o $TARGET $SOURCES',
-        suffix      = '$PROGSUFFIX',
-        src_suffix  = '.o',
-        src_builder = [ scheme_compiler ])
-
-# Create the Environment for this project
-scheme = base.Clone(CCFLAGS  = [ '-I', 'inc'],
-                    BUILDERS = { 'Program': scheme_linker })
-
-#------------------------------------------------------------------------------
-# Vendor Targets
-#------------------------------------------------------------------------------
-import os
-
-llvm = base.Clone(CMAKE_GENERATOR="Unix Makefiles")
-llvm.Command('build/llvm/Makefile',
-             'source/vendor/llvm-3.4.2/',
-             'cd ${TARGET.dir} && cmake -G"${CMAKE_GENERATOR}" ../../${SOURCE}')
-llvm.Command('build/llvm/Release+Assert/bin/llc',
-             'build/llvm/Makefile',
-             'make -C build/llvm/')
-
-#------------------------------------------------------------------------------
-# SCLPL Targets
-#------------------------------------------------------------------------------
-
-# SOF Shared Library
-#c_cpp.SharedLibrary('build/sof', find_files('source/libsof/','*.c'))
-
-# SBC Shared Library
-#c_cpp.SharedLibrary('build/sbc', find_files('source/libsbc/','*.c'))
-
-# readsof Command Line Utility
-#readsof = c_cpp.Clone(CPPPATH = [ 'source/libsof/' ],
-#                      LIBS    = [ 'sof' ],
-#                      LIBPATH = [ 'build' ])
-#readsof.Program('build/readsof', find_files('source/readsof/','*.c'))
-#readsof.Depends('readsof', 'sof')
-
-# SCLPL Compiler
-SchemeBuildAndTest( 'build/bin/slc',
-                    find_files('source/slc/','*.scm'),
-                    find_files('tests/slc/','*.scm') )
-
-# SCLPL Package Manager
-SchemeBuildAndTest( 'build/bin/slpkg',
-                    find_files('source/slpkg/','*.scm'),
-                    find_files('tests/slpkg/','*.scm') )
-
-# SCLPL Assembler
-SchemeBuildAndTest( 'build/bin/slas',
-                    find_files('source/slas/','*.scm'),
-                    find_files('tests/slas/','*.scm') )
-
-# SCLPL Virtual Machine
-#----------------------
-## Virtual Machine Kernel
-#nostdlib.StaticLibrary('build/lib/vmkernel', glob.glob('source/slvm/kernel/*.c'))
-#
-## Standard Platform Library (C99)
-#c_cpp.StaticLibrary('build/lib/stdpf',
-#                    glob.glob('source/slvm/platforms/C99/*.c'),
-#                    CPPPATH = ['source/slvm/kernel'])
-#
-## VM Executable Using Standard Platform
-#c_cpp.Program('build/bin/slvm', [], LIBS = ['vmkernel', 'stdpf'])
-#
-## Build all VM Extensions
-#for ext in glob.glob('source/slvm/extensions/*/'):
-#    name = os.path.basename(ext.strip('\\/'))
-#    c_cpp.StaticLibrary('build/lib/'+name+'ext',
-#                        glob.glob(ext + '/*.c'),
-#                        CPPPATH = ['source/slvm/kernel'],
-#                        LIBS = ['stdpf'])
-
+#------------------------------------------------------------------------------\r
+# Environment Setup and Utilities\r
+#------------------------------------------------------------------------------\r
+import platform\r
+import fnmatch\r
+import os\r
+import glob\r
+\r
+# Helper function for recursively finding files\r
+def find_files(path,pattern):\r
+    matches = []\r
+    for root, dirs, files in os.walk(path):\r
+        for filename in fnmatch.filter(files, pattern):\r
+            matches.append(os.path.join(root, filename))\r
+    return matches\r
+\r
+# Helper function to build scheme programs and test runners\r
+def SchemeBuildAndTest(target,sources,tests):\r
+    # Figure out the target names\r
+    #test_runner  = target + '_tests'\r
+    #test_output  = target + '_results'\r
+    #test_sources = [e for e in sources if not e.endswith('main.scm')] + tests\r
+    # Create the targets\r
+    scheme.Program( target, sources )\r
+    #scheme.Program( test_runner, test_sources )\r
+    #RunTest( test_output, test_runner )\r
+\r
+# Helper function to run a test suite and generate a log file\r
+def RunTest( output, runner ):\r
+    runner_exe = runner + ('.exe' if (platform.system() == 'Windows') else '')\r
+    cmd = os.path.basename(runner_exe)\r
+    scheme.Command( output, runner_exe, cmd + ' > $TARGET')\r
+\r
+#------------------------------------------------------------------------------\r
+# Compiler Environments\r
+#------------------------------------------------------------------------------\r
+\r
+# Base Environment\r
+#-----------------\r
+base = Environment(\r
+    ENV     = os.environ,\r
+    CCFLAGS = [],\r
+    LDFLAGS = [],\r
+    LIBPATH = ['build/lib'])\r
+\r
+# On windows use mingw because VS is not C99 compliant\r
+base_cpp = base.Clone()\r
+if platform.system() == 'Windows':\r
+    base_cpp.Append(TOOLS=['mingw'])\r
+\r
+# Default C/C++ Environment\r
+#---------------------------\r
+c_cpp = base_cpp.Clone(CCFLAGS = [ '-Wall', '-Werror', '-std=c99' ])\r
+\r
+# C/C++ Environment Minus Standard Lib\r
+#-------------------------------------\r
+nostdlib = c_cpp.Clone(LINKFLAGS = [ '-nostdlib' ],\r
+                       LIBS      = ['gcc'])\r
+\r
+# Chicken Scheme Environment\r
+#---------------------------\r
+# Scheme Source Compiler\r
+scheme_compiler = Builder(\r
+        action        = 'csc $CCFLAGS -c -o $TARGET $SOURCE',\r
+        suffix        = '.o',\r
+        src_suffix    = '.scm',\r
+        single_source = True)\r
+\r
+# Scheme Binary Linker\r
+scheme_linker = Builder(\r
+        action      = 'csc $LDFLAGS -o $TARGET $SOURCES',\r
+        suffix      = '$PROGSUFFIX',\r
+        src_suffix  = '.o',\r
+        src_builder = [ scheme_compiler ])\r
+\r
+# Create the Environment for this project\r
+scheme = base.Clone(CCFLAGS  = [ '-I', 'inc'],\r
+                    BUILDERS = { 'Program': scheme_linker })\r
+\r
+#------------------------------------------------------------------------------\r
+# Vendor Targets\r
+#------------------------------------------------------------------------------\r
+import os\r
+\r
+llvm = base.Clone()\r
+if platform.system() == 'Windows':\r
+    llvm.Append(CMAKE_GENERATOR='NMake Makefiles',\r
+                MAKECMD='cd build/llvm/ && nmake')\r
+else:\r
+    llvm.Append(CMAKE_GENERATOR='Unix Makefiles',\r
+                MAKECMD='make -C build/llvm/')\r
+\r
+llvm.Command('build/llvm/Makefile',\r
+             'source/vendor/llvm-3.4.2/',\r
+             'cd ${TARGET.dir} && cmake -G"${CMAKE_GENERATOR}" ../../${SOURCE}')\r
+llvm.Command('build/llvm/Release+Assert/bin/llc',\r
+             'build/llvm/Makefile',\r
+             '${MAKECMD}')\r
+\r
+#------------------------------------------------------------------------------\r
+# SCLPL Targets\r
+#------------------------------------------------------------------------------\r
+\r
+# SOF Shared Library\r
+#c_cpp.SharedLibrary('build/sof', find_files('source/libsof/','*.c'))\r
+\r
+# SBC Shared Library\r
+#c_cpp.SharedLibrary('build/sbc', find_files('source/libsbc/','*.c'))\r
+\r
+# readsof Command Line Utility\r
+#readsof = c_cpp.Clone(CPPPATH = [ 'source/libsof/' ],\r
+#                      LIBS    = [ 'sof' ],\r
+#                      LIBPATH = [ 'build' ])\r
+#readsof.Program('build/readsof', find_files('source/readsof/','*.c'))\r
+#readsof.Depends('readsof', 'sof')\r
+\r
+# SCLPL Compiler\r
+SchemeBuildAndTest( 'build/bin/slc',\r
+                    find_files('source/slc/','*.scm'),\r
+                    find_files('tests/slc/','*.scm') )\r
+\r
+# SCLPL Package Manager\r
+SchemeBuildAndTest( 'build/bin/slpkg',\r
+                    find_files('source/slpkg/','*.scm'),\r
+                    find_files('tests/slpkg/','*.scm') )\r
+\r
+# SCLPL Assembler\r
+SchemeBuildAndTest( 'build/bin/slas',\r
+                    find_files('source/slas/','*.scm'),\r
+                    find_files('tests/slas/','*.scm') )\r
+\r
+# SCLPL Virtual Machine\r
+#----------------------\r
+# Virtual Machine Kernel\r
+nostdlib.StaticLibrary('build/lib/vmkernel', glob.glob('source/slvm/kernel/*.c'))\r
+\r
+# Standard Platform Library (C99)\r
+c_cpp.StaticLibrary('build/lib/stdpf',\r
+                    glob.glob('source/slvm/platforms/C99/*.c'),\r
+                    CPPPATH = ['source/slvm/kernel'])\r
+\r
+# VM Executable Using Standard Platform\r
+c_cpp.Program('build/bin/slvm', [], LIBS = ['vmkernel', 'stdpf'])\r
+\r
+# Build all VM Extensions\r
+for ext in glob.glob('source/slvm/extensions/*/'):\r
+    name = os.path.basename(ext.strip('\\/'))\r
+    c_cpp.StaticLibrary('build/lib/'+name+'ext',\r
+                        glob.glob(ext + '/*.c'),\r
+                        CPPPATH = ['source/slvm/kernel'],\r
+                        LIBS = ['stdpf'])\r
+\r
index 34781d639287805c80cb00250d001627324ef0a2..1e7fa2e1d21f2fe7f1fae8267a56b87eef66b72e 100644 (file)
@@ -4,12 +4,13 @@
   $Revision$\r
   $HeadURL$\r
 */\r
+#include "slvm.h"\r
 #include "pal.h"\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 \r
-static val_t AStack[STACK_SIZE];\r
-static val_t RStack[STACK_SIZE];\r
+static val_t AStack[ARG_STACK_SIZE];\r
+static val_t RStack[ARG_STACK_SIZE];\r
 static bool Line_Read = true;\r
 \r
 val_t* ArgStack = AStack - 1;\r
diff --git a/source/vendor/llvm-3.4.2/projects/LLVMBuild.txt b/source/vendor/llvm-3.4.2/projects/LLVMBuild.txt
new file mode 100644 (file)
index 0000000..3c24d1a
--- /dev/null
@@ -0,0 +1,21 @@
+;===- ./projects/LLVMBuild.txt ---------------------------------*- Conf -*--===;
+;
+;                     The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Group
+name = Projects
+parent = $ROOT
diff --git a/source/vendor/llvm-3.4.2/projects/Makefile b/source/vendor/llvm-3.4.2/projects/Makefile
deleted file mode 100644 (file)
index f00425f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-##===- projects/Makefile ------------------------------*- Makefile -*-===##
-# 
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-# 
-##===----------------------------------------------------------------------===##
-LEVEL=..
-
-include $(LEVEL)/Makefile.config
-
-# Compile all subdirs, except for the test suite, which lives in test-suite.
-# Before 2008.06.24 it lived in llvm-test, so exclude that as well for now.
-DIRS:= $(filter-out llvm-test test-suite,$(patsubst $(PROJ_SRC_DIR)/%/Makefile,%,$(wildcard $(PROJ_SRC_DIR)/*/Makefile)))
-
-# Don't build compiler-rt, it isn't designed to be built directly.
-DIRS := $(filter-out compiler-rt,$(DIRS))
-
-# Don't build libcxx, it isn't designed to be built directly.
-DIRS := $(filter-out libcxx,$(DIRS))
-
-# DragonEgg may be checked out here but doesn't (yet) build directly.
-DIRS := $(filter-out dragonegg,$(DIRS))
-
-# Sparc cannot link shared libraries (libtool problem?)
-ifeq ($(ARCH), Sparc)
-DIRS := $(filter-out sample, $(DIRS))
-endif
-
-include $(PROJ_SRC_ROOT)/Makefile.rules