1# NAME: 2# target-flags.mk - target specific flags 3# 4# DESCRIPTION: 5# Include this macro file after all others in a makefile and 6# follow it with any target specific flag settings. 7# For each such variable v in TARGET_FLAG_VARS we set: 8#.nf 9# 10# _$v := ${$v} 11# $v = ${${v}_${.TARGET:T}:U${_$v}} 12#.fi 13# 14# This allows one to do things like: 15#.nf 16# 17# TARGET_FLAG_VARS= CFLAGS 18# .include <target-flags.mk> 19# CFLAGS_fu.o = ${_CFLAGS:N-Wall} 20#.fi 21# 22# To turn off -Wall for just the target fu.o 23# Actually CFLAGS is the default value for TARGET_FLAG_VARS. 24# 25# BUGS: 26# One must be careful to avoid creating circular references in 27# variables. The original version of this macro file did 28# elaborate things with CFLAGS. The current, simpler 29# implementation is ultimately more flexible. 30# 31# It is important that target-flags.mk is included after other 32# macro files and that target specific flags that may reference 33# _$v are set after that. 34# 35# Only works with a make(1) that does nested evaluation correctly. 36 37 38 39# RCSid: 40# $Id: target-flags.mk,v 1.9 2014/04/05 22:56:54 sjg Exp $ 41# 42# @(#) Copyright (c) 1998-2002, Simon J. Gerraty 43# 44# This file is provided in the hope that it will 45# be of use. There is absolutely NO WARRANTY. 46# Permission to copy, redistribute or otherwise 47# use this file is hereby granted provided that 48# the above copyright notice and this notice are 49# left intact. 50# 51# Please send copies of changes and bug-fixes to: 52# sjg@crufty.net 53# 54 55TARGET_FLAG_VARS?= CFLAGS 56.for v in ${TARGET_FLAG_VARS} 57.ifndef _$v 58_$v := ${$v} 59$v = ${${v}_${.TARGET:T}:U${_$v}} 60.endif 61.endfor 62 63