initial commit
This commit is contained in:
commit
e40bd023fb
4 changed files with 30 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
a.out
|
15
Makefile
Normal file
15
Makefile
Normal file
|
@ -0,0 +1,15 @@
|
|||
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
|
3
dummy.cpp
Normal file
3
dummy.cpp
Normal file
|
@ -0,0 +1,3 @@
|
|||
int main(){
|
||||
return 0;
|
||||
}
|
11
main.cpp
Normal file
11
main.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include <iostream>
|
||||
|
||||
void print_build_information(){
|
||||
std::cout << "Build from revision: " << GIT_VERSION << std::endl;
|
||||
std::cout << "Compiled with: " << USED_COMPILER << std::endl;
|
||||
std::cout << "With the following flags: " << USED_FLAGS << std::endl;
|
||||
}
|
||||
int main(){
|
||||
print_build_information();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue