From 873d74a56f10209a945cfb9575c3e990e89e0164 Mon Sep 17 00:00:00 2001 From: Joshua Phillips Date: Wed, 7 Jan 2009 13:41:16 +0000 Subject: [PATCH] scons --> make --- .gitignore | 3 +-- Makefile | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ SConscript | 14 ------------ SConstruct | 32 --------------------------- modules/SConscript | 6 ----- 5 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 Makefile delete mode 100644 SConscript delete mode 100644 SConstruct delete mode 100644 modules/SConscript diff --git a/.gitignore b/.gitignore index f06a2fa..de13237 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ build/ -scache.conf -.sconsign.dblite +.depends.mak diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6b1948e --- /dev/null +++ b/Makefile @@ -0,0 +1,64 @@ +.POSIX: +.SILENT: + +## TOOLS ## + +CC := gcc +LD := gcc +MAKEDEPEND := makedepend + +## OPTIONS ## + +BUILDDIR := build/ +CPPDEFINE := _GNU_SOURCE _POSIX_SOURCE +CPPPATH := . +CFLAGS := -Wall -Werror -std=c99 -pedantic -O3 -g -ffunction-sections +LDFLAGS := -Wl,--gc-sections + +## SOURCES ## + +progname := aftubes + +subdirs := modules/ + +sources := aformat.c buffer.c errors.c graph.c main.c sound-ioctl.c soundout.c \ + wavefile.c \ + $(addprefix modules/,convert.c mixer.c playsink.c ringmod.c wavesource.c) + +## RULES ## + +hackydir := `gcc -print-search-dirs | grep install | cut -d" " -f2`/include +CPPFLAGS := $(addprefix -I,$(CPPPATH)) $(addprefix -D,$(CPPDEFINE)) +CFLAGS := $(CPPFLAGS) $(CFLAGS) +objects := $(addprefix $(BUILDDIR), $(sources:.c=.o)) + +green := \033[32m +ungreen := \033[0m + +.PHONY: all +all: makedirs $(BUILDDIR)$(progname) + +.PHONY: makedirs +makedirs: + mkdir -p $(addprefix $(BUILDDIR),$(subdirs)) + +$(BUILDDIR)$(progname): $(objects) + printf " Linking $(green)$@$(ungreen)\n" + $(LD) $(LDFLAGS) -o $@ $(objects) + +ifneq ($(MAKECMDGOALS),clean) +-include .depends.mak +endif + +.depends.mak: + printf " Scanning $(green)all source files$(ungreen)\n" + $(MAKEDEPEND) -I/usr/ -I$(hackydir) $(CPPFLAGS) -f- -p"$@ $(BUILDDIR)" $(sources) > $@ + +$(BUILDDIR)%.o: %.c + printf " Compiling $(green)$@$(ungreen)\n" + $(CC) $(CFLAGS) -c -o $@ $< + +.PHONY: clean +clean: + printf " Deleting $(green)all objects$(ungreen)\n" + $(RM) -r $(BUILDDIR) diff --git a/SConscript b/SConscript deleted file mode 100644 index fb9fa4b..0000000 --- a/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -import os.path -Import(['env']) - -program = env.Program('main', -['main.c', 'wavefile.c', 'soundout.c', 'aformat.c', 'sound-ioctl.c', -'graph.c', 'errors.c', 'buffer.c'], -LIBS = env['LIBS'] + ['modules'], -LIBPATH = ['modules']) - -env.SConscript('modules/SConscript', - exports = ['env']) - -#env.Command('#aftubes', program, -# Copy('$TARGET', '$SOURCE')) diff --git a/SConstruct b/SConstruct deleted file mode 100644 index f70870e..0000000 --- a/SConstruct +++ /dev/null @@ -1,32 +0,0 @@ -# Build options -opts = Options('scache.conf') -opts.AddOptions( - PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'), - PathOption('DESTDIR', 'Set the installation root', '/'), - ('BUILDDIR', 'Set the sub-directory to put object files in', 'build'), - ('CC', 'Set the C compiler to use'), - ('LINK', 'Set the linker to use'), - ('CFLAGS', 'Change the flags for the compiler', '-Wall -std=c99 -pedantic -O3 -g -ffunction-sections'), - ('LINKFLAGS', 'Change the flags for the linker', '-Wl,--gc-sections'), - BoolOption('verbose', 'Show full commands during the build process', False), -) - -env = Environment(options = opts) -Help(opts.GenerateHelpText(env)) -opts.Save('scache.conf', env) - -env['LIBS'] = ['m'] -env['CPPPATH'] = ['#'] -env['CPPDEFINES'] = {'_POSIX_SOURCE': None, '_GNU_SOURCE': None} - -# Pretty coloured output -if not env['verbose']: - env['CCCOMSTR'] = ' Compiling $TARGET' - env['LINKCOMSTR'] = ' Linking $TARGET' - env['ARCOMSTR'] = ' Archiving $TARGET' - env['RANLIBCOMSTR'] = ' Indexing $TARGET' - -SConscript('SConscript', - exports = ['env'], - build_dir = env['BUILDDIR'], - duplicate = 0) diff --git a/modules/SConscript b/modules/SConscript deleted file mode 100644 index f556721..0000000 --- a/modules/SConscript +++ /dev/null @@ -1,6 +0,0 @@ -import os.path -Import(['env']) - -env.StaticLibrary('modules', -['playsink.c', 'wavesource.c', 'mixer.c', 'ringmod.c', -'convert.c']) -- 2.11.4.GIT