summaryrefslogtreecommitdiff
path: root/mk/target-flags.mk
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-04-01 14:07:52 +0000
committer <>2013-05-17 14:06:43 +0000
commit986bc2ac05bc4c08c6a0ed30c9e97674932ccfeb (patch)
tree8346daf16e98e93415195acbf99f09cb5326b73b /mk/target-flags.mk
downloadbmake-tarball-986bc2ac05bc4c08c6a0ed30c9e97674932ccfeb.tar.gz
Imported from /home/lorry/working-area/delta_bmake-tarball/bmake.tar.gz.HEADbmakemaster
Diffstat (limited to 'mk/target-flags.mk')
-rw-r--r--mk/target-flags.mk62
1 files changed, 62 insertions, 0 deletions
diff --git a/mk/target-flags.mk b/mk/target-flags.mk
new file mode 100644
index 0000000..f8932b2
--- /dev/null
+++ b/mk/target-flags.mk
@@ -0,0 +1,62 @@
+# NAME:
+# target-flags.mk - target specific flags
+#
+# DESCRIPTION:
+# Include this macro file after all others in a makefile and
+# follow it with any target specfic flag settings.
+# For each such variable v in TARGET_FLAG_VARS we set:
+#.nf
+#
+# _$v := ${$v}
+# $v = ${${v}_${.TARGET:T}:U${_$v}}
+#.fi
+#
+# This allows one to do things like:
+#.nf
+#
+# TARGET_FLAG_VARS= CFLAGS
+# .include <target-flags.mk>
+# CFLAGS_fu.o = ${_CFLAGS:N-Wall}
+#.fi
+#
+# To turn off -Wall for just the target fu.o
+# Actually CFLAGS is the default value for TARGET_FLAG_VARS.
+#
+# BUGS:
+# One must be careful to avoid creating circular references in
+# variables. The original version of this macro file did
+# elaborate things with CFLAGS. The current, simpler
+# implementation is ultimately more flexible.
+#
+# It is important that target-flags.mk is included after other
+# macro files and that target specific flags that may reference
+# _$v are set after that.
+#
+# Only works with a make(1) that does nested evaluation correctly.
+
+
+
+# RCSid:
+# $Id: target-flags.mk,v 1.8 2002/05/08 06:01:00 sjg Exp $
+#
+# @(#) Copyright (c) 1998-2002, Simon J. Gerraty
+#
+# This file is provided in the hope that it will
+# be of use. There is absolutely NO WARRANTY.
+# Permission to copy, redistribute or otherwise
+# use this file is hereby granted provided that
+# the above copyright notice and this notice are
+# left intact.
+#
+# Please send copies of changes and bug-fixes to:
+# sjg@crufty.net
+#
+
+TARGET_FLAG_VARS?= CFLAGS
+.for v in ${TARGET_FLAG_VARS}
+.ifndef _$v
+_$v := ${$v}
+$v = ${${v}_${.TARGET:T}:U${_$v}}
+.endif
+.endfor
+