首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

makefile奇怪的有关问题

2012-04-12 
makefile奇怪的问题1 CCgcc2 DEBUGdebug/$@34 vpath % debug:src:inc56 main:main.o print.o7${CC} -o $

makefile奇怪的问题
1 CC=gcc
  2 DEBUG=debug/$@
  3 
  4 vpath % debug:src:inc
  5 
  6 main:main.o print.o
  7 ${CC} -o ${DEBUG} $^
  8 
  9 main.o:main.c print.h
 10 ${CC} -c -o ${DEBUG} $<
 11 
 12 print.o:print.c print.h
 13 ${CC} -c -o ${DEBUG} $<
 14 
 15 clean:
 16 rm -f debug/*
第一次make时,成功生成.o文件 但是执行链接的时候却没有去debug目录去找 我写了 vpath % debug:src:inc 。make程序能去src去找,为什么不能去debug找。更奇怪的是第二次make 却能到debug下去找.o了

[解决办法]

C/C++ code
  9 [color=#FF0000]main.o[/color]:main.c print.h 10 ${CC} -c [color=#FF0000]-o ${DEBUG}[/color] $< 

热点排行
Bad Request.