1246149Ssjg# NAME: 2246149Ssjg# target-flags.mk - target specific flags 3246149Ssjg# 4246149Ssjg# DESCRIPTION: 5246149Ssjg# Include this macro file after all others in a makefile and 6246149Ssjg# follow it with any target specfic flag settings. 7246149Ssjg# For each such variable v in TARGET_FLAG_VARS we set: 8246149Ssjg#.nf 9246149Ssjg# 10246149Ssjg# _$v := ${$v} 11246149Ssjg# $v = ${${v}_${.TARGET:T}:U${_$v}} 12246149Ssjg#.fi 13246149Ssjg# 14246149Ssjg# This allows one to do things like: 15246149Ssjg#.nf 16246149Ssjg# 17246149Ssjg# TARGET_FLAG_VARS= CFLAGS 18246149Ssjg# .include <target-flags.mk> 19246149Ssjg# CFLAGS_fu.o = ${_CFLAGS:N-Wall} 20246149Ssjg#.fi 21246149Ssjg# 22246149Ssjg# To turn off -Wall for just the target fu.o 23246149Ssjg# Actually CFLAGS is the default value for TARGET_FLAG_VARS. 24246149Ssjg# 25246149Ssjg# BUGS: 26246149Ssjg# One must be careful to avoid creating circular references in 27246149Ssjg# variables. The original version of this macro file did 28246149Ssjg# elaborate things with CFLAGS. The current, simpler 29246149Ssjg# implementation is ultimately more flexible. 30246149Ssjg# 31246149Ssjg# It is important that target-flags.mk is included after other 32246149Ssjg# macro files and that target specific flags that may reference 33246149Ssjg# _$v are set after that. 34246149Ssjg# 35246149Ssjg# Only works with a make(1) that does nested evaluation correctly. 36246149Ssjg 37246149Ssjg 38246149Ssjg 39246149Ssjg# RCSid: 40246149Ssjg# $Id: target-flags.mk,v 1.8 2002/05/08 06:01:00 sjg Exp $ 41246149Ssjg# 42246149Ssjg# @(#) Copyright (c) 1998-2002, Simon J. Gerraty 43246149Ssjg# 44246149Ssjg# This file is provided in the hope that it will 45246149Ssjg# be of use. There is absolutely NO WARRANTY. 46246149Ssjg# Permission to copy, redistribute or otherwise 47246149Ssjg# use this file is hereby granted provided that 48246149Ssjg# the above copyright notice and this notice are 49246149Ssjg# left intact. 50246149Ssjg# 51246149Ssjg# Please send copies of changes and bug-fixes to: 52246149Ssjg# sjg@crufty.net 53246149Ssjg# 54246149Ssjg 55246149SsjgTARGET_FLAG_VARS?= CFLAGS 56246149Ssjg.for v in ${TARGET_FLAG_VARS} 57246149Ssjg.ifndef _$v 58246149Ssjg_$v := ${$v} 59246149Ssjg$v = ${${v}_${.TARGET:T}:U${_$v}} 60246149Ssjg.endif 61246149Ssjg.endfor 62246149Ssjg 63