|
|
|
SRC=$(wildcard src/*.cpp)
|
|
|
|
INCLUDE =include
|
|
|
|
_HX_FEAT?= -DFIXED_ROW_SIZE=24
|
|
|
|
|
|
|
|
CXXFLAGS?= -pipe -O3 -march=native
|
|
|
|
CXXFLAGS+= -flto -felide-constructors -fgraphite -fno-strict-aliasing
|
|
|
|
CXXFLAGS+= -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE))
|
|
|
|
LDFLAGS?= -O3 -flto
|
|
|
|
LDFLAGS+= -lfmt
|
|
|
|
|
|
|
|
PROJ = hexview
|
|
|
|
|
|
|
|
OBJ = $(addprefix obj/,$(SRC:.cpp=.o))
|
|
|
|
PROF_OBJ = $(addprefix profile/,$(SRC:.cpp=.o))
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: dirs $(PROJ)
|
|
|
|
|
|
|
|
dirs:
|
|
|
|
@mkdir -p obj/src
|
|
|
|
@mkdir -p profile/src
|
|
|
|
|
|
|
|
obj/%.o: %.cpp
|
|
|
|
$(CXX) -c $< $(_HX_FEAT) $(CXXFLAGS) -o $@ $(LDFLAGS)
|
|
|
|
|
|
|
|
profile/%.o: %.cpp
|
|
|
|
$(CXX) -c $< $(_HX_FEAT) $(CXXFLAGS) -fprofile-generate -o $@ $(LDFLAGS)
|
|
|
|
|
|
|
|
$(PROJ): $(OBJ)
|
|
|
|
$(CXX) $^ $(CXXFLAGS) -o $@ $(LDFLAGS)
|
|
|
|
strip $@
|
|
|
|
|
|
|
|
pgo-generate: $(PROF_OBJ)
|
|
|
|
$(CXX) $^ $(CXXFLAGS) -fprofile-generate -o $@ $(LDFLAGS)
|
|
|
|
|
|
|
|
pgo-profile: pgo-generate
|
|
|
|
for i in {1..32}; do \
|
|
|
|
dd if=/dev/urandom of=./pgo-test bs=1024 count=1024 \
|
|
|
|
./pgo-generate ./pgo-test
|
|
|
|
done
|
|
|
|
rm ./pgo-test
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(PROJ)
|
|
|
|
rm -rf obj
|
|
|
|
rm -rf profile
|
|
|
|
rm -f pgo-generate
|