Skip to content

Commit facf92c

Browse files
committed
Don't assume AMD64/X86-64 in Makefile.
Now builds also on aarch64 out of the box.
1 parent b7f807a commit facf92c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
#ARCH:=x86-64-v3 ; github `ubuntu-latest` compiler too old. <sigh>
2-
ARCH:=native
3-
OPT=-O3 -fomit-frame-pointer -funroll-loops -fstrict-aliasing -march=$(ARCH) -mtune=native -msse4.2 -mavx
4-
LTOFLAGS=-flto -fno-fat-lto-objects -fuse-linker-plugin
1+
OPT=-O3 -fomit-frame-pointer -funroll-loops -fstrict-aliasing -march=native -mtune=native
52
WARNFLAGS=-Wall -Wextra -Wshadow -Wstrict-aliasing -Wcast-qual -Wcast-align -Wpointer-arith -Wredundant-decls -Wfloat-equal -Wswitch-enum
63
CWARNFLAGS=-Wstrict-prototypes -Wmissing-prototypes
7-
MISCFLAGS=-fstack-protector -fcf-protection -fvisibility=hidden
4+
MISCFLAGS=-fvisibility=hidden -fstack-protector
85
DEVFLAGS=-ggdb -DDEBUG -D_FORTIFY_SOURCE=3 -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function
96

7+
#
8+
# Some architecture specific flags
9+
#
10+
ARCH:=$(shell uname -m)
11+
ifeq ($(ARCH),x86_64)
12+
ARCHFLAGS=-fcf-protection -msse4.2 -mavx
13+
endif
14+
ifeq ($(ARCH),aarch64)
15+
ARCHFLAGS=-mbranch-protection=bti
16+
endif
17+
1018
AFLCC?=afl-clang-fast
1119

1220
YELLOW='\033[1;33m'
@@ -39,8 +47,8 @@ endif
3947

4048
BITWIDTH?=12
4149

42-
CFLAGS=-std=c11 $(OPT) $(CWARNFLAGS) $(WARNFLAGS) $(MISCFLAGS) -DLZW_MAX_CODE_WIDTH=$(BITWIDTH)
43-
CXXFLAGS=-std=gnu++17 -fno-rtti $(OPT) $(WARNFLAGS) $(MISCFLAGS)
50+
CFLAGS=-std=c11 $(OPT) $(CWARNFLAGS) $(WARNFLAGS) $(ARCHFLAGS) $(MISCFLAGS) -DLZW_MAX_CODE_WIDTH=$(BITWIDTH)
51+
CXXFLAGS=-std=gnu++17 -fno-rtti $(OPT) $(WARNFLAGS) $(ARCHFLAGS) $(MISCFLAGS)
4452

4553
.PHONY: clean test fuzz
4654

0 commit comments

Comments
 (0)