: makedumpfile: Makefile improvements
Subsystems (3)
v2 cover : makedumpfile: Makefile improvements
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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 1/4 build: Derive objects from source files
Removes duplicate information, so there is one less line to edit when renaming or adding files.
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -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)
Signature · 7 lines
1.7.9.6 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 2/4 build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
In reply to Simon KågströmUseful e.g., when the system headers is in some build directory.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -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 \
Signature · 7 lines
1.7.9.6 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
RE: [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
Quoted 19 lines
Useful e.g., when the system headers is in some build directory.
Signed-off-by Simon Kagstrom <[email protected]>---
Makefile| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Makefile +0
-0@@ -8,7 +8,7 @@ ifeq ($(strip $CC),)CC = gcc
endifMakefile +1
-1-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)"'
Quoted 1 line
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
Quoted 8 lines
--
1.7.9.6_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
Quoted 8 lines · On Mon, 10 Mar 2014 05:26:34 +0000 Atsushi Kumagai…
Quoted 5 lines
Makefile +1
-1-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_ARCHalso 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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
RE: [PATCH v2 2/4] build: Use INCLUDES for normal CFLAGS in addition to CFLAGS_ARCH
Quoted 12 lines
Quoted 8 lines · On Mon, 10 Mar 2014 05:26:34 +0000 Atsushi Kumagai…
Quoted 5 lines
Makefile +1
-1-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_ARCHalso doesn't use INCLUDES in the upstream version, so this diff and the subject of this patch are wrong.
Quoted 4 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 3/4 build: Honor VPATH to support out-of-tree builds
In reply to Simon KågströmMakes 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
--- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
Makefile +7 -6
@@ -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
Signature · 7 lines
1.7.9.6 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 4/4 build: Rename generic-sounding SRC -> SRC_BASE
In reply to Simon KågströmThis 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.
--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -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
Signature · 7 lines
1.7.9.6 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec