#执行make distclean时要删除的文件 DISTCLEAN_FILES = \ include/autoconf.h include/version.h \ scripts/lxdialog/*.o scripts/lxdialog/lxdialog \ .menuconfig.log \ .config .config.old TAGS tags
include arch/Makefile
export CPPFLAGS CFLAGS AFLAGS
export DRIVERS LDFLAGS
#执行make Version时要删除的文件 Version: dummy @rm -f include/compile.h
#执行make vivi时要执行的动作 vivi: include/version.h $(CONFIGURATION) init/main.o init/version.o linuxsubdirs $(LD) -v $(LINKFLAGS) \ $(HEAD) \ $(CORE_FILES) \ $(DRIVERS) \ $(LIBS) \ -o vivi-elf $(CLIBS) $(NM) -v -l vivi-elf > vivi.map $(OBJCOPY) -O binary -S vivi-elf vivi $(OBJCOPYFLAGS)
#执行make oldconfig时要执行的动作 oldconfig: $(CONFIG_SHELL) scripts/Configure -d arch/config.in
#执行make config时要执行的动作 config: $(CONFIG_SHELL) scripts/Configure arch/config.in
#执行make menuconfig时要执行的动作 menuconfig: include/version.h $(MAKE) -C scripts/lxdialog all $(CONFIG_SHELL) scripts/Menuconfig arch/config.in
#执行make clean时要执行的动作 clean: find . \( -name '*.o' -o -name core -o -name ".*.flags" \) -type f -print \ | grep -v lxdialog/ | xargs rm -f rm -f $(CLEAN_FILES)
#执行distclean时要执行的动作 distclean: clean rm -f $(DISTCLEAN_FILES)
linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
$(patsubst %, _dir_%, $(SUBDIRS)) : include/version.h $(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C $(patsubst _dir_%, %, $@)
$(TOPDIR)/include/version.h: include/version.h $(TOPDIR)/include/compile.h: include/compile.h
include/compile.h: $(CONFIGURATION) include/version.h @echo -n \#define UTS_VERSION \"\#$(VIVIRELEASE) > .ver @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi @echo ' '`date`'"' >> .ver @echo \#define VIVI_COMPILE_TIME \"`date +%T`\" >> .ver @echo \#define VIVI_COMPILE_BY \"`whoami`\" >> .ver @echo \#define VIVI_COMPILE_HOST \"`hostname`\" >> .ver @if [ -x /bin/dnsdomainname ]; then \ echo \#define VIVI_COMPILE_DOMAIN \"`dnsdomainname`\"; \ elif [ -x /bin/domainname ]; then \ echo \#define VIVI_COMPILE_DOMAIN \"`domainname`\"; \ else \ echo \#define VIVI_COMPILE_DOMAIN ; \ fi >> .ver @echo \#define VIVI_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver @mv -f .ver $@
#产生include/version.h文件,其内容就是echo显示的三句话,可以看vivi源码目录include/version.h include/version.h: @echo \#define VIVI_RELEASE \"$(VIVIRELEASE)\" > .ver @echo \#define VIVI_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver @echo '#define VIVI_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver @mv -f .ver $@
#产生两个.o文件. init/version.o: init/version.c include/compile.h $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
init/main.o: init/main.c $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
TAGS: dummy etags `find include -name '*.h'` find $(SUBDIRS) init -name '*.[ch]' | xargs etags -a
# Exuberant ctags works better with -I tags: dummy CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ ctags $$CTAGSF `find include -name '*.h'` && \ find $(SUBDIRS) init -name '*.[ch]' | xargs ctags $$CTAGSF -a
%: ./arch/def-configs/% $(MAKE) distclean cp arch/def-configs/$* ./.config -f $(MAKE) oldconfig $(MAKE)
ifdef CONFIGURATION ..$(CONFIGURATION): @echo @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'" @echo $(MAKE) $(CONFIGURATION) @echo @echo "Successful. Try re-making (ignore the error that follows)" @echo exit 1
dummy:
else
dummy:
endif
include Rules.make
|