Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4]: makedumpfile: Makefile improvements
@ 2014-03-07  8:36 Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 1/4] build: Derive objects from source files Simon Kågström
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Simon Kågström @ 2014-03-07  8:36 UTC (permalink / raw)
  To: kexec@lists.infradead.org, Atsushi Kumagai

Hi!

The following patches improve the top Makefile a bit to allow
out-of-tree builds and (at some points) simplify the Makefile a bit.

* v2: Provide descriptions for each patch.

Regards,
// Simon

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/4] build: Derive objects from source files
  2014-03-07  8:36 [PATCH v2 0/4]: makedumpfile: Makefile improvements Simon Kågström
@ 2014-03-07  8:38 ` Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH Simon Kågström
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Simon Kågström @ 2014-03-07  8:38 UTC (permalink / raw)
  To: kexec@lists.infradead.org, Atsushi Kumagai

Removes duplicate information, so there is one less line to edit when
renaming or adding files.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
---
 Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index f20c118..d660951 100644
--- a/Makefile
+++ b/Makefile
@@ -41,9 +41,9 @@ endif
 
 SRC	= makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h
 SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c
-OBJ_PART = print_info.o dwarf_info.o elf_info.o erase_info.o sadump_info.o cache.o
+OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART))
 SRC_ARCH = arch/arm.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c
-OBJ_ARCH = arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o arch/ppc64.o arch/s390x.o arch/ppc.o
+OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH))
 
 LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz
 ifneq ($(LINKTYPE), dynamic)
-- 
1.7.9.6


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
  2014-03-07  8:36 [PATCH v2 0/4]: makedumpfile: Makefile improvements Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 1/4] build: Derive objects from source files Simon Kågström
@ 2014-03-07  8:38 ` Simon Kågström
  2014-03-10  5:26   ` Atsushi Kumagai
  2014-03-07  8:38 ` [PATCH v2 3/4] build: Honor VPATH to support out-of-tree builds Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 4/4] build: Rename generic-sounding SRC -> SRC_BASE Simon Kågström
  3 siblings, 1 reply; 8+ messages in thread
From: Simon Kågström @ 2014-03-07  8:38 UTC (permalink / raw)
  To: kexec@lists.infradead.org, Atsushi Kumagai

Useful e.g., when the system headers is in some build directory.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index d660951..57e7e44 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ ifeq ($(strip $CC),)
 CC	= gcc
 endif
 
-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+CFLAGS = $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
 	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
 	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
 CFLAGS_ARCH	= $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-- 
1.7.9.6


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/4] build: Honor VPATH to support out-of-tree builds
  2014-03-07  8:36 [PATCH v2 0/4]: makedumpfile: Makefile improvements Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 1/4] build: Derive objects from source files Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH Simon Kågström
@ 2014-03-07  8:38 ` Simon Kågström
  2014-03-07  8:38 ` [PATCH v2 4/4] build: Rename generic-sounding SRC -> SRC_BASE Simon Kågström
  3 siblings, 0 replies; 8+ messages in thread
From: Simon Kågström @ 2014-03-07  8:38 UTC (permalink / raw)
  To: kexec@lists.infradead.org, Atsushi Kumagai

Makes it possible to build out-of-tree, with something like

   cd makedumpfile
   mkdir out-of-tree-build
   cd out-of-tree-build
   make -f ../Makefile

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
---
 Makefile |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 57e7e44..b9121ad 100644
--- a/Makefile
+++ b/Makefile
@@ -63,19 +63,20 @@ endif
 all: makedumpfile
 
 $(OBJ_PART): $(SRC_PART)
-	$(CC) $(CFLAGS) -c -o ./$@ ./$(@:.o=.c) 
+	$(CC) $(CFLAGS) -c -o ./$@ $(VPATH)$(@:.o=.c)
 
 $(OBJ_ARCH): $(SRC_ARCH)
-	$(CC) $(CFLAGS_ARCH) -c -o ./$@ ./$(@:.o=.c) 
+	@mkdir -p $(@D)
+	$(CC) $(CFLAGS_ARCH) -c -o ./$@ $(VPATH)$(@:.o=.c)
 
 makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_ARCH)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -o $@ $< $(LIBS)
 	echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\" \"Linux System Administrator\'s Manual\" > temp.8
-	grep -v "^.TH MAKEDUMPFILE 8" $(SRC)/makedumpfile.8 >> temp.8
+	grep -v "^.TH MAKEDUMPFILE 8" $(VPATH)makedumpfile.8 >> temp.8
 	mv temp.8 makedumpfile.8
 	gzip -c ./makedumpfile.8 > ./makedumpfile.8.gz
 	echo .TH MAKEDUMPFILE.CONF 5 \"$(DATE)\" \"makedumpfile v$(VERSION)\" \"Linux System Administrator\'s Manual\" > temp.5
-	grep -v "^.TH MAKEDUMPFILE.CONF 5" makedumpfile.conf.5 >> temp.5
+	grep -v "^.TH MAKEDUMPFILE.CONF 5" $(VPATH)makedumpfile.conf.5 >> temp.5
 	mv temp.5 makedumpfile.conf.5
 	gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz
 
@@ -87,7 +88,7 @@ clean:
 
 install:
 	install -m 755 -d ${DESTDIR}/usr/sbin ${DESTDIR}/usr/share/man/man5 ${DESTDIR}/usr/share/man/man8 ${DESTDIR}/etc
-	install -m 755 -t ${DESTDIR}/usr/sbin makedumpfile makedumpfile-R.pl
+	install -m 755 -t ${DESTDIR}/usr/sbin makedumpfile $(VPATH)makedumpfile-R.pl
 	install -m 644 -t ${DESTDIR}/usr/share/man/man8 makedumpfile.8.gz
 	install -m 644 -t ${DESTDIR}/usr/share/man/man5 makedumpfile.conf.5.gz
