diff options
author | jlam <jlam@pkgsrc.org> | 2003-09-04 19:38:06 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2003-09-04 19:38:06 +0000 |
commit | 6a970fe50b6a92e79bec4ddd4cc90145619afeb4 (patch) | |
tree | 947ac5e66e6064d757b837fd4486107bc89e310e /mk | |
parent | e59378a498f4a893954afe6129379fd0fb458e61 (diff) | |
download | pkgsrc-6a970fe50b6a92e79bec4ddd4cc90145619afeb4.tar.gz |
Allow buildlink3.mk file to specify BUILDLINK_CFLAGS.<pkg> that are
automatically added to CFLAGS and CXXFLAGS. Note that -D... and -I...
settings should go into BUILDLINK_CPPFLAGS.<pkg> instead. BUILDLINK_CFLAGS
is reserved for stuff like "-pthread" or other compiler-specific flags.
Also note why we add BUILDLINK_CPPFLAGS.<pkg> to both CFLAGS and CXXFLAGS
(because a lot of software just uses CFLAGS and ignores any CPPFLAGS value
that we pass to it).
Diffstat (limited to 'mk')
-rw-r--r-- | mk/buildlink3/bsd.buildlink3.mk | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk index 0eae79b10be..5a90c8c3ca6 100644 --- a/mk/buildlink3/bsd.buildlink3.mk +++ b/mk/buildlink3/bsd.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.buildlink3.mk,v 1.3 2003/09/04 05:40:25 jlam Exp $ +# $NetBSD: bsd.buildlink3.mk,v 1.4 2003/09/04 19:38:06 jlam Exp $ # # An example package buildlink3.mk file: # @@ -112,10 +112,12 @@ ${_BLNK_DEPMETHOD.${_pkg_}}+= \ # relevant for buildlink3.mk files that # provide a setting for this variable. # +# BUILDLINK_CFLAGS.<pkg>, # BUILDLINK_CPPFLAGS.<pkg>, -# BUILDLINK_LDFLAGS.<pkg> contain extra -D..., -I... and -L.../-Wl,-R -# options to be passed to the compiler/linker -# so that building against <pkg> will work. +# BUILDLINK_LDFLAGS.<pkg> contain extra compiler options, -D..., -I... +# and -L.../-Wl,-R options to be passed to the +# compiler/linker so that building against +# <pkg> will work. # # BUILDLINK_INCDIRS.<pkg>, # BUILDLINK_LIBDIRS.<pkg> subdirectories of BUILDLINK_PREFIX.<pkg> @@ -168,10 +170,12 @@ BUILDLINK_LIBDIRS.${_pkg_}?= lib # BUILDLINK_CPPFLAGS and BUILDLINK_LDFLAGS contain the proper -I... # and -L.../-Wl,-R... options to be passed to the compiler and linker # to find the headers and libraries for the various packages at -# configure/build time. +# configure/build time. BUILDLINK_CFLAGS contains any special compiler +# options needed when building against the various packages. # BUILDLINK_CPPFLAGS= # empty BUILDLINK_LDFLAGS= # empty +BUILDLINK_CFLAGS= # empty .for _pkg_ in ${BUILDLINK_PACKAGES} . for _flag_ in ${BUILDLINK_CPPFLAGS.${_pkg_}} @@ -184,6 +188,11 @@ BUILDLINK_CPPFLAGS+= ${_flag_} BUILDLINK_LDFLAGS+= ${_flag_} . endif . endfor +. for _flag_ in ${BUILDLINK_CFLAGS.${_pkg_}} +. if empty(BUILDLINK_CFLAGS:M${_flag_}) +BUILDLINK_CFLAGS+= ${_flag_} +. endif +. endfor . if !empty(BUILDLINK_INCDIRS.${_pkg_}) . for _dir_ in ${BUILDLINK_INCDIRS.${_pkg_}:S/^/${BUILDLINK_PREFIX.${_pkg_}}\//} . if exists(${_dir_}) @@ -226,16 +235,28 @@ BUILDLINK_LDFLAGS+= ${_COMPILER_LD_FLAG}${RPATH_FLAG}${LOCALBASE}/lib BUILDLINK_LDFLAGS+= ${_COMPILER_LD_FLAG}${RPATH_FLAG}${X11BASE}/lib .endif -.for _flag_ in ${BUILDLINK_CPPFLAGS} +.for _flag_ in ${BUILDLINK_CFLAGS} . if empty(CFLAGS:M${_flag_}) CFLAGS+= ${_flag_} . endif . if empty(CXXFLAGS:M${_flag_}) CXXFLAGS+= ${_flag_} . endif +.endfor +.for _flag_ in ${BUILDLINK_CPPFLAGS} . if empty(CPPFLAGS:M${_flag_}) CPPFLAGS+= ${_flag_} . endif +# +# We add BUILDLINK_CPPFLAGS to both CFLAGS and CXXFLAGS since much software +# ignores the value of CPPFLAGS that we set in the environment. +# +. if empty(CFLAGS:M${_flag_}) +CFLAGS+= ${_flag_} +. endif +. if empty(CXXFLAGS:M${_flag_}) +CXXFLAGS+= ${_flag_} +. endif .endfor .for _flag_ in ${BUILDLINK_LDFLAGS} . if empty(LDFLAGS:M${_flag_}) |