[pve-devel] [PATCH cluster v2] buildsys: replace autotools with plain makefiles

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jul 24 12:30:09 CEST 2018


On Tue, Jul 24, 2018 at 11:17:43AM +0200, Thomas Lamprecht wrote:
> Am 07/12/2018 um 10:06 AM schrieb Thomas Lamprecht:
> > pve-cluster is not a big project with to much dependencies, so
> > autotools was a bit of an overkill for it.
> > Omit it, plus a ./configure step in general and just use a plain
> > Makefile - in combination with pkg-config - like we do in our other
> > projects.
> > 
> > Build time gets reduced quite a bit - albeit the were never that big
> > anyway...:
> > 
> > (old autotools) time make deb
> > make deb  12.96s user 1.78s system 94% cpu 15.543 total
> > 
> > (new plain makefile) time make deb
> > make deb  9.40s user 1.14s system 100% cpu 10.465 total
> > 
> > A third less time needed here, and with compiling in parallel I can
> > shave off even 1.5 seconds more, so almost  half of the original
> > time.
> > 
> > Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> > ---
> > 
> > changes v1 -> v2:
> > * s/make/$(MAKE)/
> > * ensure all clean targets are PHONY ones
> > * add all: target to data/Makefile
> > * allow to build src/ binaries (pmxcfs and helpers) with make only by
> >    adding them to the default target
> > 
> 
> any comments?

Looks good. 2 more suggestions:

data/Makefile's all target needs to actually be filled (otherwise the
compile process happens at the install step...)
I'd suggest a SUBDIR variable approach as below...

And in data/src/Makefile we should generate the dependencies via -MMD in
order to be able to run make and have pmxcfs rebuilt properly even when
only touching eg. header files.

--->8---
>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumiller at proxmox.com>
Date: Tue, 24 Jul 2018 12:17:34 +0200
Subject: [PATCH cluster] buildsys: fixup data/Makefile

Actually fill the 'all' target so we don't compile at
install time...

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 data/Makefile | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/data/Makefile b/data/Makefile
index 82d1ef7..ebd35c5 100644
--- a/data/Makefile
+++ b/data/Makefile
@@ -1,18 +1,17 @@
+SUBDIRS := PVE src test
+
 all:
+	for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 
 .PHONY: install
 install:
-	$(MAKE) -C src install
-	$(MAKE) -C PVE install
+	for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 
 
 .PHONY: check
 check:
-	$(MAKE) -C test check
-	$(MAKE) -C src check
-	$(MAKE) -C PVE check
+	for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 
 .PHONY: clean
 clean:
-	$(MAKE) -C src clean
-	$(MAKE) -C PVE clean
+	for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
-- 
2.11.0

>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Wolfgang Bumiller <w.bumiller at proxmox.com>
Date: Tue, 24 Jul 2018 12:23:11 +0200
Subject: [PATCH cluster] buildsys: add dependency tracking

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 data/src/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/data/src/Makefile b/data/src/Makefile
index 6e8ba7d..7be9b2d 100644
--- a/data/src/Makefile
+++ b/data/src/Makefile
@@ -14,7 +14,7 @@ AR = ar
 ARFLAGS = crs
 
 .c.o:
-	$(CC) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) -c -o $@ $< -MMD -MT $@ -MF $@.d
 
 all: pmxcfs create_pmxcfs_db logtest check_memdb
 
@@ -55,3 +55,5 @@ check: check_memdb
 .PHONY: clean
 clean:
 	rm -f *.o *.a pmxcfs create_pmxcfs_db check_memdb logtest pmxcfs.8
+
+-include *.o.d
-- 
2.11.0





More information about the pve-devel mailing list