-	install -m 644 -D makedumpfile.conf ${DESTDIR}/etc/makedumpfile.conf.sample
+	install -m 644 -D $(VPATH)makedumpfile.conf ${DESTDIR}/etc/makedumpfile.conf.sample
-- 
1.7.9.6


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/4] build: Rename generic-sounding SRC -> SRC_BASE
  2014-03-07  8:36 [PATCH v2 0/4]: makedumpfile: Makefile improvements Simon Kågström
                   ` (2 preceding siblings ...)
  2014-03-07  8:38 ` [PATCH v2 3/4] build: Honor VPATH to support out-of-tree builds Simon Kågström
@ 2014-03-07  8:38 ` Simon Kågström
  3 siblings, 0 replies; 8+ messages in thread
From: Simon Kågström @ 2014-03-07  8:38 UTC (permalink / raw)
  To: kexec@lists.infradead.org, Atsushi Kumagai

This aligns naming with SRC_PART and SRC_ARCH.

In our case, we also use SRC as an environment variable in an outer
Makefile (which calls the makedumpfile one), which messes things up
here.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
---
 Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index b9121ad..ccf54e1 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ CFLAGS += -m32
 CFLAGS_ARCH += -m32
 endif
 
-SRC	= makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h
+SRC_BASE = makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h
 SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c
 OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART))
 SRC_ARCH = arch/arm.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c
@@ -69,7 +69,7 @@ $(OBJ_ARCH): $(SRC_ARCH)
 	@mkdir -p $(@D)
 	$(CC) $(CFLAGS_ARCH) -c -o ./$@ $(VPATH)$(@:.o=.c)
 
-makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_ARCH)
+makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -o $@ $< $(LIBS)
 	echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\" \"Linux System Administrator\'s Manual\" > temp.8
 	grep -v "^.TH MAKEDUMPFILE 8" $(VPATH)makedumpfile.8 >> temp.8
-- 
1.7.9.6


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
  2014-03-07  8:38 ` [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH Simon Kågström
@ 2014-03-10  5:26   ` Atsushi Kumagai
  2014-03-11  6:57     ` Simon Kågström
  0 siblings, 1 reply; 8+ messages in thread
From: Atsushi Kumagai @ 2014-03-10  5:26 UTC (permalink / raw)
  To: simon.kagstrom@netinsight.net; +Cc: kexec@lists.infradead.org

> Useful e.g., when the system headers is in some build directory.
>
>Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
>---
> Makefile |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/Makefile b/Makefile
>index d660951..57e7e44 100644
>--- a/Makefile
>+++ b/Makefile
>@@ -8,7 +8,7 @@ ifeq ($(strip $CC),)
> CC	= gcc
> endif
>
>-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
>+CFLAGS = $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
> 	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
> 	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
> CFLAGS_ARCH	= $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
                  ^^^^^^^^^^^
CFLAGS_ARCH also doesn't use INCLUDES in the upstream version,
so this diff and the subject of this patch are wrong.


Thanks
Atsushi Kumagai

>--
>1.7.9.6
>
>
>_______________________________________________
>kexec mailing list
>kexec@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
  2014-03-10  5:26   ` Atsushi Kumagai
@ 2014-03-11  6:57     ` Simon Kågström
  2014-03-11  9:31       ` Atsushi Kumagai
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Kågström @ 2014-03-11  6:57 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: kexec@lists.infradead.org

On Mon, 10 Mar 2014 05:26:34 +0000
Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp> wrote:

> >-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
> >+CFLAGS = $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
> > 	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
> > 	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
> > CFLAGS_ARCH	= $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
>                   ^^^^^^^^^^^
> CFLAGS_ARCH also doesn't use INCLUDES in the upstream version,
> so this diff and the subject of this patch are wrong.

Sorry about that! I merged in the new version, but apparently we had
some local modifications to the Makefile.

So please drop this patch in the series.

// Simon

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
  2014-03-11  6:57     ` Simon Kågström
@ 2014-03-11  9:31       ` Atsushi Kumagai
  0 siblings, 0 replies; 8+ messages in thread
From: Atsushi Kumagai @ 2014-03-11  9:31 UTC (permalink / raw)
  To: simon.kagstrom@netinsight.net; +Cc: kexec@lists.infradead.org

>On Mon, 10 Mar 2014 05:26:34 +0000
>Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp> wrote:
>
>> >-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
>> >+CFLAGS = $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
>> > 	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
>> > 	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
>> > CFLAGS_ARCH	= $(INCLUDES) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
>>                   ^^^^^^^^^^^
>> CFLAGS_ARCH also doesn't use INCLUDES in the upstream version,
>> so this diff and the subject of this patch are wrong.
>
>Sorry about that! I merged in the new version, but apparently we had
>some local modifications to the Makefile.
>
>So please drop this patch in the series.

I see, I'll merge the others into v1.5.6.


Thanks
Atsushi Kumagai
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-11  9:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07  8:36 [PATCH v2 0/4]: makedumpfile: Makefile improvements Simon Kågström
2014-03-07  8:38 ` [PATCH v2 1/4] build: Derive objects from source files Simon Kågström
2014-03-07  8:38 ` [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH Simon Kågström
2014-03-10  5:26   ` Atsushi Kumagai
2014-03-11  6:57     ` Simon Kågström
2014-03-11  9:31       ` Atsushi Kumagai
2014-03-07  8:38 ` [PATCH v2 3/4] build: Honor VPATH to support out-of-tree builds Simon Kågström
2014-03-07  8:38 ` [PATCH v2 4/4] build: Rename generic-sounding SRC -> SRC_BASE Simon Kågström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox