* [PATCH 0/4] Cleanups to ccan build
@ 2016-04-30 8:01 David Gibson
2016-04-30 8:01 ` [PATCH 1/4] Add missing files to make clean David Gibson
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: David Gibson @ 2016-04-30 8:01 UTC (permalink / raw)
To: ccan; +Cc: rusty
This series has several assorted cleanups to the ccan Makefiles
David Gibson (4):
Add missing files to make clean
Clean up use of 'rm' in Makefiles
Exclude system headers from .d files
Correctly include dependencies for nested modules
Makefile | 5 +++--
Makefile-ccan | 4 ++--
ccan/cdump/tools/Makefile | 2 +-
ccan/crypto/sha256/benchmarks/Makefile | 2 +-
ccan/io/benchmarks/Makefile | 2 +-
ccan/timer/benchmarks/Makefile | 2 +-
tools/Makefile | 2 +-
tools/ccanlint/Makefile | 2 +-
8 files changed, 11 insertions(+), 10 deletions(-)
--
2.5.5
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] Add missing files to make clean
2016-04-30 8:01 [PATCH 0/4] Cleanups to ccan build David Gibson
@ 2016-04-30 8:01 ` David Gibson
2016-04-30 8:01 ` [PATCH 2/4] Clean up use of 'rm' in Makefiles David Gibson
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2016-04-30 8:01 UTC (permalink / raw)
To: ccan; +Cc: rusty
At present, "make clean" will not remove the module-Makefile files for
non-top-level modules. It also won't remove the generated config.h.
Correct those errors.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index bfd44e3..856baa9 100644
--- a/Makefile
+++ b/Makefile
@@ -64,8 +64,9 @@ ccan/%/info: ccan/%/_info
$(CC) $(CCAN_CFLAGS) -o $@ -x c $<
clean: tools-clean
- $(RM) `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'` `find * -name info` `find * -name '*.d'`
- $(RM) inter-depends lib-depends test-depends ccan/*-Makefile
+ $(RM) `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'` `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'`
+ $(RM) config.h
+ $(RM) inter-depends lib-depends test-depends
# Creates a dependency from the tests to the object files which it needs.
inter-depends: $(ALL_DEPENDS) Makefile
--
2.5.5
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] Clean up use of 'rm' in Makefiles
2016-04-30 8:01 [PATCH 0/4] Cleanups to ccan build David Gibson
2016-04-30 8:01 ` [PATCH 1/4] Add missing files to make clean David Gibson
@ 2016-04-30 8:01 ` David Gibson
2016-04-30 8:01 ` [PATCH 3/4] Exclude system headers from .d files David Gibson
2016-04-30 8:01 ` [PATCH 4/4] Correctly include dependencies for nested modules David Gibson
3 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2016-04-30 8:01 UTC (permalink / raw)
To: ccan; +Cc: rusty
Most of the ccan Makefiles use $(RM) to remove files. However, 'rm' is
traditionally considered one of the few shell tools which can be used in
Makefiles without indirecting via a variable.
rm is also typically invoked with -f in Makefiles, so that it doesn't cause
errors if the files don't exist (because they haven't been built). A
number of instances in ccan were missing this.
This corrects these warts.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
Makefile | 6 +++---
ccan/cdump/tools/Makefile | 2 +-
ccan/crypto/sha256/benchmarks/Makefile | 2 +-
ccan/io/benchmarks/Makefile | 2 +-
ccan/timer/benchmarks/Makefile | 2 +-
tools/Makefile | 2 +-
tools/ccanlint/Makefile | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 856baa9..5d4b701 100644
--- a/Makefile
+++ b/Makefile
@@ -64,9 +64,9 @@ ccan/%/info: ccan/%/_info
$(CC) $(CCAN_CFLAGS) -o $@ -x c $<
clean: tools-clean
- $(RM) `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'` `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'`
- $(RM) config.h
- $(RM) inter-depends lib-depends test-depends
+ rm -f `find * -name '*.o'` `find * -name '.depends'` `find * -name '*.a'` `find * -name info` `find * -name '*.d'` `find ccan -name '*-Makefile'`
+ rm -f config.h
+ rm -f inter-depends lib-depends test-depends
# Creates a dependency from the tests to the object files which it needs.
inter-depends: $(ALL_DEPENDS) Makefile
diff --git a/ccan/cdump/tools/Makefile b/ccan/cdump/tools/Makefile
index 3b30d66..8b01284 100644
--- a/ccan/cdump/tools/Makefile
+++ b/ccan/cdump/tools/Makefile
@@ -5,7 +5,7 @@ CFLAGS := -I$(CCANDIR) -Wall
cdump-enumstr: cdump-enumstr.o $(CCAN_OBJS)
clean:
- $(RM) cdump-enumstr.o $(CCAN_OBJS)
+ rm -f cdump-enumstr.o $(CCAN_OBJS)
ccan-tal.o: $(CCANDIR)/ccan/tal/tal.c
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/ccan/crypto/sha256/benchmarks/Makefile b/ccan/crypto/sha256/benchmarks/Makefile
index a9f1b29..f1749ab 100644
--- a/ccan/crypto/sha256/benchmarks/Makefile
+++ b/ccan/crypto/sha256/benchmarks/Makefile
@@ -12,7 +12,7 @@ $(INTEL_OBJS): %.o : %.asm
yasm -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX -o $@ $<
clean:
- $(RM) -f *.o
+ rm -f *.o
ccan-crypto-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/ccan/io/benchmarks/Makefile b/ccan/io/benchmarks/Makefile
index 0068400..7dcf9be 100644
--- a/ccan/io/benchmarks/Makefile
+++ b/ccan/io/benchmarks/Makefile
@@ -26,4 +26,4 @@ err.o: $(CCANDIR)/ccan/err/err.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
- $(RM) -f *.o $(ALL)
+ rm -f *.o $(ALL)
diff --git a/ccan/timer/benchmarks/Makefile b/ccan/timer/benchmarks/Makefile
index 7e0653a..a3cbbd1 100644
--- a/ccan/timer/benchmarks/Makefile
+++ b/ccan/timer/benchmarks/Makefile
@@ -32,4 +32,4 @@ list.o: $(CCANDIR)/ccan/list/list.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
- $(RM) *.o $(ALL)
+ rm -f *.o $(ALL)
diff --git a/tools/Makefile b/tools/Makefile
index 338befc..6e4833a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -45,6 +45,6 @@ tools/configurator/configurator: tools/configurator/configurator.c
tools/modfiles: tools/modfiles.o tools/manifest.o $(DEP_OBJS)
tools-clean: ccanlint-clean
- $(RM) $(ALL_TOOLS)
+ rm -f $(ALL_TOOLS)
include tools/ccanlint/Makefile
diff --git a/tools/ccanlint/Makefile b/tools/ccanlint/Makefile
index 691f270..5a26679 100644
--- a/tools/ccanlint/Makefile
+++ b/tools/ccanlint/Makefile
@@ -47,4 +47,4 @@ $(CORE_OBJS): config.h
tools/ccanlint/ccanlint: $(OBJS)
ccanlint-clean:
- $(RM) tools/ccanlint/ccanlint
+ rm -f tools/ccanlint/ccanlint
--
2.5.5
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] Exclude system headers from .d files
2016-04-30 8:01 [PATCH 0/4] Cleanups to ccan build David Gibson
2016-04-30 8:01 ` [PATCH 1/4] Add missing files to make clean David Gibson
2016-04-30 8:01 ` [PATCH 2/4] Clean up use of 'rm' in Makefiles David Gibson
@ 2016-04-30 8:01 ` David Gibson
2016-04-30 8:01 ` [PATCH 4/4] Correctly include dependencies for nested modules David Gibson
3 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2016-04-30 8:01 UTC (permalink / raw)
To: ccan; +Cc: rusty
We currently generated .d dependency files with the -MD option to cc. That
includes system header files in the dependencies, which isn't often useful
and makes the .d more complicated than necessary.
This changes to -MMD which excludes system headers.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
Makefile-ccan | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile-ccan b/Makefile-ccan
index 0613fc8..f4e096b 100644
--- a/Makefile-ccan
+++ b/Makefile-ccan
@@ -135,7 +135,7 @@ MODS:=$(MODS_WITH_SRC) $(MODS_NO_SRC)
default: libccan.a
# Automatic dependency generation: makes ccan/*/*.d files.
-DEPGEN=-MD
+DEPGEN=-MMD
-include ccan/*/*.d
# Anything with C files needs building; dir leaves / on, sort uniquifies
--
2.5.5
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] Correctly include dependencies for nested modules
2016-04-30 8:01 [PATCH 0/4] Cleanups to ccan build David Gibson
` (2 preceding siblings ...)
2016-04-30 8:01 ` [PATCH 3/4] Exclude system headers from .d files David Gibson
@ 2016-04-30 8:01 ` David Gibson
2016-05-01 4:42 ` Rusty Russell
3 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2016-04-30 8:01 UTC (permalink / raw)
To: ccan; +Cc: rusty
Currently we pull auto-generated dependencies into the Makefile with
include ccan/*/*.d. That will omit any .d files from nested modules,
meaning things might not be correctly rebuilt there.
Correct this by using the list of modules instead of a 1-level wildcard.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
Makefile-ccan | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile-ccan b/Makefile-ccan
index f4e096b..bd6af5c 100644
--- a/Makefile-ccan
+++ b/Makefile-ccan
@@ -136,7 +136,7 @@ default: libccan.a
# Automatic dependency generation: makes ccan/*/*.d files.
DEPGEN=-MMD
--include ccan/*/*.d
+-include $(foreach m, $(MODS), ccan/$(m)/*.d)
# Anything with C files needs building; dir leaves / on, sort uniquifies
DIRS=$(patsubst %/, %, $(sort $(foreach m, $(filter-out $(MODS_EXCLUDE), $(MODS_WITH_SRC)), $(dir $(wildcard ccan/$m/*.c)))))
--
2.5.5
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] Correctly include dependencies for nested modules
2016-04-30 8:01 ` [PATCH 4/4] Correctly include dependencies for nested modules David Gibson
@ 2016-05-01 4:42 ` Rusty Russell
2016-05-02 9:33 ` David Gibson
0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2016-05-01 4:42 UTC (permalink / raw)
To: David Gibson, ccan; +Cc: rusty
David Gibson <david@gibson.dropbear.id.au> writes:
> Currently we pull auto-generated dependencies into the Makefile with
> include ccan/*/*.d. That will omit any .d files from nested modules,
> meaning things might not be correctly rebuilt there.
>
> Correct this by using the list of modules instead of a 1-level wildcard.
Thanks, these look great, please apply.
Cheers!
Rusty.
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] Correctly include dependencies for nested modules
2016-05-01 4:42 ` Rusty Russell
@ 2016-05-02 9:33 ` David Gibson
0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2016-05-02 9:33 UTC (permalink / raw)
To: Rusty Russell; +Cc: ccan, rusty
[-- Attachment #1.1: Type: text/plain, Size: 667 bytes --]
On Sun, May 01, 2016 at 02:12:54PM +0930, Paul 'Rusty' Russell wrote:
> David Gibson <david@gibson.dropbear.id.au> writes:
> > Currently we pull auto-generated dependencies into the Makefile with
> > include ccan/*/*.d. That will omit any .d files from nested modules,
> > meaning things might not be correctly rebuilt there.
> >
> > Correct this by using the list of modules instead of a 1-level wildcard.
>
> Thanks, these look great, please apply.
Done.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-02 9:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-30 8:01 [PATCH 0/4] Cleanups to ccan build David Gibson
2016-04-30 8:01 ` [PATCH 1/4] Add missing files to make clean David Gibson
2016-04-30 8:01 ` [PATCH 2/4] Clean up use of 'rm' in Makefiles David Gibson
2016-04-30 8:01 ` [PATCH 3/4] Exclude system headers from .d files David Gibson
2016-04-30 8:01 ` [PATCH 4/4] Correctly include dependencies for nested modules David Gibson
2016-05-01 4:42 ` Rusty Russell
2016-05-02 9:33 ` David Gibson
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).