Hi,

I have a not so complex Makefile which first generates and
includes a Makefile.subdirs (which contains a variable SUBDIRS
with a list of directories) and then I'd like it to execute
a depend and a compilation phase (that one in every subdir).

The Makefile.subdirs generation and depend work fine, but
I never see gmake descending into the $(SUBDIRS) and it reports
"nothing to be done for all" even though I've put the $(SUBDIRS)
under the .PHONY target.

Does anybody see, what am I doing wrong or should I come up
with a simpler test case? Thank you for any hints.

Regards
Alex


all: depend $(SUBDIRS)

$(SUBDIRS): 
        $(MAKE) -C $@ -f Makefile.mbs

depend: Makefile.targets

Makefile.targets: $(foreach dir, $(SUBDIRS), $(dir)/bld.inf)
        rm -f $@; \
        for dir in $(SUBDIRS); do \
                echo "===> $$dir"; \
                if cd $$dir; then \
                        echo "Creating Makefile.mbs"; \
                        $(CPP) < bld.inf | $(INF2MAKE) -gd $(TOPDIR) > Makefile.mbs; \
                        echo "Extracting mmp filenames from bld.inf"; \
                        MMPFILES=`$(CPP) $(CPPFLAGS) < bld.inf | $(INF2MAKE) -md 
$(TOPDIR)`; \
                        for file in $$MMPFILES; do \
                                echo "Appending target from $$file to $@"; \
                                $(CPP) $(CPPFLAGS) < $$file | $(MMP2MAKE) -t >> 
$(TOPDIR)/$@ && \
                                        echo "-C $(TOPDIR)/$$dir -f $$file.mbs" >> 
$(TOPDIR)/$@; \
                        done; \
                        cd $(TOPDIR); \
                else \
                        echo "Can not change to the directory $$dir" >&2; \
                fi; \
        done

################################################################################

ifneq ($(MAKECMDGOALS), distclean)

ifeq ($(strip $(GENBUILD)),)
$(error Set GENBUILD variable to the genbuild list file)
endif

Makefile.subdirs: $(GENBUILD)
        $(GEN2MAKE) -g $< > $@

-include Makefile.subdirs

endif

################################################################################

distclean:
        rm -f Makefile.subdirs Makefile.targets; \
        find . -iname \*.mbs -print0 | xargs -0 rm -f

.PHONY: all depend distclean $(SUBDIRS)




_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to