summaryrefslogtreecommitdiff
path: root/system/maxcso/flags.patch
blob: 3360c2de295c7f2f01af0b2a5f42b31c4ad0d0c7 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From 7b269754c70f6512fef7beb8a11f19a2fc1067fa Mon Sep 17 00:00:00 2001
From: "Unknown W. Brackets" <checkins@unknownbrackets.org>
Date: Sat, 24 Nov 2018 11:38:01 -0800
Subject: [PATCH] Allow CFLAGS/CXXFLAGS to be overridden.

---
 7zip/Makefile | 11 +++++++----
 Makefile      | 13 ++++++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/7zip/Makefile b/7zip/Makefile
index 986b1488..3909487c 100644
--- a/7zip/Makefile
+++ b/7zip/Makefile
@@ -2,8 +2,11 @@ CC ?= gcc
 CXX ?= g++
 AR ?= ar
 
-CFLAGS += -W -Wall -Wextra -O2
-CXXFLAGS += -W -Wall -Wextra -std=c++11 -O2 -ICPP
+SRC_CFLAGS = -W -Wall -Wextra
+SRC_CXXFLAGS = -W -Wall -Wextra -std=c++11 -ICPP
+
+CFLAGS ?= -O2
+CXXFLAGS ?= $(CFLAGS)
 
 7ZIP_CXX_SRC = CPP/7zip/Archive/Common/ParseProperties.cpp \
                CPP/7zip/Archive/DeflateProps.cpp \
@@ -33,10 +36,10 @@ CXXFLAGS += -W -Wall -Wextra -std=c++11 -O2 -ICPP
 7ZIP_C_OBJ =   $(7ZIP_C_SRC:.c=.o)
 
 %.o: %.cpp
-	$(CXX) -c $(CXXFLAGS) -o $@ $<
+	$(CXX) -c $(SRC_CXXFLAGS) $(CXXFLAGS) -o $@ $<
 
 %.o: %.c
-	$(CC) -c $(CFLAGS) -o $@ $<
+	$(CC) -c $(SRC_CFLAGS) $(CFLAGS) -o $@ $<
 
 7zip.a: $(7ZIP_CXX_OBJ) $(7ZIP_C_OBJ)
 	$(AR) rcs $@ $^
diff --git a/Makefile b/Makefile
index 70870e23..5368d4d6 100644
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,11 @@ MANDIR ?= $(PREFIX)/share/man
 CC ?= gcc
 CXX ?= g++
 
-CFLAGS += -W -Wall -Wextra -O2 -Wno-implicit-function-declaration -DNDEBUG=1
-CXXFLAGS += -W -Wall -Wextra -std=c++11 -O2 -Izopfli/src -I7zip -DNDEBUG=1 \
+CFLAGS ?= -O2
+CXXFLAGS ?= $(CFLAGS)
+
+SRC_CFLAGS += -W -Wall -Wextra -Wno-implicit-function-declaration -DNDEBUG=1
+SRC_CXXFLAGS += -W -Wall -Wextra -std=c++11 -Izopfli/src -I7zip -DNDEBUG=1 \
 	-Wno-unused-parameter -pthread
 
 SRC_CXX_SRC = $(wildcard src/*.cpp)
@@ -22,13 +25,13 @@ ZOPFLI_C_SRC = zopfli/src/zopfli/blocksplitter.c zopfli/src/zopfli/cache.c \
 ZOPFLI_C_OBJ = $(ZOPFLI_C_SRC:.c=.o)
 
 %.o: %.cpp
-	$(CXX) -c $(CXXFLAGS) -o $@ $<
+	$(CXX) -c $(SRC_CXXFLAGS) $(CXXFLAGS) -o $@ $<
 
 %.o: %.c
-	$(CC) -c $(CFLAGS) -o $@ $<
+	$(CC) -c $(SRC_CFLAGS) $(CFLAGS) -o $@ $<
 
 maxcso: $(SRC_CXX_OBJ) $(CLI_CXX_OBJ) $(ZOPFLI_C_OBJ) 7zip/7zip.a
-	$(CXX) -o $@ $(CXXFLAGS) $^ -luv -llz4 -lz
+	$(CXX) -o $@ $(SRC_CXXFLAGS) $(CXXFLAGS) $^ -luv -llz4 -lz
 
 7zip/7zip.a:
 	$(MAKE) -C 7zip 7zip.a