shithub: opus-tools

Download patch

ref: 918515061ebe2b6321e6318d399ec3a006577638
parent: e93ec4cbb081dca40415c7251073a0ac0e8121e7
author: Ron <[email protected]>
date: Sat Jun 8 20:21:59 EDT 2013

Tidy up some of the special CPPFLAGS

So that we can see what they are actually for, and only apply them to
the files that actually need them.

--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,8 @@
 
 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/win32
 
-AM_CFLAGS = $(OGG_CFLAGS) $(Opus_CFLAGS) -DOPUSTOOLS -D_FORTIFY_SOURCE=2 -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT
+AM_CFLAGS = $(OGG_CFLAGS) $(Opus_CFLAGS)
+AM_CPPFLAGS = -D_FORTIFY_SOURCE=2
 
 bin_PROGRAMS = opusenc opusdec opusinfo
 noinst_PROGRAMS = opusrtp
@@ -49,15 +50,20 @@
 
 dist_man_MANS = man/opusenc.1 man/opusdec.1 man/opusinfo.1
 
+resampler_CPPFLAGS = -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT
+
 opusenc_SOURCES = src/opus_header.c src/opusenc.c src/picture.c src/resample.c src/audio-in.c src/diag_range.c src/flac.c src/lpc.c win32/unicode_support.c
+opusenc_CPPFLAGS = $(AM_CPPFLAGS) $(resampler_CPPFLAGS)
 opusenc_LDADD = $(OGG_LIBS) $(Opus_LIBS) -lm
 opusenc_MANS = man/opusenc.1
 
 opusdec_SOURCES = src/opus_header.c src/wav_io.c src/wave_out.c src/opusdec.c src/resample.c src/diag_range.c win32/unicode_support.c
+opusdec_CPPFLAGS = $(AM_CPPFLAGS) $(resampler_CPPFLAGS)
 opusdec_LDADD = $(OGG_LIBS) $(Opus_LIBS) -lm
 opusdec_MANS = man/opusdec.1
 
 opusinfo_SOURCES = src/opus_header.c src/opusinfo.c src/info_opus.c src/picture.c win32/unicode_support.c
+opusinfo_CPPFLAGS = $(AM_CPPFLAGS) -DOPUSTOOLS
 opusinfo_LDADD = $(OGG_LIBS)
 opusinfo_MANS = man/opusinfo.1
 
--- a/Makefile.unix
+++ b/Makefile.unix
@@ -2,7 +2,7 @@
 #Run ./configure to run autotools/autoconf.
 #This makefile exists as a fallback where autotools isn't working.
 #CC=gcc
-CFLAGS := -DPACKAGE='"opus-tools"' -DVERSION='"0.1.6git"' -DOPUSTOOLS -O2 -g -c -Wall -Wextra -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT $(CFLAGS)
+CFLAGS := -O2 -g -c -Wall -Wextra $(CFLAGS)
 INCLUDES := -I../opus/include -I/usr/include/FLAC
 
 ifneq (,$(findstring mingw,$(CC)))
@@ -19,6 +19,18 @@
 	rm -f src/*.o win32/*.o $(PROGS) opusrtp
 
 .PHONEY: all clean
+
+
+VERSIONED_OBJS = src/opusenc.o src/opusdec.o src/opusinfo.o src/opusrtp.o
+
+$(VERSIONED_OBJS): CFLAGS += -DPACKAGE_NAME='"opus-tools"' -DPACKAGE_VERSION='"0.1.6git"'
+
+RESAMPLER_CPPFLAGS = -DSPX_RESAMPLE_EXPORT= -DRANDOM_PREFIX=opustools -DOUTSIDE_SPEEX -DFLOATING_POINT
+
+src/opusdec.o src/resample.o src/audio-in.o: CFLAGS += $(RESAMPLER_CPPFLAGS)
+
+src/info_opus.o: CFLAGS += -DOPUSTOOLS
+
 
 .c.o:
 	$(CC) $(CFLAGS) $(INCLUDES) $< -o $@