I learn how to build makefile from below:
http://www.chinaunix.net/old_jh/23/408225.html
http://blog.chinaunix.net/uid-23089249-id-2855999.html
This is my first makefile demo!!It's so simple and crube, but i will make if better gradually!!
It's direction:
warrior@warrior:~/CreazyCode/Cproject/test$ ls
demo.c demo.h main.c main.h makefile
And it's content:
#makefile demo V1.0
#author: warrior
#mail:675979646@qq.com
#date:2015/3/21
CC := gcc
CFLAGS := -c -g -W -Wall
DIR := ./
SOURCES := $(shell ls *.c)
OBJS := $(patsubst %.c,%.o,$(SOURCES))
TARGET := target
${TARGET} : ${OBJS}
${CC} ${CFLAGS} -o $@ $^
%.o : %.c
$(CC) ${CFLAGS} -o $@ $<
.PHONY : clean
clean :
-rm -f *.o target
阅读(35) | 评论(0) | 转发(0) |
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
http://www.chinaunix.net/old_jh/23/408225.html
http://blog.chinaunix.net/uid-23089249-id-2855999.html
This is my first makefile demo!!It's so simple and crube, but i will make if better gradually!!
It's direction:
warrior@warrior:~/CreazyCode/Cproject/test$ ls
demo.c demo.h main.c main.h makefile
#makefile demo V1.0
#author: warrior
#mail:675979646@qq.com
#date:2015/3/21
CC := gcc
CFLAGS := -c -g -W -Wall
DIR := ./
SOURCES := $(shell ls *.c)
OBJS := $(patsubst %.c,%.o,$(SOURCES))
TARGET := target
${TARGET} : ${OBJS}
${CC} ${CFLAGS} -o $@ $^
%.o : %.c
$(CC) ${CFLAGS} -o $@ $<
.PHONY : clean
clean :
-rm -f *.o target
相关热门文章
给主人留下些什么吧!~~
评论热议