#
# Makefile for the linux memory manager.
#
# 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 definition is now in the main makefile...

#实际上只会执行到这一个规则,后面两个规则用不上
#.c文件编译为.o文件
.c.o:
    $(CC) $(CFLAGS) -c $<
#.s文件编译为.o文件
.s.o:
    $(AS) -o $*.o $<
#.c文件编译为.s文件
.c.s:
    $(CC) $(CFLAGS) -S $<

#定义变量
OBJS    = memory.o swap.o mmap.o kmalloc.o vmalloc.o

#目标
mm.o: $(OBJS)
    $(LD) -r -o mm.o $(OBJS)

#依赖,从.depend文件中提取,实际上就是搜索相关的.h头文件
dep:
    $(CPP) -M *.c > .depend

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif