]> git.mdlowis.com Git - projs/libcds.git/commitdiff
Updated readme and makefile and remove remnants of old build system
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 30 Dec 2015 02:33:25 +0000 (21:33 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 30 Dec 2015 02:33:25 +0000 (21:33 -0500)
.gitignore
Gemfile [deleted file]
Gemfile.lock [deleted file]
Makefile
README.md
Rakefile [deleted file]

index 83d69fe4f4e009d44c33684896fe1ac5b6503778..1fa4c07980dc0f8832dc24027e07462dd1987a3f 100644 (file)
@@ -4,4 +4,10 @@ project.vim
 Makefile
 build/
 *.o
+*.d
+*.gcno
+*.gcda
 .rsconscache
+config.mk
+testcds
+libcds.a
diff --git a/Gemfile b/Gemfile
deleted file mode 100644 (file)
index c8d6a78..0000000
--- a/Gemfile
+++ /dev/null
@@ -1,3 +0,0 @@
-source 'http://rubygems.org'
-gem 'rscons'
-gem 'rake'
diff --git a/Gemfile.lock b/Gemfile.lock
deleted file mode 100644 (file)
index b3f4ea9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-GEM
-  remote: http://rubygems.org/
-  specs:
-    json (1.8.2)
-    rake (10.4.2)
-    rscons (1.9.0)
-      json (~> 1.0)
-
-PLATFORMS
-  ruby
-  x86-mingw32
-
-DEPENDENCIES
-  rake
-  rscons
index acb912b2b6c70d7ec044a1c7120ffe8aba2d27fe..34f9d2f6cc245615b69aa004186d8db00a628130 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -27,35 +27,47 @@ CFLAGS   += ${INCS} ${CPPFLAGS}
 LDFLAGS  += ${LIBS}
 ARFLAGS   = rcs
 
+# commands
+COMPILE = @echo CC $@; ${CC} ${CFLAGS} -c -o $@ $<
+LINK    = @echo LD $@; ${LD} -o $@ $^ ${LDFLAGS}
+ARCHIVE = @echo AR $@; ${AR} ${ARFLAGS} $@ $^
+CLEAN   = @rm -f
+
 #------------------------------------------------------------------------------
 # Build Targets and Rules
 #------------------------------------------------------------------------------
-SRCS = source/vector/vec.c      \
-       source/map/map.c         \
-       source/string/str.c      \
-       source/rbt/rbt.c         \
-       source/mem/mem.c         \
-       source/murmur3/murmur3.c \
-       source/buffer/buf.c      \
-       source/list/list.c       \
-       source/exn/exn.c         \
-       source/set/set.c         \
-       source/cmp/cmp.c
-OBJS = ${SRCS:.c=.o}
-
-TEST_SRCS = tests/main.c      \
-            tests/test_list.c \
-            tests/test_exn.c  \
-            tests/test_str.c  \
-            tests/test_set.c  \
-            tests/test_vec.c  \
-            tests/test_rbt.c  \
-            tests/test_map.c  \
-            tests/test_buf.c  \
-            tests/test.c
-TEST_OBJS = ${TEST_SRCS:.c=.o}
-
-all: options libcds.a testcds
+LIBNAME = cds
+LIB  = lib${LIBNAME}.a
+DEPS = ${OBJS:.o=.d}
+OBJS = source/vector/vec.o      \
+       source/map/map.o         \
+       source/string/str.o      \
+       source/rbt/rbt.o         \
+       source/mem/mem.o         \
+       source/murmur3/murmur3.o \
+       source/buffer/buf.o      \
+       source/list/list.o       \
+       source/exn/exn.o         \
+       source/set/set.o         \
+       source/cmp/cmp.o
+
+TEST_BIN  = test${LIBNAME}
+TEST_DEPS = ${TEST_OBJS:.o=.d}
+TEST_OBJS = tests/main.o      \
+            tests/test_list.o \
+            tests/test_exn.o  \
+            tests/test_str.o  \
+            tests/test_set.o  \
+            tests/test_vec.o  \
+            tests/test_rbt.o  \
+            tests/test_map.o  \
+            tests/test_buf.o  \
+            tests/test.o
+
+# load user-specific settings
+-include config.mk
+
+all: options ${LIB} ${TEST_BIN} tests
 
 options:
        @echo "Toolchain Configuration:"
@@ -66,21 +78,27 @@ options:
        @echo "  AR       = ${AR}"
        @echo "  ARFLAGS  = ${ARFLAGS}"
 
-libcds.a: ${OBJS}
-       @echo AR $@
-       @${AR} ${ARFLAGS} $@ ${OBJS}
+tests: ${TEST_BIN}
+       -./$<
 
-testcds: ${TEST_OBJS} libcds.a
-       @echo LD $@
-       @${LD} -o $@ ${TEST_OBJS} libcds.a ${LDFLAGS}
-       -./$@
+clean:
+       ${CLEAN} ${LIB} ${TEST_BIN} ${OBJS} ${TEST_OBJS} ${DEPS} ${TEST_DEPS}
+       ${CLEAN} ${OBJS:.o=.gcno} ${OBJS:.o=.gcda}
+       ${CLEAN} ${TEST_OBJS:.o=.gcno} ${TEST_OBJS:.o=.gcda}
+       ${CLEAN} ${DEPS} ${TEST_DEPS}
+
+${LIB}: ${OBJS}
+       ${ARCHIVE}
+
+${TEST_BIN}: ${TEST_OBJS} ${LIB}
+       ${LINK}
 
 .c.o:
-       @echo CC $<
-       @${CC} ${CFLAGS} -c -o $@ $<
+       ${COMPILE}
 
-clean:
-       @rm -f libcds.a testcds ${OBJS} ${TEST_OBJS}
+# load dependency files
+-include ${DEPS}
+-include ${TEST_DEPS}
 
-.PHONY: all options
+.PHONY: all options tests
 
index c4d6df40627563cb8b49fa08f1b65db95005fb1a..8528cc65ca4dae3e0443e1eeb86ce14aeda121ef 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,59 +1,39 @@
-C Data Structures Lib
-=====================
+# C Data Structures Lib
 
     Created By: Michael D. Lowis & A. Bellenir
     Email:      mike@mdlowis.com; libcds@bellenir.com
 
-About This Project
-------------------
+## About This Project
+
 This library is meant to be a collection of common data structures, implemented
 in C, that can be used in any C or C++ program. The goal is to implement many
 of the same data structures that the C++ STL provides, in pure C.
 
-License
--------
+## License
+
 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
--------------------------
-The following dependencies are required for building the library and running the
-tests:
-
-* GCC
-* Ruby (>= 1.9.3)
-* Rake
-* Bundler
-
-Build Instructions
-------------------
-This project uses a combination of Rscons, Rake, and Bundler for the build
-system. The first step to building the project is to ensure the necessary
-dependencies are installed via bundler. The following command will fetch and
-install the necessary Ruby gems:
-
-    bundle install
-
-If the installation completes successfully you are all set to build the
-software. Simply execute rake from the root to run all tests and build the
-library:
-
-    rake
-
-If you would like more fine-grained control over the build you can see all
-available rake tasks with the following command:
-
-    rake -T
-
-Project Files and Directories
------------------------------
-    Gemfile        Used to specify bundler dependencies.
-    Gemfile.lock   Generated by bundler and used by Rakefile to lock dependencies.
-    LICENSE.md     The software license notification.
-    README.md      You're reading this file right now!
-    Rakefile       The main build script, used to control the build.
-    build/         This is the directory where all output files will be placed.
-    source/        The source for the project.
-    tests/         Unit test and mock files.
+## Build Instructions
+
+### Requirements For Building
+
+A POSIX-compliant implementation of Make and a C99 compatible compiler
+(appearing as the command "c99" in the path) are all that is required to build
+this project.
+
+### Configuring the Build
+
+The build is configured to build using c99 with POSIX-compliant tools and
+settings by default. These settings can be overridden using the config.mk file
+in the root of the project. This file contains a number of commented out macros
+which can be uncommented and adjusted to provide a variety of useful features
+for development.
+
+### Building
+
+Simply execute make from the root to run all tests and build the library:
+
+    make
 
diff --git a/Rakefile b/Rakefile
deleted file mode 100644 (file)
index 8f1cd2d..0000000
--- a/Rakefile
+++ /dev/null
@@ -1,74 +0,0 @@
-#------------------------------------------------------------------------------
-# Bundler Setup
-#------------------------------------------------------------------------------
-require "bundler"
-begin
-  Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
-  raise LoadError.new("Unable to Bundler.setup(): You probably need to run `bundle install`: #{e.message}")
-end
-require 'rscons'
-require 'rbconfig'
-
-#------------------------------------------------------------------------------
-# Envrionment Definitions
-#------------------------------------------------------------------------------
-# Define the compiler environment
-Env = Rscons::Environment.new do |env|
-  env.build_dir('source','build/obj/source')
-  env["CFLAGS"]  += ['--std=c99', '--pedantic', '-Wall', '-Wextra', '-Werror']
-  env['CPPPATH'] += Dir['source/**/']
-end
-
-# Define the test environment
-TestEnv = Env.clone  do |env|
-  env.build_dir('source','build/obj/test_source')
-  env.build_dir('tests','build/obj/tests/source')
-  env['CFLAGS']  += ['-g', '--coverage', '-DLEAK_DETECT_LEVEL=1', '-DTESTING']
-  env["LDFLAGS"] += ['--coverage']
-  env['CPPPATH'] += Dir['tests/']
-end
-
-# Make sure the environment is processed before we quit
-at_exit { Env.process; TestEnv.process}
-
-#------------------------------------------------------------------------------
-# Main Build Targets
-#------------------------------------------------------------------------------
-task :default => [:test, :build]
-
-desc "Build the C Data Structures static library"
-task :build do
-    Env.Library('build/libcds.a', Dir['source/**/*.c'])
-    Env.process
-end
-
-#------------------------------------------------------------------------------
-# Unit Testing Targets
-#------------------------------------------------------------------------------
-desc "Run all unit tests"
-task :test do
-    TestEnv.Program('build/test_libcds', Dir['source/**/*.c', 'tests/**/*.c'])
-    TestEnv.process
-    sh "build/test_libcds"
-end
-
-desc "Generate test coverage reports"
-task :coverage => [:test] do
-    FileList['build/obj/test_source/**/*.gcno'].each do |gcno|
-        obj  = gcno.ext('o')
-        path = File.dirname(obj)
-        gcov = File.basename(obj).ext('c.gcov')
-        sh *['gcov', '-a', '-b', '-c', obj] and FileUtils.mv("./#{gcov}","#{path}/#{gcov}")
-    end
-end
-
-#------------------------------------------------------------------------------
-# Cleanup Target
-#------------------------------------------------------------------------------
-desc "Clean all generated files and directories"
-task(:clean) { Rscons.clean }
-
-desc "Clobber all generated files and directories"
-task(:clobber) { FileUtils.rm_rf('build') }
-