Changeset 189 for soft/giet_vm/Makefile
- Timestamp:
- Aug 7, 2012, 6:37:49 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r178 r189 5 5 DU=mipsel-unknown-elf-objdump 6 6 7 #current directory absolute path 8 SOFT_PATH = $(shell pwd)/ 7 SYS_OBJS = build/sys/vm_handler.o \ 8 build/sys/sys_handler.o \ 9 build/sys/giet.o \ 10 build/sys/switch.o \ 11 build/sys/common.o \ 12 build/sys/ctx_handler.o \ 13 build/sys/drivers.o \ 14 build/sys/exc_handler.o \ 15 build/sys/irq_handler.o \ 16 build/sys/kernel_init.o 9 17 10 SYS_DIR = sys 11 LIB_DIR = libs 12 BOOT_DIR = boot 18 BOOT_OBJS = build/boot/reset.o \ 19 build/boot/boot_init.o 13 20 14 BOOT_PATH = $(SOFT_PATH)$(BOOT_DIR) 15 SYS_PATH = $(SOFT_PATH)$(SYS_DIR) 16 LIB_PATH = $(SOFT_PATH)$(LIB_DIR) 17 XML_PATH = $(SOFT_PATH)xml/ 18 MEMO_PATH = $(SOFT_PATH)memo/ 19 BUILD_PATH = $(SOFT_PATH)build/ 20 ELF_PATH = $(SOFT_PATH)build/ 21 APP_PATH = $(SOFT_PATH)apps/ 21 DISPLAY_OBJS = build/display/main.o \ 22 build/libs/stdio.o \ 23 build/libs/utils.o 22 24 23 #list of all applications directory 24 APP_DIRS = $(shell ls -d $(APP_PATH)/*/ ) 25 ROUTER_OBJS = build/router/main.o \ 26 build/libs/mwmr_channel.o \ 27 build/libs/stdio.o \ 28 build/libs/utils.o 25 29 26 SYS_OBJS_LIST = \ 27 vm_handler.o \ 28 sys_handler.o \ 29 giet.o \ 30 switch.o \ 31 common.o \ 32 ctx_handler.o \ 33 drivers.o \ 34 exc_handler.o \ 35 irq_handler.o \ 36 kernel_init.o 30 HELLO_OBJS = build/hello/main.o \ 31 build/libs/stdio.o \ 32 build/libs/utils.o 37 33 38 BOOT_OBJS_LIST = reset.o \ 39 boot_handler.o 40 41 #LIB_SRCS = $(wildcard $(LIB_DIR)/*.c) 42 LIB_OBJS_LIST = stdio.o \ 43 mwmr_channel.o \ 44 barrier.o \ 45 spin_lock.o 46 47 LIB_OBJS = $(patsubst %,$(LIB_DIR)/%,$(LIB_OBJS_LIST)) 48 SYS_OBJS = $(patsubst %,$(SYS_DIR)/%,$(SYS_OBJS_LIST)) 49 BOOT_OBJS = $(patsubst %,$(BOOT_DIR)/%,$(BOOT_OBJS_LIST)) 50 34 PGCD_OBJS = build/pgcd/main.o \ 35 build/libs/stdio.o \ 36 build/libs/utils.o 51 37 52 38 CFLAGS=-Wall -ffreestanding -mno-gpopt -mips32 -g 53 39 54 SYS_INCLUDE = -I$(SYS_PATH) -I$(XML_PATH) -I$(LIB_PATH) -I. 55 BOOT_INCLUDE = -I$(BOOT_PATH) -I$(XML_PATH) -I$(LIB_PATH) -I. 56 LIB_INCLUDE = -I$(LIB_PATH) -I$(XML_PATH) -I. 57 APP_INCLUDE = -I$(LIB_PATH) -I$(XML_PATH) -I$(SOFT_PATH) 40 INCLUDE = -Iboot -Isys -Ixml -Ilibs -I. 58 41 59 42 TRASH= /dev/null||true 60 43 61 .PHONY: apps prepare 62 63 all: prepare soft.elf 44 all: soft.elf 64 45 65 ## merge all *.elf to soft.elf 66 soft.elf: boot.elf sys.elf map.bin apps 67 $(MAKE) -C $(MEMO_PATH) 68 $(MEMO_PATH)/memo.x map.bin 69 $(DU) -D $@ > $(BUILD_PATH)$@.txt 70 71 ## prepare the environement 72 prepare: 73 @mkdir $(BUILD_PATH) 2>$(TRASH) 74 @mkdir $(ELF_PATH) 2>$(TRASH) 75 @mkdir $(BUILD_PATH)/$(BOOT_DIR) 2>$(TRASH) 76 @mkdir $(BUILD_PATH)/$(LIB_DIR) 2>$(TRASH) 77 @mkdir $(BUILD_PATH)/$(SYS_DIR) 2>$(TRASH) 46 ## merge all *.elf and map.bin to soft.elf 47 soft.elf: build/boot/boot.elf \ 48 build/sys/sys.elf \ 49 build/display/display.elf \ 50 build/router/router.elf \ 51 build/pgcd/pgcd.elf \ 52 build/hello/hello.elf \ 53 map.bin 54 $(MAKE) -C memo 55 memo/memo.x map.bin 56 $(DU) -D $@ > build$@.txt 78 57 79 58 ### mapping compilation 80 59 map.bin: map.xml 81 $(MAKE) -C $(XML_PATH)82 $(XML_PATH)/xml2bin $(SOFT_PATH)map.xml $(SOFT_PATH)map.bin60 $(MAKE) -C xml 61 xml/xml2bin map.xml map.bin 83 62 84 63 ### system compilation 85 sys.elf: $(SYS_OBJS) $(SYS_PATH)/sys.ld86 (cd $(BUILD_PATH); $(LD) -o $@ -T $(SYS_PATH)/sys.ld $(SYS_OBJS))87 (cd $(BUILD_PATH); $(DU) -D $@ > $@.txt)64 build/sys/sys.elf: $(SYS_OBJS) sys/sys.ld 65 $(LD) -o $@ -T sys/sys.ld $(SYS_OBJS) 66 $(DU) -D $@ > $@.txt 88 67 89 $(SYS_DIR)/%.o: $(SYS_DIR)/%.c90 $(CC) $( SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $<68 build/sys/%.o: sys/%.c 69 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 91 70 92 $(SYS_DIR)/%.o: $(SYS_DIR)/%.s 93 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 94 95 $(SYS_DIR)/%.o: $(SYS_DIR)/%.S 96 $(CC) $(SYS_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 71 build/sys/%.o: sys/%.s 72 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 97 73 98 74 ### boot compilation 99 b oot.elf: $(BOOT_OBJS) $(BOOT_PATH)/boot.ld100 (cd $(BUILD_PATH); $(LD) -o $@ -T $(BOOT_PATH)/boot.ld $(BOOT_OBJS))101 (cd $(BUILD_PATH); $(DU) -D $@ > $@.txt)75 build/boot/boot.elf: $(BOOT_OBJS) boot/boot.ld 76 $(LD) -o $@ -T boot/boot.ld $(BOOT_OBJS) 77 $(DU) -D $@ > $@.txt 102 78 103 $(BOOT_DIR)/%.o: $(BOOT_DIR)/%.c104 $(CC) $( BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $<79 build/boot/%.o: boot/%.c 80 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 105 81 106 $(BOOT_DIR)/%.o: $(BOOT_DIR)/%.s 107 $(CC) $( BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $<82 build/boot/%.o: boot/%.S 83 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 108 84 109 $(BOOT_DIR)/%.o: $(BOOT_DIR)/%.S 110 $(CC) $(BOOT_INCLUDE) $(CFLAGS) -c -o $(BUILD_PATH)/$@ $< 85 ### display compilation 86 build/display/display.elf: $(DISPLAY_OBJS) display/display.ld 87 $(LD) -o $@ -T display/display.ld $(DISPLAY_OBJS) 88 $(DU) -D $@ > $@.txt 89 90 build/display/main.o: display/main.c 91 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 92 93 ### router compilation 94 build/router/router.elf: $(ROUTER_OBJS) router/router.ld 95 $(LD) -o $@ -T router/router.ld $(ROUTER_OBJS) 96 $(DU) -D $@ > $@.txt 97 98 build/router/main.o: router/main.c 99 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 100 101 ### hello compilation 102 build/hello/hello.elf: $(HELLO_OBJS) hello/hello.ld 103 $(LD) -o $@ -T hello/hello.ld $(HELLO_OBJS) 104 $(DU) -D $@ > $@.txt 105 106 build/hello/main.o: hello/main.c 107 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 108 109 ### pgcd compilation 110 build/pgcd/pgcd.elf: $(PGCD_OBJS) pgcd/pgcd.ld 111 $(LD) -o $@ -T pgcd/pgcd.ld $(PGCD_OBJS) 112 $(DU) -D $@ > $@.txt 113 114 build/pgcd/main.o: pgcd/main.c 115 $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< 111 116 112 117 ### libs compilation 113 $(LIB_DIR)/%.o: $(LIB_DIR)/%.c114 $(CC) $(CFLAGS) $( LIB_INCLUDE) -c -o $(BUILD_PATH)/$@ $<118 build/libs/utils.o: libs/utils.c 119 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 115 120 116 ### applications 117 apps: $(LIB_OBJS) 118 @echo "---------------------------------------------- BUILDING APPS ---------------------------------------------------------" 119 set -e; for d in $(APP_DIRS); do $(MAKE) -f config.mk -C $$d ; echo "Compiling $$d"; done 121 build/libs/stdio.o: libs/stdio.c 122 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 123 124 build/libs/mwmr_channel.o: libs/mwmr_channel.c 125 $(CC) $(CFLAGS) $(INCLUDE) -c -o $@ $< 126 120 127 121 128 ### clean 122 129 clean: 123 rm -f *.o *.elf *.bin *.txt core *~ 2>$(TRASH) 124 $(MAKE) -s clean -C $(XML_PATH) 2>$(TRASH) 125 $(MAKE) -s clean -C $(MEMO_PATH) 2>$(TRASH) 126 rm -r $(BUILD_PATH) 2>$(TRASH) 127 rm -r $(ELF_PATH) 2>$(TRASH) 128 set -e; for d in $(APP_DIRS); do $(MAKE) clean -f config.mk -C $$d ; done 130 rm -f *.o *.elf *.bin *.txt core *~ 2>$(TRASH) 131 $(MAKE) -s clean -C $(XML_PATH) 2>$(TRASH) 132 $(MAKE) -s clean -C $(MEMO_PATH) 2>$(TRASH) 133 rm -r build/boot/* 2>$(TRASH) 134 rm -r build/sys/* 2>$(TRASH) 135 rm -r build/libs/* 2>$(TRASH) 136 rm -r build/pgcd/* 2>$(TRASH) 137 rm -r build/hello/* 2>$(TRASH) 138 rm -r build/display/* 2>$(TRASH) 139 rm -r build/router/* 2>$(TRASH)
Note: See TracChangeset
for help on using the changeset viewer.