如何调用Makefile , enter to directory A and B,then make them

如何调用Makefile ,enter to directory A and B,then make them

1. it can work
must be a Makefile and use command make, .sh file maybe can not work!


all:
        cd ./A && make all
        cd ./B && make all
        gcc -c -o main.o main.c
        gcc -o math main.o ./A/add.o ./A/sub.o ./B/mul.o ./B/div.o

clean:
        rm *.o ./A/*.o ./B/*.o
2. not try      
假如在目录M下执行makefile
target1:
     make -C A target_n  
     make -C B target_n


make -C A,进入A目录,执行A目录下的makefile,这时你的工作环境就在A目录,你可以在目录A下makefile中的target_n里面echo `pwd`看下      

3. not try
进入到子文件夹运行
SUBDIRS = A B

$(EVERYTHING)::
    @for subdir in $(SUBDIRS); \
    do \
        echo "making $@ in $$subdir"; \
        ( cd $$subdir && $(MAKE) -f makefile $@ ) || exit 1; \
    done

大致就是如此  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值