From: Michael D. Lowis Date: Sun, 29 Nov 2015 21:34:09 +0000 (-0500) Subject: Switched to a simple posix-compliant makefile. Stop trying to be fancy. X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b8798e3aa4d77a81b95ee811ed45a2a1e003c293;p=projs%2Fatf.git Switched to a simple posix-compliant makefile. Stop trying to be fancy. --- diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 33d8a5b..0000000 --- a/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -source "http://rubygems.org" - -gem "rscons" -gem "rake" diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index b932f82..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,14 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - json (1.8.1) - rake (10.3.2) - rscons (1.6.0) - json (~> 1.0) - -PLATFORMS - ruby - -DEPENDENCIES - rake - rscons diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f628280 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +#------------------------------------------------------------------------------ +# Build Configuration +#------------------------------------------------------------------------------ +# Update these variables according to your requirements. + +# tools +CC = c99 +LD = ${CC} +AR = ar + +# flags +INCS = -Isource/ -Itests/ +CPPFLAGS = -D_XOPEN_SOURCE=700 +CFLAGS += ${INCS} ${CPPFLAGS} +LDFLAGS += ${LIBS} +ARFLAGS = rcs + +#------------------------------------------------------------------------------ +# Build Targets and Rules +#------------------------------------------------------------------------------ +SRCS = source/atf.c +OBJS = ${SRCS:.c=.o} +TEST_SRCS = tests/main.c tests/test_signals.c +TEST_OBJS = ${TEST_SRCS:.c=.o} + +all: options libatf.a testatf + +options: + @echo "Toolchain Configuration:" + @echo " CC = ${CC}" + @echo " CFLAGS = ${CFLAGS}" + @echo " LD = ${LD}" + @echo " LDFLAGS = ${LDFLAGS}" + @echo " AR = ${AR}" + @echo " ARFLAGS = ${ARFLAGS}" + +libatf.a: ${OBJS} + @echo AR $@ + @${AR} ${ARFLAGS} $@ ${OBJS} + +testatf: ${TEST_OBJS} libatf.a + @echo LD $@ + @${LD} -o $@ ${TEST_OBJS} libatf.a ${LDFLAGS} + -./$@ + @echo "Note: It is expected that exactly 2 of the tests will fail." + +.c.o: + @echo CC $< + @${CC} ${CFLAGS} -c -o $@ $< + +clean: + @rm -f libatf.a testatf ${OBJS} ${TEST_OBJS} + +.PHONY: all options + diff --git a/Rakefile b/Rakefile deleted file mode 100644 index c8a57e2..0000000 --- a/Rakefile +++ /dev/null @@ -1,58 +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' - -#------------------------------------------------------------------------------ -# Envrionment Definitions -#------------------------------------------------------------------------------ -# Define the compiler environment -Env = Rscons::Environment.new do |env| - env.build_dir('source/','build/obj/source') - env["CFLAGS"] += ['-Wall', '-Wextra', '-Werror', '-pedantic', '--std=c89'] - 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['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/libatf.a', Dir['source/**/*.c']) - Env.process -end - -#------------------------------------------------------------------------------ -# Unit Testing Targets -#------------------------------------------------------------------------------ -desc "Run all unit tests" -task :test do - TestEnv.Program('build/test_libatf', Dir['source/**/*.c', 'tests/**/*.c']) - TestEnv.process - sh "build/test_libatf" -end - -#------------------------------------------------------------------------------ -# Cleanup Target -#------------------------------------------------------------------------------ -desc "Clean all generated files and directories" -task(:clean) { Rscons.clean } -