You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hexview/Makefile

48 lines
1013 B

4 years ago
SRC=$(wildcard src/*.cpp)
INCLUDE =include
4 years ago
_HX_FEAT?= -DFIXED_ROW_SIZE=24
CXXFLAGS?= -pipe -O3 -march=native
4 years ago
CXXFLAGS+= -flto -felide-constructors -fgraphite -fno-strict-aliasing
4 years ago
CXXFLAGS+= -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE))
LDFLAGS?= -O3 -flto
LDFLAGS+= -lfmt
5 years ago
4 years ago
PROJ = hexview
5 years ago
4 years ago
OBJ = $(addprefix obj/,$(SRC:.cpp=.o))
PROF_OBJ = $(addprefix profile/,$(SRC:.cpp=.o))
4 years ago
.PHONY: all
all: dirs $(PROJ)
dirs:
@mkdir -p obj/src
@mkdir -p profile/src
4 years ago
4 years ago
obj/%.o: %.cpp
4 years ago
$(CXX) -c $< $(_HX_FEAT) $(CXXFLAGS) -o $@ $(LDFLAGS)
4 years ago
profile/%.o: %.cpp
$(CXX) -c $< $(_HX_FEAT) $(CXXFLAGS) -fprofile-generate -o $@ $(LDFLAGS)
4 years ago
$(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
4 years ago
clean:
rm -f $(PROJ)
rm -rf obj
rm -rf profile
rm -f pgo-generate