Makefile 文件

AS86 =nasm
LD86 =ld -s

AS =as
LD =ld
LDFLAGS =-x -M

CC =gcc
CFLAGS =-Wall -g  -nostdinc -Iinclude  -O -fno-builtin

CPP =gcc -E -nostdinc -Iinclude

ARCHIVES=mm/mm.o kernel/kernel.o fs/fs.o
LIBS =lib/lib.a
DRIVES  =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a

.c.s:
 $(CC) $(CFLAGS)/
  -S -o $*.s $<
.s.o:
 $(AS) -c -o $*.o $<
.c.o:
 $(CC) $(CFLAGS) /
  -c -o $*.o
all: followking.img
followking.img: boot/bootsect boot/setup tools/system.tmp
 nasm -f bin tools/makeboot.asm -o followking.img
#disk: followking.img
# dd bs=8192 if=followking.img of=followking_20-16-63.img
boot/setup:
 $(AS86) -f bin -o boot/setup boot/setup.s
boot/bootsect:
 $(AS86) -o boot/bootsect boot/bootsect.s
tools/system:  boot/head.o init/main.o /
  $(ARCHIVES) /
  $(LIBS) /
  $(DRIVES)
 $(LD) $(LDFLAGS) -T vmfkix.lds boot/head.o init/main.o /
 $(ARCHIVES) /
 $(LIBS) /
 $(DRIVES) /
 -o tools/system > System.map
tools/system.tmp: tools/system
 cp -f tools/system tools/system.tmp
 strip tools/system.tmp
boot/head.o:
 $(AS86) -f elf -o boot/head.o boot/head.s
mm/mm.o:
 (cd mm; make)
init/main.o:
 (cd init; make)
kernel/kernel.o:
 (cd kernel; make)
lib/lib.a:
 (cd lib; make)
fs/fs.o:
 (cd fs; make)
kernel/blk_drv/blk_drv.a:
 (cd kernel/blk_drv; make)
kernel/chr_drv/chr_drv.a:
 (cd kernel/chr_drv; make)

clean:
 rm -f followking.img System.map
 rm -f boot/*.o init/*.o
 (cd mm; make clean)
 (cd init;make clean)
 (cd tools;make clean)
 (cd boot; make clean)
 (cd kernel;make clean)
 (cd lib; make clean)
 (cd kernel/chr_drv; make clean)
 (cd kernel/blk_drv; make clean)
 (cd fs; make clean)
 rm -f *~ boot/*~ init/*~ lib/*~ kernel/*~  /
 kernel/chr_drv/*~ kernel/blk_drv/*~  /
 fs/*~ mm/*~ tools/*~ include/*~ include/sys/*~ include/asm/*~
 rm -f include/fkix/*~

 

你可能感兴趣的:(Makefile 文件)