[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recursive Make and -t
From: |
Ken Smith |
Subject: |
Recursive Make and -t |
Date: |
Wed, 1 Dec 2004 16:14:09 -0500 |
User-agent: |
Mutt/1.5.6i |
Here is an example build which invokes make recursively in three subtly
different ways. I feel that they should probably all behave the same
when invoking `gmake -t` but they do not. Can anyone explain why?
Makefile
define submake
$(MAKE)
endef
.PHONY: test1
test1:
cd subdir && $(submake)
.PHONY: test1.1
test1.1:
+cd subdir && $(submake)
.PHONY: test2
test2:
cd subdir && $(MAKE)
.PHONY: clean
clean:
cd subdir && $(MAKE) clean
subdir/Makefile
hello:
echo "hi" > hello
clean:
rm -f hello
STDOUT/ERR during `gmake clean test1' or `gmake clean test1.1' or `gmake clean
test2'
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
rm -f hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
cd subdir && gmake
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
echo "hi" > hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
STDOUT/ERR during `gmake clean && gmake -t test1'
cd subdir && gmake clean
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
rm -f hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
gmake: Nothing to be done for `test1'.
STDOUT/ERR during `gmake clean && gmake -t test1.1'
cd subdir && gmake clean
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
rm -f hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
cd subdir && gmake
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
touch hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
STDOUT/ERR during `gmake clean && gmake -t test2'
cd subdir && gmake clean
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
rm -f hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
cd subdir && gmake
gmake[1]: Entering directory `/var/tmp/make_test/subdir'
touch hello
gmake[1]: Leaving directory `/var/tmp/make_test/subdir'
The above three invocations are all invoking a submake using the builtin
$(MAKE) variable. The target test1 is using it indirectly. This
indirection breaks the special treatment of the variable when using -t
which I would have suspected would be preserved. In response to this
change in behavior, test1.1 uses the special prepended plus sign in
order to reinstate the special treatment the MAKE variable usually
imparts. Is this intended? If so, why?
Ken
- Recursive Make and -t,
Ken Smith <=