aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--creb.mk101
-rw-r--r--modules/extlib_util.h21
2 files changed, 114 insertions, 8 deletions
diff --git a/creb.mk b/creb.mk
new file mode 100644
index 0000000..f2085cd
--- /dev/null
+++ b/creb.mk
@@ -0,0 +1,101 @@
+#!/usr/bin/make -f
+
+# Faster alternative makefile, for development only.
+SRC_C:= \
+./modules/dwt.c \
+./modules/scrollgrid1D~.c \
+./modules/diag~.c \
+./modules/statwav~.c \
+./modules/xfm~.c \
+./modules/junction~.c \
+./modules/permut~.c \
+./modules/dynwav~.c \
+./modules/dist~.c \
+./modules/setup.c \
+./modules/qmult~.c \
+./modules/ffpoly.c \
+./modules/sawtooth~.c \
+./modules/sbosc~.c \
+./modules/ratio.c \
+./modules/bitsplit~.c \
+./modules/fdn~.c \
+./modules/eblosc~.c \
+./modules/bwin~.c \
+./modules/fwarp.c \
+./modules/cmath.c \
+./modules/cheby~.c \
+./modules/blocknorm~.c \
+./modules/bdiag~.c \
+./modules/ramp~.c \
+./modules/tabreadmix~.c \
+./modules/ead~.c \
+./modules/matrix~.c \
+./modules/abs~.c \
+./modules/lattice~.c \
+./modules/resofilt~.c \
+./modules/ear~.c \
+./modules/qnorm~.c \
+./modules/eadsr~.c \
+./modules/bfft~.c \
+
+SRC_CC := \
+./modules++/blosc~.cc \
+./modules++/biquadseries~.cc \
+./modules++/filterortho~.cc \
+
+
+GCC_CFLAGS := -funroll-loops
+CC := gcc $(GCC_CFLAGS)
+CPLUSPLUS := g++ $(GCC_CFLAGS)
+# CC := clang
+# CPLUSPLUS := clang++
+
+
+CFLAGS := -DPD -DCREB_VERSION=\"0.9.2\" -fPIC -O3 -fomit-frame-pointer -Wall -W -Wno-unused -Wno-parentheses -Wno-switch
+BUILD := build
+ARCH := pd_linux
+LDFLAGS := -rdynamic -shared
+OUT := $(BUILD)/creb.$(ARCH)
+
+O := \
+ $(patsubst %.c,$(BUILD)/%.o,$(SRC_C)) \
+ $(patsubst %.cc,$(BUILD)/%.o,$(SRC_CC))
+D := $(O:.o=.d)
+
+
+.SECONDARY:
+.DELETE_ON_ERROR:
+
+.PHONY: all
+all: $(OUT)
+
+.PHONY: clean
+clean:
+ rm -rf build
+
+$(BUILD)/%.d: %.c
+ @echo [d] $(notdir $@)
+ @mkdir -p $(dir $@)
+ @$(CC) -MT $(basename $@).o -MM $(CFLAGS) $< >$@
+
+$(BUILD)/%.d: %.cc
+ @echo [d] $(notdir $@)
+ @mkdir -p $(dir $@)
+ @$(CPLUSPLUS) -MT $(basename $@).o -MM $(CFLAGS) $< >$@
+
+$(BUILD)/%.o: %.c $(BUILD)/%.d
+ @echo [o] $(notdir $@)
+ @mkdir -p $(dir $@)
+ @$(CC) $(CFLAGS) -c $< -o $@
+
+$(BUILD)/%.o: %.cc $(BUILD)/%.d
+ @echo [o] $(notdir $@)
+ @mkdir -p $(dir $@)
+ @$(CPLUSPLUS) $(CFLAGS) -c $< -o $@
+
+$(OUT): $(O)
+ @echo [pd_linux] $(notdir $@)
+ @$(CPLUSPLUS) $(LDFLAGS) -o $@ $(O) $(LIBS)
+
+-include $(D)
+
diff --git a/modules/extlib_util.h b/modules/extlib_util.h
index b1ceff1..50b0c20 100644
--- a/modules/extlib_util.h
+++ b/modules/extlib_util.h
@@ -23,14 +23,19 @@
#include <math.h>
#include "m_pd.h"
-/* Compile-time asserts. */
-/* On OSX it seems that _GENSYM(_ctassert_) expands to
- '_ctassert___COUNTER__ i.e. the __COUNTER__ built-in symbol is not
- expanded before it is concatenated. As a workaround it is disabled
- on OSX. This seems OK since CT_ASSERTs serve their purpose in the
- Linux build. */
-#ifdef __APPLE__
-#define CT_ASSERT(x)
+// __COUNTER__ is a CPP extension enabled in gcc >= 4.3
+#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ >= 3
+#define HAVE_COUNTER
+#endif
+#if defined __GNUC__ && __GNUC__ >= 5
+#define HAVE_COUNTER
+#endif
+#ifdef __clang__ // Should we check version here?
+#define HAVE_COUNTER
+#endif
+#ifndef HAVE_COUNTER
+#warning CT_ASSERT() disabled
+#define CT_ASSERT(...)
#else
#define CT_NAMED_ASSERT(name,x) \
typedef int _GENSYM(name ## _ctassert_)[-((x)==0)]