dump-build-information/Makefile

16 lines
612 B
Makefile
Raw Permalink Normal View History

2017-08-27 11:19:39 +00:00
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