请教关于makefile的问题
时间:2006-04-12
来源:互联网
我是个初学者,对linux很感兴趣但是学起来很头痛,特别是关于makefile文件
# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
# This Makefile has been simplified as much as possible, by putting all
# generic material, independent of this specific directory, into
# ../Rules.make. Read that file for details
TOPDIR := $(shell cd ..; pwd)
include $(TOPDIR)/Rules.make
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
CFLAGS += $(DEBFLAGS)
CFLAGS += -I..
TARGET = scull
OBJS = $(TARGET).o
SRC = main.c pipe.c access.c
all: .depend $(TARGET).o
$(TARGET).o: $(SRC:.c=.o)
$(LD) -r $^ -o $@
install:
install -d $(INSTALLDIR)
install -c $(TARGET).o $(INSTALLDIR)
clean:
rm -f *.o *~ core .depend
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > $@
ifeq (.depend,$(wildcard .depend))
include .depend
endif
有几处看不太懂
1 all: .depend $(TARGET).o 据说makefile是从这里开始执行的,但是不知
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > $@
是什么意思
2 这是个编译驱动模块的makefile它和编译一般的应用程序有什么区别啊
# Comment/uncomment the following line to disable/enable debugging
#DEBUG = y
# This Makefile has been simplified as much as possible, by putting all
# generic material, independent of this specific directory, into
# ../Rules.make. Read that file for details
TOPDIR := $(shell cd ..; pwd)
include $(TOPDIR)/Rules.make
# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
CFLAGS += $(DEBFLAGS)
CFLAGS += -I..
TARGET = scull
OBJS = $(TARGET).o
SRC = main.c pipe.c access.c
all: .depend $(TARGET).o
$(TARGET).o: $(SRC:.c=.o)
$(LD) -r $^ -o $@
install:
install -d $(INSTALLDIR)
install -c $(TARGET).o $(INSTALLDIR)
clean:
rm -f *.o *~ core .depend
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > $@
ifeq (.depend,$(wildcard .depend))
include .depend
endif
有几处看不太懂
1 all: .depend $(TARGET).o 据说makefile是从这里开始执行的,但是不知
depend .depend dep:
$(CC) $(CFLAGS) -M *.c > $@
是什么意思
2 这是个编译驱动模块的makefile它和编译一般的应用程序有什么区别啊
作者: ntzqj 发布时间: 2006-04-12
怎么没有人回啊,
作者: ntzqj 发布时间: 2006-04-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28