aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Make.config7
-rw-r--r--src/Makefile105
-rw-r--r--src/Makefile.am31
-rw-r--r--src/delta.c2
-rw-r--r--src/descriptors.c2
-rw-r--r--src/fini.c2
-rw-r--r--src/helper.c2
-rw-r--r--src/init.c2
-rw-r--r--src/libxtract.c2
-rw-r--r--src/scalar.c4
-rw-r--r--src/stateful.c4
-rw-r--r--src/vector.c2
12 files changed, 123 insertions, 42 deletions
diff --git a/src/Make.config b/src/Make.config
new file mode 100644
index 0000000..75d5abe
--- /dev/null
+++ b/src/Make.config
@@ -0,0 +1,7 @@
+NAME := xtract
+DIRS := . c-ringbuf ooura dywapitchtrack
+FLAGS := -I../include
+
+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 <jamie@jamiebullock.com>
+####
+
+###################################
+### 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)
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
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 <math.h>
-#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 <stdlib.h>
#include <string.h>
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 <stdio.h>
-#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"