#
# Makefile for the linux kernel.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
#.S文件编译为.s文件
.S.s:
$(CPP) -traditional $< -o $*.s
#.c文件编译为.s文件
.c.s:
$(CC) $(CFLAGS) -S $<
#.s文件编译为.o文件
.s.o:
$(AS) -c -o $*.o $<
#.c文件编译为.o文件
.c.o:
$(CC) $(CFLAGS) -c $<
#定义变量
OBJS = sched.o sys_call.o traps.o irq.o dma.o fork.o
panic.o printk.o vsprintf.o sys.o module.o ksyms.o exit.o
signal.o mktime.o ptrace.o ioport.o itimer.o
info.o ldt.o time.o
#此文件夹最后的编译目标
all: kernel.o
#将定义的.o文件链接为一个kernel.o闻不见
kernel.o: $(OBJS)
$(LD) -r -o kernel.o $(OBJS)
sync
sys_call.s: sys_call.S
sys_call.o: sys_call.s
sched.o: sched.c
$(CC) $(CFLAGS) $(PROFILING) -fno-omit-frame-pointer -c $<
ksyms.lst: ksyms.S ../include/linux/autoconf.h
$(CPP) $(CFLAGS) $< > $@
#生成ksyms.s文件
ksyms.s: ksyms.sh ksyms.lst
sh $< > $@
ksyms.o: ksyms.s
#确定依赖
dep:
$(CPP) -M *.c > .depend
dummy:
#
# include a dependency file if one exists
#
#引入相关依赖
ifeq (.depend,$(wildcard .depend))
include .depend
endif