build: Make "make clean" remove all files created when running "make check" #11435

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:make-cleaner changing 2 files +6 −6
  1. practicalswift commented at 9:18 PM on October 1, 2017: contributor

    Make make clean remove all files created when running make check. More specifically: remove also obj/build.h and bench/data/block413567.raw.h as part of make clean.

    Before this patch:

    $ git clone https://github.com/bitcoin/bitcoin.git
    $ cd bitcoin/
    $ ./autogen.sh
    $ ./configure
    $ cp -r ../bitcoin ../bitcoin-before-make
    $ make check
    $ make clean
    $ cp -r ../bitcoin ../bitcoin-after-make-and-make-clean
    $ cd ..
    $ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
    Only in bitcoin-after-make-and-make-clean/src/bench/data: block413567.raw.h
    Only in bitcoin-after-make-and-make-clean/src/obj: build.h
    $
    

    After this patch:

    $ git clone https://github.com/bitcoin/bitcoin.git
    $ cd bitcoin/
    $ ./autogen.sh
    $ ./configure
    $ cp -r ../bitcoin ../bitcoin-before-make
    $ make check
    $ make clean
    $ cp -r ../bitcoin ../bitcoin-after-make-and-make-clean
    $ cd ..
    $ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
    $
    
  2. fanquake added the label Build system on Oct 1, 2017
  3. in src/Makefile.am:481 in 877d5e03df outdated
     475 | @@ -476,6 +476,7 @@ CLEANFILES += univalue/*.gcda univalue/*.gcno
     476 |  CLEANFILES += wallet/*.gcda wallet/*.gcno
     477 |  CLEANFILES += wallet/test/*.gcda wallet/test/*.gcno
     478 |  CLEANFILES += zmq/*.gcda zmq/*.gcno
     479 | +CLEANFILES += obj/build.h
     480 |  
     481 |  DISTCLEANFILES = obj/build.h
    


    laanwj commented at 1:00 PM on October 2, 2017:

    It can probably be removed from DISTCLEANFILES in that case? Not sure what the rules here are @theuni


    theuni commented at 9:35 PM on October 2, 2017:

    Yep, agreed.

    IIRC the intention here was for build.h to be generated when bootstrapping, in which case make clean should not clean it. But we don't currently do that and all that needs to be re-worked anyway.


    practicalswift commented at 5:29 AM on October 3, 2017:

    Fixed! :-)

  4. theuni commented at 9:30 PM on October 2, 2017: member

    The problem with bench is actually a variable collision from Makefile.test.include

    I believe the correct fix is:

    diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include
    index 2b1f70b..5d61a8e 100644
    --- a/src/Makefile.bench.include
    +++ b/src/Makefile.bench.include
    @@ -6,9 +6,9 @@ bin_PROGRAMS += bench/bench_bitcoin
     BENCH_SRCDIR = bench
     BENCH_BINARY = bench/bench_bitcoin$(EXEEXT)
     
    -RAW_TEST_FILES = \
    +RAW_BENCH_FILES = \
       bench/data/block413567.raw
    -GENERATED_TEST_FILES = $(RAW_TEST_FILES:.raw=.raw.h)
    +GENERATED_BENCH_FILES = $(RAW_BENCH_FILES:.raw=.raw.h)
     
     bench_bench_bitcoin_SOURCES = \
       bench/bench_bitcoin.cpp \
    @@ -28,7 +28,7 @@ bench_bench_bitcoin_SOURCES = \
       bench/perf.h \
       bench/prevector_destructor.cpp
     
    -nodist_bench_bench_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
    +nodist_bench_bench_bitcoin_SOURCES = $(GENERATED_BENCH_FILES)
     
     bench_bench_bitcoin_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CLFAGS) $(EVENT_PTHREADS_CFLAGS) -I$(builddir)/bench/
     bench_bench_bitcoin_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
    @@ -56,11 +56,11 @@ endif
     bench_bench_bitcoin_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
     bench_bench_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
     
    -CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_TEST_FILES)
    +CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES)
     
     CLEANFILES += $(CLEAN_BITCOIN_BENCH)
     
    -bench/checkblock.cpp: bench/data/block413567.raw.h
    +bench/checkblock.cpp: $(GENERATED_BENCH_FILES)
     
     bitcoin_bench: $(BENCH_BINARY)
     
    
  5. practicalswift force-pushed on Oct 3, 2017
  6. practicalswift commented at 5:30 AM on October 3, 2017: contributor

    @theuni Fixed! Thanks!

  7. practicalswift commented at 7:23 AM on October 3, 2017: contributor

    Failing with:

    make[2]: *** No rule to make target `bench/data/block413567.raw.h', needed by `bench/checkblock.cpp'.  Stop.
    
  8. theuni commented at 5:19 PM on October 3, 2017: member

    I'm so confused as to how this worked before. I'm assuming that several things didn't, we just haven't noticed. Anyway, here's the fix for that one:

    diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include
    index 5d61a8e..bc9548e 100644
    --- a/src/Makefile.bench.include
    +++ b/src/Makefile.bench.include
    @@ -11,6 +11,7 @@ RAW_BENCH_FILES = \
     GENERATED_BENCH_FILES = $(RAW_BENCH_FILES:.raw=.raw.h)
     
     bench_bench_bitcoin_SOURCES = \
    +  $(RAW_BENCH_FILES) \
       bench/bench_bitcoin.cpp \
       bench/bench.cpp \
       bench/bench.h \
    
  9. practicalswift force-pushed on Oct 3, 2017
  10. practicalswift commented at 5:30 PM on October 3, 2017: contributor

    @theuni Pushed an updated version :-)

  11. build: Make "make clean" remove all files created when running "make check"
    More specifically: remove also obj/build.h and bench/data/block413567.raw.h.
    
    Before this patch:
    
    ```
    $ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
    Only in bitcoin-after-make-and-make-clean/src/bench/data: block413567.raw.h
    Only in bitcoin-after-make-and-make-clean/src/obj: build.h
    $
    ```
    
    After this patch:
    
    ```
    $ diff -rq bitcoin-before-make/ bitcoin-after-make-and-make-clean/ | grep -E "^Only in bitcoin-after-make-and-make-clean/" | grep -v dirstamp
    $
    ```
    f35d033369
  12. in src/Makefile.bench.include:64 in 155c1e10f2 outdated
      61 | +CLEAN_BITCOIN_BENCH = bench/*.gcda bench/*.gcno $(GENERATED_BENCH_FILES)
      62 |  
      63 |  CLEANFILES += $(CLEAN_BITCOIN_BENCH)
      64 |  
      65 | -bench/checkblock.cpp: bench/data/block413567.raw.h
      66 | +bench/checkblock.cpp: $(GENERATED_BENCH_FILES)
    


    laanwj commented at 12:49 PM on October 4, 2017:

    I don't think this dependency should change - it depends on the specific generated file, not all of them (in case further ones are added later).

  13. practicalswift force-pushed on Oct 4, 2017
  14. practicalswift commented at 12:55 PM on October 4, 2017: contributor

    @laanwj Fixed! :-)

  15. laanwj commented at 1:35 PM on October 4, 2017: member

    Tested ACK f35d033

  16. laanwj merged this on Oct 4, 2017
  17. laanwj closed this on Oct 4, 2017

  18. laanwj referenced this in commit 167cef8082 on Oct 4, 2017
  19. PastaPastaPasta referenced this in commit 1f2a92a4d2 on Dec 22, 2019
  20. PastaPastaPasta referenced this in commit 3e2d5fba31 on Jan 2, 2020
  21. PastaPastaPasta referenced this in commit a4725be905 on Jan 4, 2020
  22. PastaPastaPasta referenced this in commit aae784ed5a on Jan 12, 2020
  23. PastaPastaPasta referenced this in commit fe4b0b87de on Jan 12, 2020
  24. PastaPastaPasta referenced this in commit 11952a464b on Jan 12, 2020
  25. PastaPastaPasta referenced this in commit 4eeb2c770b on Jan 12, 2020
  26. PastaPastaPasta referenced this in commit c044520c47 on Jan 12, 2020
  27. PastaPastaPasta referenced this in commit 94b3695ae4 on Jan 12, 2020
  28. PastaPastaPasta referenced this in commit f49f1f4ecf on Jan 16, 2020
  29. PastaPastaPasta referenced this in commit 0160203306 on Jan 22, 2020
  30. PastaPastaPasta referenced this in commit 36f0a51282 on Jan 29, 2020
  31. PastaPastaPasta referenced this in commit 8e9dcba4ab on Jan 29, 2020
  32. ckti referenced this in commit c1c3f30046 on Mar 28, 2021
  33. practicalswift deleted the branch on Apr 10, 2021
  34. gades referenced this in commit 93eb6eb152 on May 6, 2022
  35. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-16 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me