I learn how to build makefile from below:
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
阅读(819) | 评论(0) | 转发(0) |