Skip to contentSkip to conversation

change Makefile to respect CFLAGS/LDFLAGS

PATCH Applied Matthias Schwarzott 2 participants 3 messages Apr 25, 2007 – Apr 27, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 change Makefile to respect CFLAGS/LDFLAGS

Hi!

The attached patch changes the Makefile to not ignore CFLAGS/LDFLAGS from environment. Was there any strong reason to do so?

And second: Any reason to forbid using "make -j2" or higher? Missing Makefile dependencies?

This is related to this bugzilla request:
http://bugs.gentoo.org/show_bug.cgi?id=175893

Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
Makefile +2 -2
index a7a2cbf..072ae7f 100644
@@ -113,13 +113,13 @@ LD = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
 RANLIB = $(CROSS_COMPILE)ranlib
 
-CFLAGS		= -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS		+= -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
 WARNINGS	= -Wstrict-prototypes -Wsign-compare -Wshadow \
 		  -Wchar-subscripts -Wmissing-declarations -Wnested-externs \
 		  -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes
 CFLAGS		+= $(WARNINGS)
 
-LDFLAGS = -Wl,-warn-common
+LDFLAGS += -Wl,-warn-common
 
 OPTFLAGS = -Os
 CFLAGS += $(OPTFLAGS)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

Applied
#1 lore raw
Quoted 2 lines · Matthias Schwarzott

The attached patch changes the Makefile to not ignore CFLAGS/LDFLAGS from environment.

Applied.

Quoted 1 line

Was there any strong reason to do so?

No, it's just, that we use OPTFLAGS for that, which is appended by the Makefile.

Quoted 1 line

And second: Any reason to forbid using "make -j2" or higher?

Not that I know, but I usually don't use it.

Quoted 1 line

Missing Makefile dependencies?

There may be something with a rebuild in libvolume_id, that doesn't work without "clean" sometimes, but it should be fixable, sure.

Quoted 2 lines

This is related to this bugzilla request:
http://bugs.gentoo.org/show_bug.cgi?id5893

Well, we can just fix it until it works, just let me know. :)

Thanks,
Kay

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Matthias Schwarzott
Quoted 11 lines · Kay Sievers
Quoted 2 lines · Matthias Schwarzott

The attached patch changes the Makefile to not ignore CFLAGS/LDFLAGS from environment.

Applied.

Quoted 1 line

Was there any strong reason to do so?

No, it's just, that we use OPTFLAGS for that, which is appended by the Makefile.

Well then, there should be a second change, to not append OPTFLAGS if CFLAGS was set in environment before.
My patch also sets "-g" only if CFLAGS was unset before.

Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
Makefile +4 -4
index 072ae7f..7da3baa 100644
@@ -113,7 +113,10 @@ LD = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
 RANLIB = $(CROSS_COMPILE)ranlib
 
-CFLAGS		+= -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+OPTFLAGS = -Os
+CFLAGS ?= $(OPTFLAGS) -g
+
+CFLAGS		+= -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
 WARNINGS	= -Wstrict-prototypes -Wsign-compare -Wshadow \
 		  -Wchar-subscripts -Wmissing-declarations -Wnested-externs \
 		  -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes
@@ -121,9 +124,6 @@ CFLAGS		+= $(WARNINGS)
 
 LDFLAGS += -Wl,-warn-common
 
-OPTFLAGS = -Os
-CFLAGS += $(OPTFLAGS)
-
 ifeq ($(strip $(USE_LOG)),true)
 	CFLAGS += -DUSE_LOG
 endif

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel