*.lib
*~
*.d
-
-Makefile
.sconsign.dblite
.DS_Store
.rsconscache
+sclpl
-[submodule "build-system"]
- path = build-system
- url = https://github.com/mikedlowis/build-system.git
+++ /dev/null
-source 'https://rubygems.org'\r
-\r
-gem 'rake', '>= 0'\r
-gem 'rscons', '>= 0'\r
-gem 'rspec', '>= 0'\r
-gem 'trollop', '>= 0'\r
+++ /dev/null
-GEM
- remote: https://rubygems.org/
- specs:
- diff-lcs (1.2.5)
- json (1.8.1)
- rake (10.3.2)
- rscons (1.8.1)
- json (~> 1.0)
- rspec (3.1.0)
- rspec-core (~> 3.1.0)
- rspec-expectations (~> 3.1.0)
- rspec-mocks (~> 3.1.0)
- rspec-core (3.1.7)
- rspec-support (~> 3.1.0)
- rspec-expectations (3.1.2)
- diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.1.0)
- rspec-mocks (3.1.3)
- rspec-support (~> 3.1.0)
- rspec-support (3.1.2)
- trollop (2.0)
-
-PLATFORMS
- ruby
- x86-mingw32
-
-DEPENDENCIES
- rake
- rscons
- rspec
- trollop
--- /dev/null
+#------------------------------------------------------------------------------
+# Build Configuration
+#------------------------------------------------------------------------------
+# Update these variables according to your requirements.
+
+# tools
+CC = c99
+LD = ${CC}
+
+# flags
+INCS = -Isource/
+CPPFLAGS = -D_XOPEN_SOURCE=700
+CFLAGS += ${INCS} ${CPPFLAGS}
+LDFLAGS += ${LIBS}
+
+#------------------------------------------------------------------------------
+# Build Targets and Rules
+#------------------------------------------------------------------------------
+SRCS = source/main.c \
+ source/grammar.c \
+ source/lexer.c \
+ source/parser.c \
+ source/opts.c \
+ source/pprint.c \
+ source/gc.c \
+ source/vec.c \
+ source/ast.c
+OBJS = ${SRCS:.c=.o}
+
+all: options sclpl test
+
+options:
+ @echo "Toolchain Configuration:"
+ @echo " CC = ${CC}"
+ @echo " CFLAGS = ${CFLAGS}"
+ @echo " LD = ${LD}"
+ @echo " LDFLAGS = ${LDFLAGS}"
+
+sclpl: ${OBJS}
+ @echo LD $@
+ @${LD} ${LDFLAGS} -o $@ ${OBJS}
+
+test: sclpl
+ @echo TEST $<
+ @rspec --pattern 'spec/**{,/*/**}/*_spec.rb'
+
+.c.o:
+ @echo CC $<
+ @${CC} ${CFLAGS} -c -o $@ $<
+
+clean:
+ @rm -f sclpl ${OBJS}
+
+.PHONY: all options test
+
SCLPL\r
==============================================\r
\r
- Version: 0.1\r
- Created By: Michael D. Lowis\r
- Email: mike@mdlowis.com\r
-\r
About This Project\r
----------------------------------------------\r
\r
this repository is released under the BSD 2-Clause license. The text for this\r
license can be found in the LICENSE.md file.\r
\r
-Requirements For Building\r
+Build Instructions\r
----------------------------------------------\r
-The only external dependencies currently required to build this library are as\r
-follows:\r
\r
-* Chciken Scheme\r
-* SConstruct\r
+## Build and Test the Compiler\r
\r
-Build Instructions\r
-----------------------------------------------\r
-This project uses SConstruct to build all binaries and libraries. To build the\r
-software simply execute the following command at the root of the project:\r
+Execute the following command to build the compiler executable and run all tests\r
+on it:\r
\r
- scons\r
+ make all\r
\r
-Project Files and Directories\r
-----------------------------------------------\r
+## Build the Compiler and Skip the Tests\r
\r
- build/ This is the directory where all output files will be placed.\r
- source/ The source for the project.\r
- tests/ Unit test and mock files.\r
- tools/ Tools required by the build system.\r
- Doxyfile Doxygen documentation generator configuration.\r
- LICENSE.md The software license notification.\r
- premake4.lua A premake4 configuration file for generating build scripts.\r
- project.vim A VIM script with project specific configurations.\r
- README.md You're reading this file right now!\r
+The test suite for the compiler uses Ruby and Rspec. It is conceivable that an\r
+end user may not have these dependencies installed and may therefore wish to\r
+build the compiler without fully testing it. This may be accomplished by\r
+running the following command:\r
\r
+ make sclpl\r
+++ /dev/null
-Subproject commit f1a522b4aed7c58ce3c8467ff8a00f00c3e27e64
+++ /dev/null
-#!/usr/bin/env ruby
-require './build-system/setup'
-
-def windows?
- RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
-end
-
-#------------------------------------------------------------------------------
-# Environment Definitions
-#------------------------------------------------------------------------------
-# Define the default compiler environment
-base_env = BuildEnv.new do |env|
- # Move the object files to the build dir
- env.build_dir('source','build/obj/source')
- env.build_dir('modules','build/obj/modules')
- # Compiler options
- env["CFLAGS"] += ['-DLEAK_DETECT_LEVEL=1', '--std=c99', '-Wall', '-Wextra']#, '-Werror']
- env["CPPPATH"] += Dir['modules/libcds/source/**/'] + [
- 'modules/libopts/source',
- 'source/',
- ]
-end
-
-# Define the release environment
-main_env = base_env.clone do |env|
- # Move the object files to the build dir
- env.build_dir('source','build/obj/source')
- env.build_dir('modules','build/obj/modules')
- env["CFLAGS"] += ['-O3']
-end
-
-# Define the test environment
-test_env = base_env.clone do |env|
- # Move the object files to the build dir
- env.build_dir('source','build/obj_test/source')
- env.build_dir('modules','build/obj_test/modules')
- env['CFLAGS'] += ['-O0']
- if Opts[:profile].include? "coverage"
- env['CFLAGS'] << '--coverage'
- env['LDFLAGS'] << '--coverage'
- end
-end
-
-#------------------------------------------------------------------------------
-# Release Build Targets
-#------------------------------------------------------------------------------
-# Build the compiler
-sources = FileList['source/*.c']
-main_env.Program('build/bin/sclpl', sources)
-
-#------------------------------------------------------------------------------
-# Test Build Targets
-#------------------------------------------------------------------------------
-if Opts[:profile].include? "test"
- test_env.Program('build/bin/sclpl-test', sources)
- test_env.Command('RSpec', [], 'CMD' => [
- 'rspec', '--pattern', 'spec/**{,/*/**}/*_spec.rb', '--format', 'documentation'])
-end
def cli(options, input = "")
out, err, status = Open3.capture3(
- *(['./build/bin/sclpl-test'] + options + [{:stdin_data => input}]))
+ *(['./sclpl'] + options + [{:stdin_data => input}]))
raise err unless err == ""
raise "Command returned non-zero status" unless status.success?
out