Patchwork [17/39] introduce CPPFLAGS configure variable

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 12, 2010, 1 p.m.
Message ID <1286888457-5033-18-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/67564/
State New
Headers show

Comments

Paolo Bonzini - Oct. 12, 2010, 1 p.m.
Be consistent with Autoconf-generated scripts.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure |    8 ++++++++
 rules.mak |    8 ++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
Blue Swirl - Oct. 12, 2010, 7:11 p.m.
On Tue, Oct 12, 2010 at 1:00 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Be consistent with Autoconf-generated scripts.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure |    8 ++++++++
>  rules.mak |    8 ++++----
>  2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 2a2f64e..7f2e2a4 100755
> --- a/configure
> +++ b/configure
> @@ -189,6 +189,8 @@ for opt do
>   ;;
>   CFLAGS=*) CFLAGS="$CFLAGS"
>   ;;
> +  CPPFLAGS=*) CPPFLAGS="$CFLAGS"
> +  ;;
>   LDFLAGS=*) LDFLAGS="$LDFLAGS"
>   ;;
>   --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
> @@ -523,6 +525,8 @@ for opt do
>   ;;
>   --install=*) install="$optarg"
>   ;;
> +  CPPFLAGS=*)
> +  ;;
>   CFLAGS=*|--extra-cflags=*)
>   ;;
>   LDFLAGS=*|--extra-ldflags=*)
> @@ -925,6 +929,8 @@ echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
>  echo ""
>  echo "Some influential environment variables can be passed on the command line:"
>  echo "  CFLAGS      C compiler flags"
> +echo "  CPPFLAGS    C preprocessor flags, e.g. -I<include dir> if you have"
> +echo "              headers in a nonstandard directory <include dir>"
>  echo "  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a"
>  echo "              nonstandard directory <lib dir>"
>  echo ""
> @@ -2284,6 +2290,7 @@ fi
>  echo "Source path       $source_path"
>  echo "C compiler        $cc"
>  echo "CFLAGS            $CFLAGS"
> +echo "CPPFLAGS          $CPPFLAGS"
>  echo "QEMU_CFLAGS       $QEMU_CFLAGS"
>  echo "LDFLAGS           $LDFLAGS"
>  echo "make              $make"
> @@ -2650,6 +2657,7 @@ echo "OBJCOPY=$objcopy" >> $config_host_mak
>  echo "LD=$ld" >> $config_host_mak
>  echo "WINDRES=$windres" >> $config_host_mak
>  echo "CFLAGS=$CFLAGS" >> $config_host_mak
> +echo "CPPFLAGS=$CPPFLAGS" >> $config_host_mak
>  echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
>  echo "QEMU_CPPFLAGS=$QEMU_CPPFLAGS" >> $config_host_mak
>  if test "$sparse" = "yes" ; then
> diff --git a/rules.mak b/rules.mak
> index 007fc49..b4b7e16 100644
> --- a/rules.mak
> +++ b/rules.mak
> @@ -15,15 +15,15 @@ MAKEFLAGS += -rR
>  QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
>
>  %.o: %.c
> -       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
> +       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
>
>  %.o: %.S
> -       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
> +       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
>
>  %.o: %.m
> -       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
> +       $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
>
> -LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
> +LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")

Again, the linker shouldn't need CPPFLAGS.

Patch

diff --git a/configure b/configure
index 2a2f64e..7f2e2a4 100755
--- a/configure
+++ b/configure
@@ -189,6 +189,8 @@  for opt do
   ;;
   CFLAGS=*) CFLAGS="$CFLAGS"
   ;;
+  CPPFLAGS=*) CPPFLAGS="$CFLAGS"
+  ;;
   LDFLAGS=*) LDFLAGS="$LDFLAGS"
   ;;
   --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
@@ -523,6 +525,8 @@  for opt do
   ;;
   --install=*) install="$optarg"
   ;;
+  CPPFLAGS=*)
+  ;;
   CFLAGS=*|--extra-cflags=*)
   ;;
   LDFLAGS=*|--extra-ldflags=*)
@@ -925,6 +929,8 @@  echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
 echo ""
 echo "Some influential environment variables can be passed on the command line:"
 echo "  CFLAGS      C compiler flags"
+echo "  CPPFLAGS    C preprocessor flags, e.g. -I<include dir> if you have"
+echo "              headers in a nonstandard directory <include dir>"
 echo "  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a"
 echo "              nonstandard directory <lib dir>"
 echo ""
@@ -2284,6 +2290,7 @@  fi
 echo "Source path       $source_path"
 echo "C compiler        $cc"
 echo "CFLAGS            $CFLAGS"
+echo "CPPFLAGS          $CPPFLAGS"
 echo "QEMU_CFLAGS       $QEMU_CFLAGS"
 echo "LDFLAGS           $LDFLAGS"
 echo "make              $make"
@@ -2650,6 +2657,7 @@  echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
 echo "WINDRES=$windres" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
+echo "CPPFLAGS=$CPPFLAGS" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
 echo "QEMU_CPPFLAGS=$QEMU_CPPFLAGS" >> $config_host_mak
 if test "$sparse" = "yes" ; then
diff --git a/rules.mak b/rules.mak
index 007fc49..b4b7e16 100644
--- a/rules.mak
+++ b/rules.mak
@@ -15,15 +15,15 @@  MAKEFLAGS += -rR
 QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 
 %.o: %.c
-	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
 
 %.o: %.S
-	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
 
 %.o: %.m
-	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
-LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
+LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_CPPFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
 %$(EXESUF): %.o
 	$(call LINK,$^)