分类: LINUX
2008-06-15 22:37:22
50 all: do-it-all 51 52 ifeq (.config,$(wildcard .config)) #.config存在,进入 53 include .config 54 else 55 CONFIGURATION = config 56 do-it-all: config 57 endif 58 do-it-all: Version vivi |
117 vivi: include/version.h $(CONFIGURATION) init/main.o init/version.o linuxsubdirs 118 #LINKFLAGS = -Tarch/vivi.lds -Bstatic 119 #include arch/Makefile HEAD 120 #HEAD:=arch/$(MACHINE)/head.o 121 #CORE_FILES=init/main.o init/version.o lib/lib.o 122 #DRIVERS-y := 123 #DRIVERS-$(CONFIG_SERIAL) += drivers/serial/serial.o 124 #DRIVERS-$(CONFIG_MTD) += drivers/mtd/mtd.o 125 #DRIVERS := $(DRIVERS-y) 126 #LIBS := lib/priv_data/priv_data.o 127 #":="和"="的区别? 128 #.S-->.s-->.o-->elf 129 #.c-->.i-->.s-->.o-->elf 130 $(LD) -v $(LINKFLAGS) \ 131 $(HEAD) \ 132 $(CORE_FILES) \ 133 $(DRIVERS) \ 134 $(LIBS) \ 135 -o vivi-elf $(CLIBS) 136 $(NM) -v -l vivi-elf > vivi.map 137 $(OBJCOPY) -O binary -S vivi-elf vivi $(OBJCOPYFLAGS) |
191 include/version.h: 192 @echo \#define VIVI_RELEASE \"$(VIVIRELEASE)\" > .ver 193 @echo \#define VIVI_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver 194 @echo '#define VIVI_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver 195 @mv -f .ver $@ |
56 %.o: %.c 57 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $< 58 @ ( \ 59 echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:, $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \ 60 echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ 61 echo 'endif' \ 62 ) > $(dir $@)/.$(notdir $@).flags |