如何在DevC++中使用自定义makefile调用子目录中的不同makefile?调用会导致无限循环而不执行子目录mkfile

如何在DevC++中使用自定义makefile调用子目录中的不同makefile?调用会导致无限循环而不执行子目录mkfile,makefile,nested,Makefile,Nested,在UNIX中,下面的代码可以很好地处理子目录调用,而在DevC++中,如果没有这些子目录调用此makefile,则运行正常。我的意思是说在设置定制文件时没有问题,但是调用是有问题的 make文件中的源代码: $(IDMSOBJDIR)/idmslex.o : $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/front.h $(INCLPATH)/msgMgr.h $(INCLPATH)

在UNIX中,下面的代码可以很好地处理子目录调用,而在DevC++中,如果没有这些子目录调用此makefile,则运行正常。我的意思是说在设置定制文件时没有问题,但是调用是有问题的

make文件中的源代码:

$(IDMSOBJDIR)/idmslex.o :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/front.h $(INCLPATH)/msgMgr.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h $(IDMSDIR)/idmskwords.rwd $(IDMSDIR)/idmslex.l
            cd $(IDMSDIR);  make

$(IDMSOBJDIR)/idmspar.o :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/front.h $(INCLPATH)/msgMgr.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h $(IDMSDIR)/idmskwords.rwd $(IDMSDIR)/idmspar.y
            cd $(IDMSDIR);  make

$(CICSOBJDIR)/cicslex.o :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/front.h $(INCLPATH)/msgMgr.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h $(CICSDIR)/cicskwords.rwd $(CICSDIR)/cicslex.l
            cd $(CICSDIR);  make

$(CICSOBJDIR)/cicspar.o :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/front.h $(INCLPATH)/msgMgr.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h $(CICSDIR)/cicskwords.rwd $(CICSDIR)/cicspar.y
            cd $(CICSDIR)   
            make

$(CICSOBJDIR)/cicsunp.o :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/msgMgr.h $(INCLPATH)/front.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h
            cd $(CICSDIR);  make

$(CICSOBJDIR)/cicskwordshash.o  :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/front.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h $(CICSDIR)/cicskwords.rwd
            cd $(CICSDIR);  make

$(DB2OBJDIR)/sqllex.o   :   $(INCLPATH)/rtbtree.h $(INCLPATH)/memmgmt.h $(INCLPATH)/rtbyacc.h $(INCLPATH)/msgMgr.h $(INCLPATH)/front.h $(INCLPATH)/setops.h $(INCLPATH)/nodedecl.h $(INCLPATH)/operators.h $(INCLPATH)/tokdefs.h $(DB2DIR)/sqlkwords.rwd $(DB2DIR)/sqllex.l
            cd ../db2/src;  make
devc++的控制台:

make[205]: Entering directory 
cd ../cics/src                

make                          

make[206]: Entering directory 
cd ../cics/src                

make                          

make[207]: Entering directory 
cd ../cics/src                

make                          

make[208]: Entering directory 
cd ../cics/src                

.
.
.

它继续运行,既不返回控件,也不在子目录中执行make。我一直在打印这行

将cd和make拆分为两行的配方不正确。每一行都是它自己的shell会话。因此,该配方在当前目录中重复运行make。您也有生成不同文件的重复方法。那不是你想要的。如果make设置正确,那么每个文件将运行一次配方。第二次运行不会有多大效果,但效率仍然很低。@EtanReisner您能否建议一种可以完美实现的方法。从你解释的方式我无法理解这个解决方案。大多数粘贴的规则都有cd$CICSDIR;制作这是一个正确的配方线的概念。其中一条规则在单独的行中有cd$CICSDIR和make;这是一个错误的配方行的想法。cd影响一个外壳,该外壳在行结束时关闭,然后在其自身外壳中发生make。您需要像其他规则一样组合这些行。此外,您还有相同的cd$CICSDIR;为每个规则制定食谱,但期望它们生成不同的目标。如果他们生成所有规则,这可能会起作用,但会使每个规则独立运行。@EtanReisner感谢您的回答,是的,当我放置在同一行中时,该问题已得到解决,但仍然无法使用上述命令,并且如果我将&&替换;它就像一块宝石。修正这一条规则能解决你的问题吗?或者它只是解决了一个问题,而其他问题仍然存在?