From b46aca1241df7bf23bfce6c28b6db203525340ac Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Thu, 6 Nov 2014 17:18:02 +0000 Subject: Initial simplified build system based on GNU Make --- src/Makefile.am | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/Makefile.am (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 84cbb84..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -if BUILD_OOURA -OOURA = ooura/fftsg.c -else -OOURA = -ACCELERATE_FLAGS = -framework Accelerate -endif - -SOURCES = libxtract.c \ - descriptors.c \ - scalar.c \ - vector.c \ - delta.c \ - init.c \ - window.c \ - fini.c \ - helper.c \ - stateful.c \ - c-ringbuf/ringbuf.c \ - dywapitchtrack/dywapitchtrack.c \ - $(OOURA) - -lib_LTLIBRARIES = libxtract.la -libxtract_la_CFLAGS = -libxtract_la_SOURCES = $(SOURCES) -libxtract_la_LDFLAGS = -export-dynamic $(ACCELERATE_FLAGS) - -EXTRA_DIST = xtract_globals_private.h \ - xtract_macros_private.h \ - xtract_window_private.h -- cgit v1.2.3 From df68c095949b4a5d1bad697e2785bd9cd8661f52 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Fri, 7 Nov 2014 12:45:35 +0000 Subject: Add examples to new build system --- src/Make.config | 6 ++++ src/Makefile | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 src/Make.config create mode 100644 src/Makefile (limited to 'src') diff --git a/src/Make.config b/src/Make.config new file mode 100644 index 0000000..036344a --- /dev/null +++ b/src/Make.config @@ -0,0 +1,6 @@ +NAME := xtract +DIRS := src src/c-ringbuf src/ooura src/dywapitchtrack + +ifeq ($(PLATFORM), Darwin) + LDFLAGS = -framework Accelerate +endif diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..f120975 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,105 @@ +#### +#### Generic Makefile for C or C++ projects +#### +#### This file is public domain. +#### Jamie Bullock 2014 +#### + +################################### +### User configurable variables ### +################################### + +#### It is best not to modify this file +#### Instead override these variables in a separate Make.config file if needed + +# The name of the product to build (default uses parent directory name) +NAME ?= $(notdir $(CURDIR)) +# The file suffix of source files, can be .c or .cpp +SUFFIX ?= .c +# List of directories containing source files to be compiled +DIRS ?= . +# Flags to pass to the compiler for release builds +FLAGS ?= -O3 +# Flags to pass to the compiler for debug builds +DEBUG_FLAGS ?= -O0 -g +# Flags to pass to the linker +LDFLAGS ?= +# Type of product to build: "shared" for a shared library, "static" for a static library, empty for standalone +LIBRARY ?= static +# Prefix to the path that the "install" target will install into. libs to $(PREFIX)/lib, executables to $(PREFIX)/bin +PREFIX ?= /usr/local + +############################################## +### Do not modify anything below this line ### +############################################## + +ifeq ($(OS),Windows_NT) +else + PLATFORM := $(shell uname -s) +endif + +-include Make.config + +OUT_DIR := .build +SRC := $(foreach dir, $(DIRS), $(wildcard $(dir)/*$(SUFFIX))) +OBJ_ := $(SRC:$(SUFFIX)=.o) +OBJ := $(addprefix $(OUT_DIR)/,$(OBJ_)) +DEPS := $(OBJ:.o=.d) +SHARED_SUFFIX := dll +STATIC_SUFFIX := lib +INSTALL_DIR := $(PREFIX)/lib + +ifeq "$(PLATFORM)" "Darwin" + SHARED_SUFFIX := dylib + STATIC_SUFFIX := a +endif + +ifeq "$(PLATFORM)" "Linux" + SHARED_SUFFIX := so + STATIC_SUFFIX := a +endif + +ifeq "$(LIBRARY)" "shared" + OUT=lib$(NAME).$(SHARED_SUFFIX) + LDFLAGS += -shared +else ifeq "$(LIBRARY)" "static" + OUT=lib$(NAME).$(STATIC_SUFFIX) +else + OUT=$(NAME) + INSTALL_DIR := $(PREFIX)/bin +endif + +ifeq "$(SUFFIX)" ".cpp" + COMPILER := $(CXX) +else ifeq "$(SUFFIX)" ".c" + COMPILER := $(CC) +endif + +.SUFFIXES: +.PHONY: debug clean install uninstall + +$(OUT): $(OBJ) +ifeq "$(LIBRARY)" "static" + @$(AR) rcs $@ $^ +else + @$(COMPILER) $(LDFLAGS) $^ -o $@ +endif + +debug: FLAGS = $(DEBUG_FLAGS) +debug: $(OUT) + +$(OUT_DIR)/%.o: %$(SUFFIX) + @mkdir -p $(dir $@) + @$(COMPILER) $(CXXFLAGS) $(FLAGS) -MMD -MP -fPIC -c $< -o $@ + +install: $(OUT) + @install -d $(INSTALL_DIR) + @install $(OUT) $(INSTALL_DIR) + +uninstall: + @$(RM) $(INSTALL_DIR)/$(OUT) + +clean: + @$(RM) -r $(OUT) $(OUT_DIR) + +-include: $(DEPS) -- cgit v1.2.3 From 1491868aa5a263ac4724e690c0452a21dfbdf284 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Fri, 7 Nov 2014 12:46:49 +0000 Subject: Fix bug in paths --- src/Make.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Make.config b/src/Make.config index 036344a..202c0ab 100644 --- a/src/Make.config +++ b/src/Make.config @@ -1,5 +1,5 @@ NAME := xtract -DIRS := src src/c-ringbuf src/ooura src/dywapitchtrack +DIRS := . c-ringbuf ooura dywapitchtrack ifeq ($(PLATFORM), Darwin) LDFLAGS = -framework Accelerate -- cgit v1.2.3 From 920219c77cd9d7d34ec1bfceb0511eb33402483b Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Fri, 7 Nov 2014 16:11:42 +0000 Subject: Remove unmaintainable relative paths --- src/delta.c | 2 +- src/descriptors.c | 2 +- src/fini.c | 2 +- src/helper.c | 2 +- src/init.c | 2 +- src/libxtract.c | 2 +- src/scalar.c | 4 ++-- src/stateful.c | 4 ++-- src/vector.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/delta.c b/src/delta.c index c09c11a..1d6f8e9 100644 --- a/src/delta.c +++ b/src/delta.c @@ -24,7 +24,7 @@ /* xtract_delta.c: defines functions that extract a feature as a single value from more than one input vector */ #include -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" int xtract_flux(const double *data, const int N, const void *argv , double *result) { diff --git a/src/descriptors.c b/src/descriptors.c index 2bfdd35..5caf9b2 100644 --- a/src/descriptors.c +++ b/src/descriptors.c @@ -21,7 +21,7 @@ * */ -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" #include "xtract_macros_private.h" #include #include diff --git a/src/fini.c b/src/fini.c index 9d51a77..d84bdd6 100644 --- a/src/fini.c +++ b/src/fini.c @@ -23,7 +23,7 @@ /* fini.c: Contains library destructor routine */ -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" #ifdef __GNUC__ __attribute__((destructor)) void fini() diff --git a/src/helper.c b/src/helper.c index 9b10294..93fd905 100644 --- a/src/helper.c +++ b/src/helper.c @@ -25,7 +25,7 @@ #include -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" #ifdef WORDS_BIGENDIAN #define INDEX 0 diff --git a/src/init.c b/src/init.c index f7962fa..4a0467c 100644 --- a/src/init.c +++ b/src/init.c @@ -33,7 +33,7 @@ #include "fft.h" -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" #include "xtract_window_private.h" #define DEFINE_GLOBALS #include "xtract_globals_private.h" diff --git a/src/libxtract.c b/src/libxtract.c index 168b106..692a528 100644 --- a/src/libxtract.c +++ b/src/libxtract.c @@ -21,7 +21,7 @@ * */ -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" #define XTRACT_H int(*xtract[])(const double *, const int, const void *, double *) = diff --git a/src/scalar.c b/src/scalar.c index 1182618..95b296b 100644 --- a/src/scalar.c +++ b/src/scalar.c @@ -36,8 +36,8 @@ #include "dywapitchtrack/dywapitchtrack.h" -#include "../xtract/libxtract.h" -#include "../xtract/xtract_helper.h" +#include "xtract/libxtract.h" +#include "xtract/xtract_helper.h" #include "xtract_macros_private.h" #include "xtract_globals_private.h" diff --git a/src/stateful.c b/src/stateful.c index 0b607bc..3d63786 100644 --- a/src/stateful.c +++ b/src/stateful.c @@ -23,8 +23,8 @@ /* stateful.c: declares functions that extract features that require stateful data to be retained between frames */ -#include "../xtract/xtract_stateful.h" -#include "../xtract/libxtract.h" +#include "xtract/xtract_stateful.h" +#include "xtract/libxtract.h" #include "c-ringbuf/ringbuf.h" diff --git a/src/vector.c b/src/vector.c index 9c49c2c..9588dea 100644 --- a/src/vector.c +++ b/src/vector.c @@ -30,7 +30,7 @@ #include "fft.h" -#include "../xtract/libxtract.h" +#include "xtract/libxtract.h" #include "xtract_macros_private.h" #include "xtract_globals_private.h" -- cgit v1.2.3 From 254bc42e4b1093419754da4a82281653025f52b4 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Fri, 7 Nov 2014 16:12:11 +0000 Subject: Various improvements --- src/Make.config | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/Make.config b/src/Make.config index 202c0ab..75d5abe 100644 --- a/src/Make.config +++ b/src/Make.config @@ -1,5 +1,6 @@ NAME := xtract DIRS := . c-ringbuf ooura dywapitchtrack +FLAGS := -I../include ifeq ($(PLATFORM), Darwin) LDFLAGS = -framework Accelerate -- cgit v1.2.3