Changeset 162 for soft/giet_vm/Makefile
- Timestamp:
- Jun 20, 2012, 5:11:11 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r161 r162 1 export # export all variable to sub-Makefile 1 2 CC=mipsel-unknown-elf-gcc 2 3 AS=mipsel-unknown-elf-as … … 4 5 DU=mipsel-unknown-elf-objdump 5 6 6 SYS_OBJS = giet.o \ 7 8 #current directory absolute path 9 SOFT_PATH = $(shell pwd)/ 10 11 SYS_NAME = sys 12 BOOT_NAME = boot 13 LIB_NAME = libs 14 15 SYS_PATH = $(SOFT_PATH)$(SYS_NAME) 16 BOOT_PATH = $(SOFT_PATH)$(BOOT_NAME) 17 LIB_PATH = $(SOFT_PATH)$(LIB_NAME) 18 MAP_PATH = $(SOFT_PATH)xml/ 19 BUILD_PATH = $(SOFT_PATH)build/ 20 ELF_PATH = $(SOFT_PATH)build/ 21 22 #list of all applications directory 23 APP_DIRS = $(shell ls -d apps/*/ ) 24 25 SYS_OBJS_LIST = \ 26 sys_handler.o \ 27 init.o \ 28 giet.o \ 7 29 switch.o \ 8 30 common.o \ … … 11 33 exc_handler.o \ 12 34 irq_handler.o \ 13 sys_handler.o \14 init.o \15 35 task_init.o 16 36 17 BOOT_OBJS = reset.o \18 boot_handler.o37 BOOT_OBJS_LIST = reset.o \ 38 boot_handler.o 19 39 20 SYS_PATH = sys 21 BOOT_PATH = boot 22 MAP_PATH = xml 23 LIBS_PATH = libs 24 BUILD_DIR_NAME = build 40 #LIB_SRCS = $(wildcard $(LIB_NAME)/*.c) 41 LIB_OBJS_LIST = stdio.o\ 42 mwmr.o\ 43 common.o 44 45 LIB_OBJS = $(patsubst %,$(LIB_NAME)/%,$(LIB_OBJS_LIST)) 46 SYS_OBJS = $(patsubst %,$(SYS_NAME)/%,$(SYS_OBJS_LIST)) 47 BOOT_OBJS = $(patsubst %,$(BOOT_NAME)/%,$(BOOT_OBJS_LIST)) 48 25 49 26 50 CFLAGS=-Wall -ffreestanding -mno-gpopt -mips32 -g 27 51 28 SYS_INCLUDE = -I$(SYS_PATH) -I$(MAP_PATH) -I$(LIB S_PATH) -I.52 SYS_INCLUDE = -I$(SYS_PATH) -I$(MAP_PATH) -I$(LIB_PATH) -I. 29 53 30 BOOT_INCLUDE = -I$(BOOT_PATH) -I$(MAP_PATH) -I$(LIB S_PATH) -I.54 BOOT_INCLUDE = -I$(BOOT_PATH) -I$(MAP_PATH) -I$(LIB_PATH) -I. 31 55 32 #commons between sys and boot are: common.ld , mips_registers.h... 56 INCLUDE = -I$(LIB_PATH) -I$(SOFT_PATH) -I$(SYS_PATH) -I$(MAP_PATH) 33 57 34 58 TRASH= /dev/null||true … … 38 62 all: prepare soft.elf 39 63 40 41 64 ## merge all *.elf to soft.elf 42 65 soft.elf: boot.elf sys.elf map.bin apps 43 make-C mover44 mover/mover.x -smmap.bin45 $(DU) -D $@ > $ @.txt66 $(MAKE) -C mover 67 mover/mover.x map.bin 68 $(DU) -D $@ > $(BUILD_PATH)$@.txt 46 69 47 70 ## prepare the environement 48 71 prepare: 49 @mkdir $(BUILD_DIR_NAME) 2>$(TRASH) 72 @mkdir $(BUILD_PATH) 2>$(TRASH) 73 @mkdir $(ELF_PATH) 2>$(TRASH) 50 74 75 ## compile the parser 51 76 ## mapping compilation 52 77 map.bin: map.xml 53 make -C xml #compile the parser78 $(MAKE) -C xml 54 79 xml/xml2bin map.xml map.bin 55 80 56 81 ## system compilation 57 82 sys.elf: $(SYS_OBJS) $(SYS_PATH)/sys.ld 58 (cd $(BUILD_ DIR_NAME); $(LD) -o $@ -T ../$(SYS_PATH)/sys.ld $(SYS_OBJS) )59 (cd $(BUILD_ DIR_NAME); $(DU) -D $@ > $@.txt)83 (cd $(BUILD_PATH); $(LD) -o $@ -T $(SYS_PATH)/sys.ld $(SYS_OBJS) ) 84 (cd $(BUILD_PATH); $(DU) -D $@ > $@.txt) 60 85 61 switch.o: $(SYS_PATH)/switch.s giet_config.h 62 $(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $< 86 $(SYS_NAME)/%.o: $(SYS_NAME)/%.c 87 @mkdir $(BUILD_PATH)/$(SYS_NAME) 2>$(TRASH) 88 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 63 89 64 giet.o: $(SYS_PATH)/giet.s giet_config.h 65 $(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $< 90 $(SYS_NAME)/%.o: $(SYS_NAME)/%.s 91 @mkdir $(BUILD_PATH)/$(SYS_NAME) 2>$(TRASH) 92 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 66 93 67 task_init.o: $(SYS_PATH)/task_init.S giet_config.h 68 #$(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $< 69 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 70 $(DU) -D $(BUILD_DIR_NAME)/$@ > $(BUILD_DIR_NAME)/$@.txt 71 72 ctx_handler.o: $(SYS_PATH)/ctx_handler.c $(SYS_PATH)/ctx_handler.h giet_config.h 73 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 74 75 exc_handler.o: $(SYS_PATH)/exc_handler.c $(SYS_PATH)/exc_handler.h giet_config.h 76 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 77 78 irq_handler.o: $(SYS_PATH)/irq_handler.c $(SYS_PATH)/irq_handler.h giet_config.h 79 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 80 81 sys_handler.o: $(SYS_PATH)/sys_handler.c $(SYS_PATH)/sys_handler.h giet_config.h 82 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 83 84 drivers.o: $(SYS_PATH)/drivers.c $(SYS_PATH)/drivers.h giet_config.h 85 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 86 87 common.o: $(SYS_PATH)/common.c $(SYS_PATH)/common.h giet_config.h 88 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 89 90 init.o: $(SYS_PATH)/init.c giet_config.h 91 $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 94 $(SYS_NAME)/%.o: $(SYS_NAME)/%.S 95 @mkdir $(BUILD_PATH)/$(SYS_NAME) 2>$(TRASH) 96 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 92 97 93 98 ## boot compilation 94 99 boot.elf: $(BOOT_OBJS) $(BOOT_PATH)/boot.ld 95 (cd $(BUILD_ DIR_NAME); $(LD) -o $@ -T ../$(BOOT_PATH)/boot.ld $(BOOT_OBJS) )96 (cd $(BUILD_ DIR_NAME); $(DU) -D $@ > $@.txt)100 (cd $(BUILD_PATH); $(LD) -o $@ -T $(BOOT_PATH)/boot.ld $(BOOT_OBJS) ) 101 (cd $(BUILD_PATH); $(DU) -D $@ > $@.txt) 97 102 98 reset.o: $(BOOT_PATH)/reset.S giet_config.h 99 $(CC) $(CFLAGS) $(BOOT_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $<100 $( DU) -D $(BUILD_DIR_NAME)/$@ > $(BUILD_DIR_NAME)/$@.txt103 $(BOOT_NAME)/%.o: $(BOOT_NAME)/%.c 104 @mkdir $(BUILD_PATH)/$(BOOT_NAME) 2>$(TRASH) 105 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 101 106 102 boot_handler.o: $(BOOT_PATH)/boot_handler.c $(BOOT_PATH)/boot_handler.h giet_config.h 103 $(CC) $(CFLAGS) $(BOOT_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $< 107 $(BOOT_NAME)/%.o: $(BOOT_NAME)/%.s 108 @mkdir $(BUILD_PATH)/$(BOOT_NAME) 2>$(TRASH) 109 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 104 110 105 ## applications and libs compilation 106 apps: 111 $(BOOT_NAME)/%.o: $(BOOT_NAME)/%.S 112 @mkdir $(BUILD_PATH)/$(BOOT_NAME) 2>$(TRASH) 113 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 114 115 ##libs compilation 116 $(LIB_NAME)/%.o: $(LIB_NAME)/%.c 117 @mkdir $(BUILD_PATH)/$(LIB_NAME) 2>$(TRASH) 118 $(CC) $(CFLAGS) $(INCLUDE) -c -o $(BUILD_PATH)/$@ $< 119 120 ## applications 121 apps: $(LIB_OBJS) 107 122 @echo "---------------------------------------------BUILDING APPS------------------------------------------------------" 108 make -C apps123 set -e; for d in $(APP_DIRS); do $(MAKE) -C $$d ; echo "Compiling $$d"; done 109 124 110 125 ### special rules 111 126 clean: 112 127 rm -f *.o *.elf *.bin *.txt core *~ 2>$(TRASH) 113 makeclean -C xml/ 2>$(TRASH)114 makeclean -C mover/ 2>$(TRASH)115 make clean -C apps2>$(TRASH)116 rm -r $(BUILD_DIR_NAME) 2>$(TRASH)128 $(MAKE) clean -C xml/ 2>$(TRASH) 129 $(MAKE) clean -C mover/ 2>$(TRASH) 130 rm -r $(BUILD_PATH) 2>$(TRASH) 131 set -e; for d in $(APP_DIRS); do $(MAKE) clean -C $$d ; done
Note: See TracChangeset
for help on using the changeset viewer.