File: accept-externally-specified-compiler-flags.patch

package info (click to toggle)
sffview 0.5.0-7
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 488 kB
  • sloc: cpp: 1,975; makefile: 23
file content (42 lines) | stat: -rw-r--r-- 1,169 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Description: Patch Makefile to accept externally specified compiler flags
 This patch makes Makefile use the standard CXX, CPPFLAGS, CXXFLAGS and LDFLAGS
 if set in the environment.  If they aren't set, the defaults give the
 same behaviour as previously.
 .
 This patch allows debhelper 9's automatic setting of hardening flags to
 work.
Author: Olly Betts <olly@survex.com>
Origin: debian
Forwarded: https://sourceforge.net/p/sfftools/tickets/1/
Applied-Upstream: https://sourceforge.net/p/sfftools/code-0/34/
Last-Update: 2019-05-21

--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@
 # under Linux.
 #
 
-CC = g++ 
+CXX ?= g++ 
 
 PROGRAM = sffview
 OBJECTS = $(PROGRAM).o common.o codes.o decoder.o sfffile.o sffapp.o sffdoc.o
@@ -24,13 +24,15 @@
 
 .SUFFIXES:	.o .cpp
 
+CXXFLAGS ?= -g -Os
+
 .cpp.o :
-	$(CC) -g -Os -c $(WXCONFIG_CPP) -o $@ $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(WXCONFIG_CPP) -o $@ $<
 
 all:    $(PROGRAM)
 
 $(PROGRAM):	$(OBJECTS)
-	$(CC) -o $(PROGRAM) $(OBJECTS) -Wl,--as-needed $(WXCONFIG_LD)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(PROGRAM) $(OBJECTS) -Wl,--as-needed $(WXCONFIG_LD)
 
 clean: 
 	rm -f *.o $(PROGRAM)