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# RCSid: 38# $Id: target-flags.mk,v 1.12 2025/08/09 22:42:24 sjg Exp $ 39# 40# @(#) Copyright (c) 1998-2002, Simon J. Gerraty 41# 42# SPDX-License-Identifier: BSD-2-Clause 43# 44# Please send copies of changes and bug-fixes to: 45# sjg@crufty.net 46# 47 48TARGET_FLAG_VARS?= CFLAGS 49.for v in ${TARGET_FLAG_VARS} 50.ifndef _$v 51_$v := ${$v} 52$v = ${${v}_${.TARGET:T}:U${_$v}} 53.endif 54.endfor 55 56