update makefile

master
Avril 4 years ago
parent 1c40c87c2c
commit 0aaf0d8ba3
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,12 +1,16 @@
SRC=$(wildcard src/*.cpp) SRC=$(wildcard src/*.cpp)
INCLUDE =include INCLUDE =include
_HX_FEAT?= -DFIXED_ROW_SIZE=24 _HX_FEAT?= -DFIXED_ROW_SIZE=24
CXXFLAGS?= -pipe -O3 -march=native CXXFLAGS_COMMON = -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE)) -felide-constructors -fno-strict-aliasing -fno-exceptions
CXXFLAGS+= -flto -felide-constructors -fgraphite -fno-strict-aliasing -fno-exceptions -fomit-frame-pointer -fmerge-all-constants -fmodulo-sched -funswitch-loops -fsplit-loops LDFLAGS_COMMON = -lfmt
CXXFLAGS+= -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE))
LDFLAGS?= -O3 -flto CXXFLAGS_DEFAULT = -pipe -O3 -march=native -fgraphite -flto
LDFLAGS+= -lfmt CXXFLAGS_RELEASE = -fomit-frame-pointer -fmerge-all-constants -fmodulo-sched -funswitch-loops -fsplit-loops
LDFLAGS_DEFAULT = -O3 -flto
CXXFLAGS_DEBUG = -DDEBUG -O0 -g
PROJECT = hexview PROJECT = hexview
@ -43,13 +47,19 @@ obj/%.o: %.cpp
profile/%.o: %.cpp profile/%.o: %.cpp
$(CXX) -c $< $(_HX_FEAT) $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS) $(CXX) -c $< $(_HX_FEAT) $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS)
$(PROJECT)-release: CXXFLAGS?= $(CXXFLAGS_DEFAULT)
$(PROJECT)-release: LDFLAGS?= $(LDFLAGS_DEFAULT)
$(PROJECT)-release: CXXFLAGS+= $(CXXFLAGS_COMMON)
$(PROJECT)-release: CXXFLAGS+= $(CXXFLAGS_RELEASE)
$(PROJECT)-release: LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS)
$(PROJECT)-release: $(OBJ) $(PROJECT)-release: $(OBJ)
$(CXX) $^ $(CXXFLAGS) -o $@ $(LDFLAGS) $(CXX) $^ $(CXXFLAGS) -o $@ $(LDFLAGS)
strip $@ strip $@
$(PROJECT)-debug: CXXFLAGS = -DDEBUG -O0 -g -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE)) -fno-exceptions -felide-constructors $(PROJECT)-debug: CXXFLAGS += $(CXXFLAGS_COMMON)
$(PROJECT)-debug: LDFLAGS = -lfmt $(PROJECT)-debug: CXXFLAGS += $(CXXFLAGS_DEBUG)
$(PROJECT)-debug: LDFLAGS += $(LDFLAGS_COMMON)
$(PROJECT)-debug: $(OBJ) $(PROJECT)-debug: $(OBJ)
$(CXX) $^ $(CXXFLAGS) -o $@ $(LDFLAGS) $(CXX) $^ $(CXXFLAGS) -o $@ $(LDFLAGS)
@ -68,11 +78,20 @@ pgo-profile: pgo-generate
rm pgo-generate rm pgo-generate
pgo-use: CXXFLAGS?= $(CXXFLAGS_DEFAULT)
pgo-use: LDFLAGS?= $(LDFLAGS_DEFAULT)
pgo-use: CXXFLAGS+= $(CXXFLAGS_COMMON)
pgo-use: CXXFLAGS+= $(CXXFLAGS_RELEASE)
pgo-use: LDFLAGS := $(LDFLAGS_COMMON) -lgcov $(LDFLAGS)
pgo-use: PROF_FLAGS = -fprofile-use pgo-use: PROF_FLAGS = -fprofile-use
pgo-use: LDFLAGS+= -lgcov
pgo-use: $(PGO_OBJ) pgo-use: $(PGO_OBJ)
$(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS) $(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS)
$(PROJECT)-pgo: CXXFLAGS?= $(CXXFLAGS_DEFAULT)
$(PROJECT)-pgo: LDFLAGS?= $(LDFLAGS_DEFAULT)
$(PROJECT)-pgo: CXXFLAGS+= $(CXXFLAGS_COMMON)
$(PROJECT)-pgo: CXXFLAGS+= $(CXXFLAGS_RELEASE)
$(PROJECT)-pgo: LDFLAGS := $(LDFLAGS_COMMON) $(LDFLAGS)
$(PROJECT)-pgo: | dirs pgo-profile $(PROJECT)-pgo: | dirs pgo-profile
find ./profile -name \*.o -exec rm {} + find ./profile -name \*.o -exec rm {} +
$(MAKE) pgo-use $(MAKE) pgo-use

Loading…
Cancel
Save