linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: "Diego Elio Pettenò" <flameeyes@gmail.com>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: sparse, gcc 4.6 and a few build changes
Date: Wed, 13 Apr 2011 09:58:35 -0700	[thread overview]
Message-ID: <BANLkTikS9NPWmaqt2JZHVLEcMarxznq97g@mail.gmail.com> (raw)
In-Reply-To: <1302692762.15959.50.camel@raven.home.flameeyes.eu>

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

On Wed, Apr 13, 2011 at 4:06 AM, Diego Elio Pettenò <flameeyes@gmail.com> wrote:

> Yes I know — that's why I used the "?=" setter: if CFLAGS is set in the
> environment, it'll be used instead of the "CFLAGS ?=" line; all the +=
> lines will be maintained instead. This does obviously not work if you
> use "make CFLAGS=$something".

That is my point. It force the user set CFLAGS in enviroment
but not work the same way if you do "make CFLAGS=$something".
I want "make CFLAGS=$something" works the same way as
you set it in environment.

>
> Attachment is missing ;)

Oops, I forget to attach. Here we go again.

> It looks like no changes are needed for that at least, I'll send the
> remaining three patches for now then.

Ha, I am hoping that is my learning case to pull from some one else's
git tree. Using git tree or patches are  both fine.

Thanks

Chris

[-- Attachment #2: cflags.patch --]
[-- Type: application/octet-stream, Size: 2355 bytes --]

diff --git a/Makefile b/Makefile
index 701cdc9..eec5daa 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,7 @@ CFLAGS += -Wall -Wwrite-strings
 LDFLAGS += -g
 AR = ar
 
+ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS)
 #
 # For debugging, put this in local.mk:
 #
@@ -21,10 +22,10 @@ HAVE_GCC_DEP:=$(shell touch .gcc-test.c && 				\
 		echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
 HAVE_GTK2:=$(shell pkg-config --exists gtk+-2.0 2>/dev/null && echo 'yes')
 
-CFLAGS += -DGCC_BASE=\"$(shell $(CC) --print-file-name=)\"
+BASIC_CFLAGS = -DGCC_BASE=\"$(shell $(CC) --print-file-name=)\"
 
 ifeq ($(HAVE_GCC_DEP),yes)
-CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
+BASIC_CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
 endif
 
 DESTDIR=
@@ -55,7 +56,7 @@ GTK2_LIBS := $(shell pkg-config --libs gtk+-2.0)
 PROGRAMS += test-inspect
 INST_PROGRAMS += test-inspect
 test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o
-test-inspect.o $(test-inspect_EXTRA_DEPS): CFLAGS += $(GTK2_CFLAGS)
+test-inspect.o $(test-inspect_EXTRA_DEPS): BASIC_CFLAGS += $(GTK2_CFLAGS)
 test-inspect_EXTRA_OBJS := $(GTK2_LIBS)
 else
 $(warning Your system does not have libgtk2, disabling test-inspect)
@@ -73,7 +74,7 @@ LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
 LIB_FILE= libsparse.a
 SLIB_FILE= libsparse.so
 
-# If you add $(SLIB_FILE) to this, you also need to add -fpic to CFLAGS above.
+# If you add $(SLIB_FILE) to this, you also need to add -fpic to BASIC_CFLAGS above.
 # Doing so incurs a noticeable performance hit, and Sparse does not have a
 # stable shared library interface, so this does not occur by default.  If you
 # really want a shared library, you may want to build Sparse twice: once
@@ -149,7 +150,7 @@ DEP_FILES := $(wildcard .*.o.d)
 $(if $(DEP_FILES),$(eval include $(DEP_FILES)))
 
 c2xml.o: c2xml.c $(LIB_H)
-	$(QUIET_CC)$(CC) `pkg-config --cflags libxml-2.0` -o $@ -c $(CFLAGS) $<
+	$(QUIET_CC)$(CC) `pkg-config --cflags libxml-2.0` -o $@ -c $(ALL_CFLAGS) $<
 
 compat-linux.o: compat/strtold.c compat/mmap-blob.c $(LIB_H)
 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
@@ -157,7 +158,7 @@ compat-mingw.o: $(LIB_H)
 compat-cygwin.o: $(LIB_H)
 
 %.o: %.c
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
 
 clean: clean-check
 	rm -f *.[oa] .*.d *.so $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc

  reply	other threads:[~2011-04-13 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1302226355.2407.7.camel@raven.home.flameeyes.eu>
2011-04-13  8:53 ` sparse, gcc 4.6 and a few build changes Christopher Li
2011-04-13 11:06   ` Diego Elio Pettenò
2011-04-13 16:58     ` Christopher Li [this message]
2011-04-26  0:58     ` Christopher Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTikS9NPWmaqt2JZHVLEcMarxznq97g@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=flameeyes@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).