Opened 8 years ago

Last modified 5 years ago

#1098 assigned bug

make 'distclean' cleans too much, 'clean' too little

Reported by: h.b.furuseth@… Owned by: noz
Milestone: Future Keywords: compat,build
Cc:

Description

make distclean removes these files from the .tar.gz.
The two first files are needed to build angband:

configure src/autoconf.h.in aclocal.m4

Conversely, make clean does not remove these files,
I don't know which ones are intended to stay:

config.log config.status
mk/extra.mk mk/sinclude.mk
src/angband src/autoconf.h

I notice that src/Makefile gets an apparently unused
clean-extra target which removes autoconf.h.

Change History (12)

comment:1 in reply to: ↑ description Changed 8 years ago by magnate

  • Keywords compat added
  • Milestone changed from Triage to 3.1.3
  • Status changed from new to confirmed

Replying to h.b.furuseth@…:

make distclean removes these files from the .tar.gz.
The two first files are needed to build angband:

configure src/autoconf.h.in aclocal.m4

All three of these are generated by autogen.sh - I adjusted make distclean to return us to that initial point. You are correct that since autogen.sh is not shipped in the tar.gz, this is a problem. Personally, I would ship autogen.sh in the tarball, but takkaria disagrees.

Conversely, make clean does not remove these files,
I don't know which ones are intended to stay:

config.log config.status
mk/extra.mk mk/sinclude.mk
src/angband src/autoconf.h

I notice that src/Makefile gets an apparently unused
clean-extra target which removes autoconf.h.

I would not like to see make distclean do anything other than what it does now, but I would be happy to see make clean remove the above files or, if make clean is considered useful as-is, I would prefer to see an additional target which removed them.

comment:2 Changed 7 years ago by magnate

  • Milestone changed from 3.2.0 to 3.3.0

Punting to 3.3: non-urgent bug or change.

comment:3 Changed 6 years ago by myshkin

  • Owner set to myshkin
  • Status changed from confirmed to assigned

comment:4 Changed 6 years ago by myshkin

  • Milestone changed from 3.3.0 to 3.4.0

Not finished by 3.3.0...punting to 3.4.0.

I think make clean should remove src/angband, and make distclean should remove the artifacts generated by autoconf (config.log, config.status, mk/extra.mk, mk/sinclude.mk, src/autoconf.h). I intend to review the build system more generally before 3.4.0 comes out; this will include an upgrade to the latest buildsys or a replacement of buildsys, and a cleanup of what the various top-level targets do.

comment:5 Changed 6 years ago by magnate

make clean should remove

all .o files
all executables (both angband and angband.exe, all tests etc.)
all files copied from their original locations (i.e. dlls)
all .gcov, .gcda and .gcno files
all .dep files

IMO the only difference between make clean and make distclean should be that the latter should remove all the files generated by autogen.sh and configure.

So make clean just means "I want to rebuild using exactly the same config"

and make distclean means "I want to start from scratch running autogen.sh"

AFAIU these two concepts converge in Windows, which doesn't use autotools - is that right? So make clean and make distclean should be identical in Windows (but not in cygwin, which is effectively a *nix).

comment:6 Changed 6 years ago by hbf

No. I should have mentioned expected behavior in the ticket:
DISTclean should remove files that were not in the DISTribution (the
.tar.gz file). It should not remove configure, which is in the dist.

GNU uses this heuristic:
http://www.gnu.org/software/automake/manual/automake.html#Clean

  • If make built it, and it is commonly something that one would want to rebuild (for instance, a .o file), then mostlyclean should delete it.
  • Otherwise, if make built it, then clean should delete it.
  • If configure built it, then distclean should delete it.
  • If the maintainer built it (for instance, a .info file), then maintainer-clean should delete it. However maintainer-clean should not delete anything that needs to exist in order to run './configure && make'.

comment:7 Changed 6 years ago by magnate

Ok, the problem is that we ship configure instead of autogen.sh. I accept the need for a target that gets back to configure (your distclean), but I also want a target that removes configure and gets back to the state of the repo (make repoclean?).

comment:8 Changed 6 years ago by magnate

So, if we're going to ship configure, make distclean needs to remove

config.* mk/*.mk src/angband src/autoconf.h autom4te.cache/

and *not* configure

Agreed?

Last edited 6 years ago by magnate (previous) (diff)

comment:9 Changed 6 years ago by magnate

I've been spending too much time in the 3.3-release branch. Since Aerdan's buildsys upgrade, make distclean no longer removes configure ...

comment:10 Changed 6 years ago by magnate

Note to self: make clean needs to call make -C src/tests clean

comment:11 Changed 6 years ago by magnate

  • Keywords compat,build added; compat removed
  • Owner changed from myshkin to noz

comment:12 Changed 5 years ago by magnate

  • Milestone changed from 3.4.0 to 3.5.0

Moved to 3.5.0 with a genuine intention to fix them by then.

Note: See TracTickets for help on using tickets.