makefile

工程管理器make
企业级makefile-v1.0


1.根目录makefile--总控的makefile
(1、进入各个功能子目录执行make命令 2.将所有.o文件链接生成可执行文件)
2.功能目录的makefile--1.将src目录里的.c文件编程生成.o文件
3.scripts的makefile--定义变量(相当于C语言中的头文件)

项目的makefile顺序:先看scripts的makefile,再看总控的makefile,其次看功能目录的makefile

include scripts/Makefile

modules_make = $(MAKE) -C $(1);
modules_clean = $(MAKE) clean -C $(1);

.PHONY: all mm mc clean

all: $(Target)

#Modules += check_putin pack_message main
#AllObjs := $(addsuffix /src/*.o,$(Modules))
#check_putin/src/*.o pack_message/src/*.o main/src/*.o
mm:
    @ $(foreach n,$(Modules),$(call modules_make,$(n)))
mc:
    @ $(foreach n,$(Modules),$(call modules_clean,$(n)))

$(Target) : mm
    $(CC) $(CFLAGS) -o $(Target) $(AllObjs) $(Libs)
    #gcc -Wall -O3 -o client check_putin/src/*.o main/src/*.o pack_message/src/*.o -lpthread
    @ echo $(Target) make done!

clean : mc
    rm -rf $(Target)
    @ echo clean done!
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值