source: soft/giet_vm/Makefile @ 160

Last change on this file since 160 was 160, checked in by karaoui, 12 years ago

giet-vm new version

File size: 3.4 KB
Line 
1CC=mipsel-unknown-elf-gcc
2AS=mipsel-unknown-elf-as
3LD=mipsel-unknown-elf-ld
4DU=mipsel-unknown-elf-objdump
5
6SYS_OBJS = giet.o \
7                switch.o \
8                common.o \
9                ctx_handler.o \
10                drivers.o \
11                exc_handler.o \
12                irq_handler.o \
13                sys_handler.o \
14                init.o          \
15                task_init.o
16
17BOOT_OBJS = reset.o \
18                boot_handler.o
19
20SYS_PATH    = sys
21BOOT_PATH   = boot
22MAP_PATH    = xml
23LIBS_PATH   = libs
24BUILD_DIR_NAME  = build
25
26CFLAGS=-Wall -ffreestanding -mno-gpopt -mips32 -g
27
28SYS_INCLUDE = -I$(SYS_PATH) -I$(MAP_PATH) -I$(LIBS_PATH) -I.
29
30BOOT_INCLUDE = -I$(BOOT_PATH) -I$(MAP_PATH) -I$(LIBS_PATH) -I.
31
32#commons between sys and boot are: common.ld , mips_registers.h...
33
34TRASH= /dev/null||true
35
36.PHONY: apps prepare
37
38all: prepare soft.bin
39       
40
41## merge all *.bin to soft.bin
42soft.bin: boot.bin sys.bin map.bin apps
43        make -C mover
44        mover/mover.x -sm map.bin
45        $(DU) -D $@ > $@.txt
46
47## prepare the environement
48prepare:
49        @mkdir $(BUILD_DIR_NAME) 2>$(TRASH)
50
51## mapping compilation
52map.bin: map.xml
53        make -C xml                             #compile the parser
54        xml/xml2bin map.xml map.bin
55
56## system compilation
57sys.bin: $(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)
60
61switch.o: $(SYS_PATH)/switch.s giet_config.h
62        $(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $<
63
64giet.o: $(SYS_PATH)/giet.s giet_config.h
65        $(AS) -g -mips32 -o $(BUILD_DIR_NAME)/$@ $<
66
67task_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
72ctx_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
75exc_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
78irq_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
81sys_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
84drivers.o: $(SYS_PATH)/drivers.c $(SYS_PATH)/drivers.h giet_config.h
85        $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $<
86
87common.o: $(SYS_PATH)/common.c $(SYS_PATH)/common.h giet_config.h
88        $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $<
89
90init.o: $(SYS_PATH)/init.c giet_config.h
91        $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $(BUILD_DIR_NAME)/$@ $<
92
93## boot compilation
94boot.bin: $(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)
97
98reset.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)/$@.txt
101
102boot_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)/$@ $<
104
105## applications and libs compilation
106apps:
107        @echo "---------------------------------------------BUILDING APPS------------------------------------------------------"
108        make -C apps
109
110### special rules
111clean:
112        rm -f *.o *.bin *.txt core *~  2>$(TRASH)
113        make clean -C xml/ 2>$(TRASH)
114        make clean -C mover/ 2>$(TRASH)
115        make clean -C apps 2>$(TRASH)
116        rm -r $(BUILD_DIR_NAME) 2>$(TRASH)
Note: See TracBrowser for help on using the repository browser.