Hi all,
I am trying to build a number of related projects for the LPC2366 &
LPC2478. They share a common core of code and I want to generate all the
hex files when this changes. My thought was to have each individual
project in its own sub-directory of a main project with a master
makefile which recursively built the sub-projects. The problem is that
the make target is being ignored. Sorry if this is off topic, but it is
driving me mad!
My main makefile is:
SUBDIRS = subdirs/*
all clean:
target="$(patsubst %,%,$@)"; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $$target) \
done; \
# Listing of phony targets.
.PHONY : all clean
The problem is when the command $(MAKE) $$target is run the target is
ignored and the default target is executed.
To test and show the problem I am using 3 subdirs dir1, dir2 & dir3 with
the following makefile:
all clean:
make_target="$(patsubst %,%,$@)"; \
echo "Making $$target";
When I run make clean I get:
target="clean"; \
list='subdirs/*'; for subdir in $list; do \
echo "Making $target in $subdir"; \
(cd $subdir && make $target) \
done; \
Making clean in subdirs/dir1
C:\WinARM\utils\bin\make.exe[1]: Entering directory `c:/Documents and
Settings/Craig/workspace/Test/subdirs/dir1'
make_target="all"; \
echo "Making $target";
Making
C:\WinARM\utils\bin\make.exe[1]: Leaving directory `c:/Documents and
Settings/Craig/workspace/Test/subdirs/dir1'
Making clean in subdirs/dir2
C:\WinARM\utils\bin\make.exe[1]: Entering directory `c:/Documents and
Settings/Craig/workspace/Test/subdirs/dir2'
make_target="all"; \
echo "Making $target";
Making
C:\WinARM\utils\bin\make.exe[1]: Leaving directory `c:/Documents and
Settings/Craig/workspace/Test/subdirs/dir2'
Making clean in subdirs/dir3
C:\WinARM\utils\bin\make.exe[1]: Entering directory `c:/Documents and
Settings/Craig/workspace/Test/subdirs/dir3'
make_target="all"; \
echo "Making $target";
Making
C:\WinARM\utils\bin\make.exe[1]: Leaving directory `c:/Documents and
Settings/Craig/workspace/Test/subdirs/dir3'
Any help would be greatly appreciated.