Skip to content

Commit

Permalink
与final中sh.c合并,并补上Makefile遗漏的rename
Browse files Browse the repository at this point in the history
  • Loading branch information
zzh428 authored Jun 28, 2018
1 parent 93b70dc commit 51d5e37
Show file tree
Hide file tree
Showing 2 changed files with 275 additions and 138 deletions.
40 changes: 33 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ initcode: initcode.S
$(OBJCOPY) -S -O binary initcode.out initcode
$(OBJDUMP) -S initcode.o > initcode.asm

kernel: $(OBJS) entry.o entryother initcode kernel.ld
$(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS) -b binary initcode entryother
LUA = lua

kernel: $(OBJS) entry.o entryother initcode kernel.ld $(LUA)
$(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS) -b binary initcode entryother $(LUA)
$(OBJDUMP) -S kernel > kernel.asm
$(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym

Expand All @@ -145,9 +147,26 @@ ULIB = ulib.o usys.o printf.o
LIBC = libc/libc.a
START = start.o

NEWLIBDIR = xv6-newlib
LUADIR = lua-xv6
GCCDIR = barebones-toolchain-i686-elf
NEWLIBFLAGS = --target=i686-elf-xv6 CC_FOR_TARGET=i686-elf-gcc AS_FOR_TARGET=i686-elf-as LD_FOR_TARGET=i686-elf-ld AR_FOR_TARGET=i686-elf-ar RANLIB_FOR_TARGET=i686-elf-ranlib
NEWLIBCS = $(NEWLIBDIR)/i686-elf-xv6/newlib/libc.a $(NEWLIBDIR)/i686-elf-xv6/newlib/libm.a $(NEWLIBDIR)/i686-elf-xv6/newlib/libg.a \
$(NEWLIBDIR)/i686-elf-xv6/newlib/crt0.o $(NEWLIBDIR)/i686-elf-xv6/libgloss/libnosys/libnosys.a $(NEWLIBDIR)/newlib/libc/include

$(LIBC):
$(MAKE) -C ./libc all


$(LUA): $(NEWLIBCS)
cd $(GCCDIR); . ./setenv.sh; cd ..; \
$(MAKE) -C $(LUADIR) all
cp $(LUADIR)/$(LUA) ./$(LUA)

$(NEWLIBCS):
cd $(GCCDIR); . ./setenv.sh; cd ..; \
cd $(NEWLIBDIR); ./configure $(NEWLIBFLAGS); cd ..; \
$(MAKE) -C $(NEWLIBDIR) all

_%: %.o $(ULIB) $(START) $(LIBC)
$(LD) $(LDFLAGS) $(LDUSER) -s -N -o $@ $^
$(OBJDUMP) -S $@ > $*.asm
Expand Down Expand Up @@ -185,8 +204,10 @@ UPROGS=\
_sagtest\
_pgswptest\
_shmtest\
_vmstat\
_find\
_bi\
_rename\
_vim\
_mv\
_touch\
Expand All @@ -207,8 +228,10 @@ UPROGS=\
_timetest\
_stdtests\

fs.img: mkfs README $(UPROGS)
./mkfs fs.img README $(UPROGS)
LUA_SCRIPTS=testmath.lua testos.lua testio.lua testtable.lua

fs.img: mkfs README $(UPROGS) $(LUA_SCRIPTS)
./mkfs fs.img README $(UPROGS) $(LUA_SCRIPTS)

-include *.d

Expand All @@ -217,8 +240,11 @@ clean:
*.o *.d *.asm *.sym vectors.S bootblock entryother \
initcode initcode.out kernel xv6.img fs.img kernelmemfs mkfs \
.gdbinit \
$(UPROGS)
$(UPROGS) $(LUA)
$(MAKE) -C ./libc clean
$(MAKE) -C $(LUADIR) clean
rm -rf $(NEWLIBDIR)/i686-elf-xv6
$(MAKE) -C $(NEWLIBDIR) distclean

# make a printout
FILES = $(shell grep -v '^\#' runoff.list)
Expand Down Expand Up @@ -277,7 +303,7 @@ EXTRA=\
mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
printf.c umalloc.c cowtest.c lalloctest.c npptest.c sagtest.c\
pgswptest.c shmtest.c\
pgswptest.c shmtest.c vmstat.c\
printf.c umalloc.c mv.c touch.c cp.c head.c tail.c splice.c\
history.c shutdown.c delete.c refresh.c showdeled.c\
README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
Expand Down
Loading

0 comments on commit 51d5e37

Please sign in to comment.