dump-build-information/Makefile
2017-08-27 13:19:39 +02:00

15 lines
612 B
Makefile

CXXFLAGS += -O3
GIT_VERSION := $(shell git describe --dirty --always --tags)
COMPILER_VERSION := $(shell ${CXX} --version | head -n1)
all: get_parameters
${CXX} ${CXXFLAGS} -DGIT_VERSION="\"${GIT_VERSION}\"" -DUSED_FLAGS="\"${USED_FLAGS}\"" -DUSED_COMPILER="\"${COMPILER_VERSION}\"" main.cpp && ./a.out
compile_dummy:
${CXX} ${CXXFLAGS} -frecord-gcc-switches dummy.cpp
get_parameters: compile_dummy
$(eval USED_FLAGS := $(shell readelf -p .GCC.command.line a.out | grep -v -e dummy.cpp -e "-frecord-gcc-switches" | grep -e "\[.*\]" | cut -d\] -f2- | tr -d "\n"))
.PHONY: all get_parameters compile_dummy