1 # $Id: compiler.mk,v 1.6 2019/09/28 17:12:00 sjg Exp $
3 # @(#) Copyright (c) 2019, Simon J. Gerraty
5 # This file is provided in the hope that it will
6 # be of use. There is absolutely NO WARRANTY.
7 # Permission to copy, redistribute or otherwise
8 # use this file is hereby granted provided that
9 # the above copyright notice and this notice are
12 # Please send copies of changes and bug-fixes to:
16 .if !target(__${.PARSEFILE}__)
19 .if ${MACHINE} == "common"
23 .if empty(COMPILER_TYPE) || empty(COMPILER_VERSION)
24 # gcc does not always say gcc
25 _v != ${CC} --version 2> /dev/null | \
26 egrep -i 'clang|cc|[1-9]\.[0-9]|Free Software Foundation'
27 .if empty(COMPILER_TYPE)
28 .if ${_v:Mclang} != ""
30 .elif ${_v:M[Gg][Cc][Cc]} != "" || ${_v:MFoundation*} != ""
34 .if empty(COMPILER_VERSION)
35 COMPILER_VERSION != echo "${_v:M[1-9].[0-9]*}:[1]" | \
36 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
40 # just in case we don't recognize compiler
41 COMPILER_TYPE ?= unknown