⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnumakefile

📁 jos lab3代码
💻
字号:
## This makefile system follows the structuring conventions# recommended by Peter Miller in his excellent paper:##	Recursive Make Considered Harmful#	http://aegis.sourceforge.net/auug97.pdf#OBJDIR := objifdef LABSETTINGLAB := trueelse-include conf/lab.mkendif-include conf/env.mkifndef SOLSOL := 0endififndef LABADJUSTLABADJUST := 0endififndef LABSETUPLABSETUP := ./endifTOP = .# Cross-compiler jos toolchain## This Makefile will automatically use the cross-compiler toolchain# installed as 'i386-jos-elf-*', if one exists.  If the host tools ('gcc',# 'objdump', and so forth) compile for a 32-bit x86 ELF target, that will# be detected as well.  If you have the right compiler toolchain installed# using a different name, set GCCPREFIX explicitly in conf/env.mk# try to infer the correct GCCPREFIXifndef GCCPREFIXGCCPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \	then echo 'i386-jos-elf-'; \	elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \	then echo ''; \	else echo "***" 1>&2; \	echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \	echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \	echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \	echo "*** prefix other than 'i386-jos-elf-', set your GCCPREFIX" 1>&2; \	echo "*** environment variable to that prefix and run 'make' again." 1>&2; \	echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \	echo "***" 1>&2; exit 1; fi)endifCC	:= $(GCCPREFIX)gcc -pipeAS	:= $(GCCPREFIX)asAR	:= $(GCCPREFIX)arLD	:= $(GCCPREFIX)ldOBJCOPY	:= $(GCCPREFIX)objcopyOBJDUMP	:= $(GCCPREFIX)objdumpNM	:= $(GCCPREFIX)nm# Native commandsNCC	:= gcc $(CC_VER) -pipeTAR	:= gtarPERL	:= perl# Compiler flags# -fno-builtin is required to avoid refs to undefined functions in the kernel.# Only optimize to -O1 to discourage inlining, which complicates backtraces.CFLAGS := $(CFLAGS) $(DEFS) $(LABDEFS) -O1 -fno-builtin -I$(TOP) -MD CFLAGS += -Wall -Wno-format -Wno-unused -Werror -gstabs -m32# Add -fno-stack-protector if the option exists.CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)# Common linker flagsLDFLAGS := -m elf_i386# Linker flags for JOS user programsULDFLAGS := -T user/user.ldGCC_LIB := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)# Lists that the */Makefrag makefile fragments will add toOBJDIRS :=# Make sure that 'all' is the first targetall:# Eliminate default suffix rules.SUFFIXES:# Delete target files if there is an error (or make is interrupted).DELETE_ON_ERROR:# make it so that no intermediate .o files are ever deleted.PRECIOUS: %.o $(OBJDIR)/boot/%.o $(OBJDIR)/kern/%.o \	$(OBJDIR)/lib/%.o $(OBJDIR)/fs/%.o $(OBJDIR)/user/%.oKERN_CFLAGS := $(CFLAGS) -DJOS_KERNEL -gstabsUSER_CFLAGS := $(CFLAGS) -DJOS_USER -gstabs# Include Makefrags for subdirectoriesinclude boot/Makefraginclude kern/Makefraginclude lib/Makefraginclude user/MakefragIMAGES = $(OBJDIR)/kern/bochs.imgbochs: $(IMAGES)	bochs 'display_library: nogui'# For deleting the buildclean:	rm -rf $(OBJDIR)realclean: clean	rm -rf lab$(LAB).tar.gz bochs.out bochs.logdistclean: realclean	rm -rf conf/gcc.mkgrade: $(LABSETUP)grade.sh	$(V)$(MAKE) clean >/dev/null 2>/dev/null	$(MAKE) all	sh $(LABSETUP)grade.shhandin: tarball	@echo Please visit http://pdos.csail.mit.edu/cgi-bin/828handin	@echo and upload lab$(LAB)-handin.tar.gz.  Thanks!tarball: realclean	tar cf - `find . -type f | grep -v '^\.*$$' | grep -v '/CVS/' | grep -v '/\.svn/' | grep -v 'lab[0-9].*\.tar\.gz'` | gzip > lab$(LAB)-handin.tar.gz# For test runsrun-%:	$(V)rm -f $(OBJDIR)/kern/init.o $(IMAGES)	$(V)$(MAKE) "DEFS=-DTEST=_binary_obj_user_$*_start -DTESTSIZE=_binary_obj_user_$*_size" $(IMAGES)	bochs -q 'display_library: nogui'xrun-%:	$(V)rm -f $(OBJDIR)/kern/init.o $(IMAGES)	$(V)$(MAKE) "DEFS=-DTEST=_binary_obj_user_$*_start -DTESTSIZE=_binary_obj_user_$*_size" $(IMAGES)	bochs -q# This magic automatically generates makefile dependencies# for header files included from C source files we compile,# and keeps those dependencies up-to-date every time we recompile.# See 'mergedep.pl' for more information.$(OBJDIR)/.deps: $(foreach dir, $(OBJDIRS), $(wildcard $(OBJDIR)/$(dir)/*.d))	@mkdir -p $(@D)	@$(PERL) mergedep.pl $@ $^-include $(OBJDIR)/.depsalways:	@:.PHONY: all always \	handin tarball clean realclean clean-labsetup distclean grade labsetup

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -