diff options
author | Tom Schouten <doelie@users.sourceforge.net> | 2012-11-01 23:47:27 +0000 |
---|---|---|
committer | Tom Schouten <doelie@users.sourceforge.net> | 2012-11-01 23:47:27 +0000 |
commit | 7514a663506af67f9aeab84e60428d81c942addc (patch) | |
tree | 6a471998deca0d35280d11905d2d2b168536af53 | |
parent | dd0afaa4554f62911779906cfbf585f9e6f1dd8d (diff) |
creb: proper ifdefs for __COUNTER__ macro
svn path=/trunk/externals/creb/; revision=16514
-rw-r--r-- | creb.mk | 101 | ||||
-rw-r--r-- | modules/extlib_util.h | 21 |
2 files changed, 114 insertions, 8 deletions
@@ -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)] |