From 6ec237117ec3fdae6f3aacf3b0a9862ec1994bfa Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Fri, 11 Dec 2015 16:43:29 +0000 Subject: [PATCH] Switched build over to plain-old Makefile --- .gitignore | 3 +-- .gitmodules | 3 --- Gemfile | 6 ----- Gemfile.lock | 31 ------------------------ Makefile | 55 ++++++++++++++++++++++++++++++++++++++++++ README.md | 36 +++++++++------------------- build-system | 1 - build.rb | 58 --------------------------------------------- spec/spec_helper.rb | 2 +- 9 files changed, 68 insertions(+), 127 deletions(-) delete mode 100644 Gemfile delete mode 100644 Gemfile.lock create mode 100644 Makefile delete mode 160000 build-system delete mode 100755 build.rb diff --git a/.gitignore b/.gitignore index ccc2726..0b742e6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,7 @@ cscope.out *.lib *~ *.d - -Makefile .sconsign.dblite .DS_Store .rsconscache +sclpl diff --git a/.gitmodules b/.gitmodules index 7012a59..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "build-system"] - path = build-system - url = https://github.com/mikedlowis/build-system.git diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 9281343..0000000 --- a/Gemfile +++ /dev/null @@ -1,6 +0,0 @@ -source 'https://rubygems.org' - -gem 'rake', '>= 0' -gem 'rscons', '>= 0' -gem 'rspec', '>= 0' -gem 'trollop', '>= 0' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index dbafdb2..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,31 +0,0 @@ -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 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ee0869b --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +#------------------------------------------------------------------------------ +# 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 + diff --git a/README.md b/README.md index 27207bd..4a7c231 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ SCLPL ============================================== - Version: 0.1 - Created By: Michael D. Lowis - Email: mike@mdlowis.com - About This Project ---------------------------------------------- @@ -14,31 +10,21 @@ Unless explicitly stated otherwise, all code and documentation contained within this repository is released under the BSD 2-Clause license. The text for this license can be found in the LICENSE.md file. -Requirements For Building +Build Instructions ---------------------------------------------- -The only external dependencies currently required to build this library are as -follows: -* Chciken Scheme -* SConstruct +## Build and Test the Compiler -Build Instructions ----------------------------------------------- -This project uses SConstruct to build all binaries and libraries. To build the -software simply execute the following command at the root of the project: +Execute the following command to build the compiler executable and run all tests +on it: - scons + make all -Project Files and Directories ----------------------------------------------- +## Build the Compiler and Skip the Tests - build/ This is the directory where all output files will be placed. - source/ The source for the project. - tests/ Unit test and mock files. - tools/ Tools required by the build system. - Doxyfile Doxygen documentation generator configuration. - LICENSE.md The software license notification. - premake4.lua A premake4 configuration file for generating build scripts. - project.vim A VIM script with project specific configurations. - README.md You're reading this file right now! +The test suite for the compiler uses Ruby and Rspec. It is conceivable that an +end user may not have these dependencies installed and may therefore wish to +build the compiler without fully testing it. This may be accomplished by +running the following command: + make sclpl diff --git a/build-system b/build-system deleted file mode 160000 index f1a522b..0000000 --- a/build-system +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f1a522b4aed7c58ce3c8467ff8a00f00c3e27e64 diff --git a/build.rb b/build.rb deleted file mode 100755 index ee96dd0..0000000 --- a/build.rb +++ /dev/null @@ -1,58 +0,0 @@ -#!/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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6913d97..20f0b84 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ require 'open3' 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 -- 2.52.0