Tuesday, May 27, 2014

Makefile - Checking Build Compiler Version

Building executable from sources is made easy by Makefiles. If a build has to be done by checking the version of the build compiler, then the Makefile can be altered for that.

For example, building C sources using GCC compiler. If the C sources require the C++11 standard supported compiler, then the GCC compiler to be used should be greater than or equal to GCC-4.7. If the build environment has the GCC of version lesser than 4.7, then the build will fail.

For this case, the Makefile can be altered with the following check for GCC version:

GCCMAJORVERSIONGTE4 := $(shell expr `gcc -dumpversion | cut -f1 -d.` \>= 4)
GCCMINORVERSIONGTE7 := $(shell expr `gcc -dumpversion | cut -f2 -d.` \>= 7)

all:
ifeq ($(GCCMAJORVERSIONGTE4)$(GCCMINORVERSIONGTE7), 11)
        @echo BUILD
else
        @echo NO BUILD
endif

1 comment:

Tomminy said...

iDealshare VideoGo is just the right MKV to Sony Bravia TV Converter! Besides converting MKV to Sony TV format, it also supports converting other video like MOV, FLV, Xvid, AVI, RMVB, RM, TS, VOB, 3GP, 3G2, OGV, MVC, DV, MXF, and etc to Sony Bravia and other Sony TV model supported video format.https://www.idealshare.net/video-converter/play-mkv-on-sony-bravia-tv.html