summaryrefslogtreecommitdiff
path: root/sys-fs/sdformatlinux/files/sdFormatLinux-0.2.0-unhardcode-compiler-flags.patch
blob: 59dad963d6ff939876ab23dd80870076fe8eecf5 (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
Make it possible to specify custom CFLAGS/CXXFLAGS/etc in the environment

Also remove problematic flags that override distribution toolchain
configurations (even though they are equivalent right now).

--- sdFormatLinux-0.2.0.orig/Makefile
+++ sdFormatLinux-0.2.0/Makefile
@@ -5,32 +5,32 @@
 BUILD    := build
 INCLUDES := include
 SOURCES  := source
-DEFINES  := -D_FORTIFY_SOURCE=2
+DEFINES  :=
 
 
 # Compiler settings
 ARCH     :=
-CFLAGS   := $(ARCH) -std=c17 -O2 -g -fPIE -fstrict-aliasing \
-			-ffunction-sections -fdata-sections -fstack-protector-strong \
-			-Wall -Wextra -Wstrict-aliasing=2
-CXXFLAGS := $(ARCH) -std=c++20 -O2 -g -fPIE -fstrict-aliasing \
-			-ffunction-sections -fdata-sections -fstack-protector-strong \
-			-Wall -Wextra -Wstrict-aliasing=2
-ASFLAGS  := $(ARCH) -O2 -g -fPIE -x assembler-with-cpp
+CFLAGS   := $(ARCH) -std=c17 -O2 -g -fstrict-aliasing \
+			-ffunction-sections -fdata-sections \
+			-Wall -Wextra -Wstrict-aliasing=2 $(CFLAGS)
+CXXFLAGS := $(ARCH) -std=c++20 -O2 -g -fstrict-aliasing \
+			-ffunction-sections -fdata-sections \
+			-Wall -Wextra -Wstrict-aliasing=2 $(CXXFLAGS)
+ASFLAGS  := $(ARCH) -O2 -g -x assembler-with-cpp $(ASFLAGS)
 ARFLAGS  := -rcs
-LDFLAGS  := $(ARCH) -O2 -s -pie -fPIE -Wl,--gc-sections,-z,relro,-z,now,-z,noexecstack
+LDFLAGS  := $(ARCH) -O2 -Wl,--gc-sections $(LDFLAGS)
 
 PREFIX   :=
 ifneq ($(strip $(USE_CLANG)),)
-CC       := $(PREFIX)clang
-CXX      := $(PREFIX)clang++
-AS       := $(PREFIX)clang
-AR       := $(PREFIX)gcc-ar
+CC       ?= $(PREFIX)clang
+CXX      ?= $(PREFIX)clang++
+AS       ?= $(PREFIX)clang
+AR       ?= $(PREFIX)gcc-ar
 else
-CC       := $(PREFIX)gcc
-CXX      := $(PREFIX)g++
-AS       := $(PREFIX)gcc
-AR       := $(PREFIX)gcc-ar
+CC       ?= $(PREFIX)gcc
+CXX      ?= $(PREFIX)g++
+AS       ?= $(PREFIX)gcc
+AR       ?= $(PREFIX)gcc-ar
 endif
 
 
@@ -107,4 +107,4 @@
 	@echo $(notdir $@)
 	$(AR) $(ARFLAGS) $@ $^
 
-endif
\ No newline at end of file
+endif