GNU Make has -B
option that forces make
to ignore existing targets. It allows to rebuild a target, but it also rebuilds all the dependency tree of the target. I wonder is there a way to force rebuilding a target without rebuilding its dependencies (using GNU Make options, settings in Makefile, compatible make
-like software, etc.)?
Illustration of the problem:
$ mkdir test; cd test
$ unexpand -t4 >Makefile <<EOF
huge:
@echo "rebuilding huge"; date >huge
small: huge
@echo "rebuilding small"; sh -c 'cat huge; date' >small
EOF
$ make small
rebuilding huge
rebuilding small
$ ls
huge Makefile small
$ make small
make: 'small' is up to date.
$ make -B small
rebuilding huge # how to get rid of this line?
rebuilding small
$ make --version | head -n3
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Of course one can rm small; make small
, but is there a built-in way?