update Makefiles

master
Avril 4 years ago
parent 3a32d0929e
commit cd8f8b845b
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,15 +1,15 @@
COMMON_OPT_FLAGS?= -DFROM_MAIN -O3 -march=native -pipe -flto \ COMMON_OPT_FLAGS?= -DFROM_MAIN -march=native -flto \
-march=native -fgraphite -fopenmp -floop-parallelize-all -ftree-parallelize-loops=4 \ -march=native -fgraphite -fopenmp -floop-parallelize-all -ftree-parallelize-loops=4 \
-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block \ -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block \
-fno-stack-check -fno-strict-aliasing -fno-stack-check -fno-strict-aliasing
C_OPT_FLAGS?= C_OPT_FLAGS?=
CXX_OPT_FLAGS?= -felide-constructors CXX_OPT_FLAGS?= -felide-constructors -fno-exceptions
LD_OPT_FLAGS?=-O3 -flto LD_OPT_FLAGS?=-O3 -flto
INCLUDE=$(shell pwd)/common/include INCLUDE=$(shell pwd)/common/include
COMMON_FLAGS=-Wall -pedantic $(COMMON_OPT_FLAGS) COMMON_FLAGS=-pipe -O3 -Wall -Wextra -Wstrict-aliasing -pedantic $(COMMON_OPT_FLAGS)
CFLAGS+=$(COMMON_FLAGS) --std=gnu11 $(C_OPT_FLAGS) CFLAGS+=$(COMMON_FLAGS) --std=gnu11 $(C_OPT_FLAGS)
CXXFLAGS+=$(COMMON_FLAGS) --std=gnu++20 $(CXX_OPT_FLAGS) CXXFLAGS+=$(COMMON_FLAGS) --std=gnu++20 $(CXX_OPT_FLAGS)

@ -0,0 +1,21 @@
OPT_FLAGS?= -march=native -flto \
-march=native -fgraphite -fopenmp -floop-parallelize-all -ftree-parallelize-loops=4 \
-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block \
-fno-stack-check -fno-strict-aliasing
COMMON_FLAGS?=-pipe -O3 -Wall -pedantic -Wextra -Wstrict-aliasing
C_OPT_FLAGS=$(OPT_FLAGS)
CXX_OPT_FLAGS=$(OPT_FLAGS) -felide-constructors -fno-exceptions
LD_OPT_FLAGS?=-O3 -flto
CFLAGS?=$(COMMON_FLAGS) $(C_OPT_FLAGS) --std=gnu11
CXXFLAGS?=$(COMMON_FLAGS) $(CXX_OPT_FLAGS) --std=gnu++20
LDFLAGS?=$(LD_OPT_FLAGS)
.PHONY: all
all: part1 part2

@ -5,6 +5,7 @@
#define noglobal __attribute__((const)) #define noglobal __attribute__((const))
#define noinline __attribute__((noinline)) #define noinline __attribute__((noinline))
#define cold __attribute__((cold)) #define cold __attribute__((cold))
#define fall __attribute__((fallthrough))
#ifndef DEBUG #ifndef DEBUG
#define _force_inline __attribute__((gnu_inline)) inline extern #define _force_inline __attribute__((gnu_inline)) inline extern

@ -7,13 +7,17 @@ C_OPT_FLAGS?=
CXX_OPT_FLAGS?= -felide-constructors CXX_OPT_FLAGS?= -felide-constructors
LD_OPT_FLAGS?=-O3 -flto LD_OPT_FLAGS?=-O3 -flto
INCLUDE=../common/include
COMMON_FLAGS=-Wall -pedantic $(COMMON_OPT_FLAGS) COMMON_FLAGS=-Wall -pedantic $(COMMON_OPT_FLAGS)
CFLAGS?=$(COMMMON_FLAGS) --std=gnu11 $(C_OPT_FLAGS) CFLAGS?=$(COMMMON_FLAGS) --std=gnu11 $(C_OPT_FLAGS)
CXXFLAGS?=$(COMMON_FLAGS) --std=gnu++20 $(CXX_OPT_FLAGS) CXXFLAGS?=$(COMMON_FLAGS) --std=gnu++20 $(CXX_OPT_FLAGS)
LDFLAGS?=$(LD_OPT_FLAGS) LDFLAGS?=$(LD_OPT_FLAGS)
CXXFLAGS+= -fno-exceptions
CXXFLAGS+= -fno-exceptions -I$(INCLUDE)
CFLAGS+= -I$(INCLUDE)
.PHONY: all .PHONY: all
all: part1 part2 all: part1 part2

@ -4,6 +4,8 @@
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <attrs.h>
using mod_table = std::vector<std::vector<bool> >; using mod_table = std::vector<std::vector<bool> >;
mod_table read_input(const char* _input) mod_table read_input(const char* _input)
@ -25,7 +27,7 @@ mod_table read_input(const char* _input)
{ {
switch(chr) switch(chr)
{ {
case '#': ln[i] = true; case '#': ln[i] = true; fall;
default: i++; break; default: i++; break;
} }
} }

@ -11,11 +11,13 @@ all:
part1: $(wildcard src/*.rs) part1: $(wildcard src/*.rs)
cargo build --release $(addprefix --features ,$(CARGO_FEATURE_FLAGS)) cargo build --release $(addprefix --features ,$(CARGO_FEATURE_FLAGS))
mv -f target/release/day4 $@ mv -f target/release/day4 $@
strip $@
.NOTPARALLEL: part2 .NOTPARALLEL: part2
part2: $(wildcard src/*.rs) part2: $(wildcard src/*.rs)
cargo build --release --features $@ $(addprefix --features ,$(CARGO_FEATURE_FLAGS)) cargo build --release --features $@ $(addprefix --features ,$(CARGO_FEATURE_FLAGS))
mv -f target/release/day4 $@ mv -f target/release/day4 $@
strip $@
clean: clean:
rm -f part{1,2} rm -f part{1,2}

Loading…
Cancel
Save