makefile 小例(包含vpath,-I等的用法)


new
|--  Makefile
|--  dns
|     |--  README
|     |--  checkDNS.c
|     |--  checkDNS.h
|     |--  dns.h
|     |--  genDNSPacket.c
|     |--  genDNSPacket.h
|     |--  readDNS.c
|    ` --  readDNS.h
|--  http
|     |--  checkHttp.c
|     |--  checkHttp.h
|     |--  genHttpPacket.c
|     |--  genHttpPacket.h
|     |--  http.h
|     |--  readHttp.c
|    ` --  readHttp.h
|--  rc
`
--  share
    
|--  constVar.h
    
|--  file.h
    
|--  net.c
    
|--  net.h
    
|--  servConnect.c
    
|--  servConnect.h
    `
--  socketHead.h
 makefile文件:(不包含dns的)
all: netM

CC 
=  gcc
INCLUDE 
=  . / http
INCLUDE 
+=   - I . / share
OBJS 
=  net.o readHttp.o genHttpPacket.o servConnect.o checkHttp.o

vpath 
% .h . / http : . / share
vpath 
% .c . / http : . / share
vpath 
% .o . /  : . / http : . / share

netM: $(OBJS)
        $(CC) 
- o netM $(OBJS)
readHttp.o: readHttp.c readHttp.h constVar.h file.h
        $(CC) 
- c $ <   - I$(INCLUDE)
genHttpPacket.o: genHttpPacket.c genHttpPacket.h constVar.h http.h 
                socketHead.h
        $(CC) 
- c $ <   - I$(INCLUDE)
servConnect.o: servConnect.c servConnect.h constVar.h http.h socketHead.h
        $(CC) 
- c $ <   - I$(INCLUDE)
checkHttp.o: checkHttp.c checkHttp.h constVar.h http.h socketHead.h 
                genHttpPacket.h servConnect.h
        $(CC) 
- c $ <   - I$(INCLUDE)
net.o: net.c net.h constVar.h readHttp.h file.h servConnect.h http.h 
                socketHead.h checkHttp.h genHttpPacket.h
        $(CC) 
- c $ <   - I$(INCLUDE)

.PHONY: clean
clean:
        
- rm $(OBJS)
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值