Package list squeezelite / 62c1310 debian / patches / Makefile-tweaks.patch
62c1310

Tree @62c1310 (Download .tar.gz)

Makefile-tweaks.patch @62c1310raw · history · blame

Description: Makefile tweaks for hardening build options
 This patch changes the Makefile to add options to CFLAGS and LDFLAGS instead of
 overriding the values from the environment, and ensures that CPPFLAGS is also
 used when building C source.
Author: Chris Boot <debian@bootc.net>
Forwarded: not-needed
Last-Update: 2013-12-28

--- squeezelite-1.4.orig/Makefile
+++ squeezelite-1.4/Makefile
@@ -1,6 +1,6 @@
 # Cross compile support - create a Makefile which defines these three variables and then includes this Makefile...
-CFLAGS  ?= -Wall -fPIC -O2 $(OPTS)
-LDFLAGS ?= -lasound -lpthread -lm -lrt
+CFLAGS  ?= -Wall -fPIC -O2
+LDADD   ?= -lasound -lpthread -lm -lrt
 EXECUTABLE ?= squeezelite
 
 # passing one or more of these in $(OPTS) enables optional feature inclusion
@@ -31,32 +31,32 @@ DEPS             = squeezelite.h slimpro
 UNAME            = $(shell uname -s)
 
 # add optional sources
-ifneq (,$(findstring $(OPT_DSD), $(CFLAGS)))
+ifneq (,$(findstring $(OPT_DSD), $(OPTS)))
 	SOURCES += $(SOURCES_DSD)
 endif
-ifneq (,$(findstring $(OPT_FF), $(CFLAGS)))
+ifneq (,$(findstring $(OPT_FF), $(OPTS)))
 	SOURCES += $(SOURCES_FF)
 endif
-ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS)))
+ifneq (,$(findstring $(OPT_RESAMPLE), $(OPTS)))
 	SOURCES += $(SOURCES_RESAMPLE)
 endif
-ifneq (,$(findstring $(OPT_VIS), $(CFLAGS)))
+ifneq (,$(findstring $(OPT_VIS), $(OPTS)))
 	SOURCES += $(SOURCES_VIS)
 endif
 
 # add optional link options
-ifneq (,$(findstring $(OPT_LINKALL), $(CFLAGS)))
-	LDFLAGS += $(LINKALL)
-ifneq (,$(findstring $(OPT_FF), $(CFLAGS)))
-	LDFLAGS += $(LINKALL_FF)
+ifneq (,$(findstring $(OPT_LINKALL), $(OPTS)))
+	LDADD += $(LINKALL)
+ifneq (,$(findstring $(OPT_FF), $(OPTS)))
+	LDADD += $(LINKALL_FF)
 endif
-ifneq (,$(findstring $(OPT_RESAMPLE), $(CFLAGS)))
-	LDFLAGS += $(LINKALL_RESAMPLE)
+ifneq (,$(findstring $(OPT_RESAMPLE), $(OPTS)))
+	LDADD += $(LINKALL_RESAMPLE)
 endif
 else
 # if not LINKALL and linux add LINK_LINUX
 ifeq ($(UNAME), Linux)
-	LDFLAGS += $(LINK_LINUX)
+	LDADD += $(LINK_LINUX)
 endif
 endif
 
@@ -65,12 +65,12 @@ OBJECTS = $(SOURCES:.c=.o)
 all: $(EXECUTABLE)
 
 $(EXECUTABLE): $(OBJECTS)
-	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
+	$(CC) $(OBJECTS) $(LDFLAGS) $(LDADD) -o $@
 
 $(OBJECTS): $(DEPS)
 
 .c.o:
-	$(CC) $(CFLAGS) $(CPPFLAGS) $< -c -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(OPTS) $< -c -o $@
 
 clean:
 	rm -f $(OBJECTS) $(EXECUTABLE)