1 | CC=mipsel-unknown-elf-gcc |
---|
2 | AS=mipsel-unknown-elf-as |
---|
3 | LD=mipsel-unknown-elf-ld |
---|
4 | DU=mipsel-unknown-elf-objdump |
---|
5 | |
---|
6 | SYS_OBJS = reset.o \ |
---|
7 | boot_handler.o \ |
---|
8 | giet.o \ |
---|
9 | switch.o \ |
---|
10 | common.o \ |
---|
11 | ctx_handler.o \ |
---|
12 | drivers.o \ |
---|
13 | exc_handler.o \ |
---|
14 | irq_handler.o \ |
---|
15 | sys_handler.o |
---|
16 | |
---|
17 | PGCD_OBJS = pgcd_stdio.o \ |
---|
18 | pgcd_main.o |
---|
19 | |
---|
20 | HELLO_OBJS = hello_stdio.o \ |
---|
21 | hello_main.o |
---|
22 | |
---|
23 | FIFO_OBJS = fifo_stdio.o \ |
---|
24 | fifo_main.o \ |
---|
25 | fifo_mwmr.o |
---|
26 | |
---|
27 | ROUTER_OBJS = router_stdio.o \ |
---|
28 | router_main.o \ |
---|
29 | router_mwmr.o |
---|
30 | |
---|
31 | SYS_PATH = sys |
---|
32 | HELLO_PATH = hello |
---|
33 | FIFO_PATH = fifo |
---|
34 | PGCD_PATH = pgcd |
---|
35 | ROUTER_PATH = router |
---|
36 | MAP_PATH = xml |
---|
37 | LIBS_PATH = libs |
---|
38 | |
---|
39 | CFLAGS=-Wall -ffreestanding -mno-gpopt -mips32 |
---|
40 | |
---|
41 | SYS_INCLUDE = -I$(SYS_PATH) -I$(MAP_PATH) -I$(LIBS_PATH) -I. |
---|
42 | HELLO_INCLUDE= -I$(HELLO_PATH) -I$(LIBS_PATH) |
---|
43 | FIFO_INCLUDE= -I$(FIFO_PATH) -I$(LIBS_PATH) |
---|
44 | PGCD_INCLUDE= -I$(PGCD_PATH) -I$(LIBS_PATH) |
---|
45 | ROUTER_INCLUDE= -I$(ROUTER_PATH) -I$(LIBS_PATH) |
---|
46 | |
---|
47 | all: sys.bin hello.bin router.bin fifo.bin pgcd.bin map.bin |
---|
48 | |
---|
49 | ## mapping compilation |
---|
50 | |
---|
51 | map.bin: map.xml |
---|
52 | xml/xml2bin map.xml map.bin |
---|
53 | |
---|
54 | ## system compilation |
---|
55 | |
---|
56 | sys.bin: $(SYS_OBJS) $(SYS_PATH)/sys.ld |
---|
57 | $(LD) -o $@ -T $(SYS_PATH)/sys.ld $(SYS_OBJS) |
---|
58 | $(DU) -D $@ > $@.txt |
---|
59 | |
---|
60 | switch.o: $(SYS_PATH)/switch.s giet_config.h |
---|
61 | $(AS) -g -mips32 -o $@ $< |
---|
62 | |
---|
63 | giet.o: $(SYS_PATH)/giet.s giet_config.h |
---|
64 | $(AS) -g -mips32 -o $@ $< |
---|
65 | |
---|
66 | reset.o: $(SYS_PATH)/reset.S giet_config.h |
---|
67 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
68 | $(DU) -D $@ > $@.txt |
---|
69 | |
---|
70 | boot_handler.o: $(SYS_PATH)/boot_handler.c $(SYS_PATH)/boot_handler.h giet_config.h |
---|
71 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
72 | |
---|
73 | ctx_handler.o: $(SYS_PATH)/ctx_handler.c $(SYS_PATH)/ctx_handler.h giet_config.h |
---|
74 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
75 | |
---|
76 | exc_handler.o: $(SYS_PATH)/exc_handler.c $(SYS_PATH)/exc_handler.h giet_config.h |
---|
77 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
78 | |
---|
79 | irq_handler.o: $(SYS_PATH)/irq_handler.c $(SYS_PATH)/irq_handler.h giet_config.h |
---|
80 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
81 | |
---|
82 | sys_handler.o: $(SYS_PATH)/sys_handler.c $(SYS_PATH)/sys_handler.h giet_config.h |
---|
83 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
84 | |
---|
85 | drivers.o: $(SYS_PATH)/drivers.c $(SYS_PATH)/drivers.h giet_config.h |
---|
86 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
87 | |
---|
88 | common.o: $(SYS_PATH)/common.c $(SYS_PATH)/common.h giet_config.h |
---|
89 | $(CC) $(CFLAGS) $(SYS_INCLUDE) -c -o $@ $< |
---|
90 | |
---|
91 | ## application "hello" compilation |
---|
92 | |
---|
93 | hello.bin: $(HELLO_OBJS) $(HELLO_PATH)/hello.ld |
---|
94 | $(LD) -o $@ -T $(HELLO_PATH)/hello.ld $(HELLO_OBJS) |
---|
95 | $(DU) -D $@ > $@.txt |
---|
96 | |
---|
97 | hello_stdio.o: $(LIBS_PATH)/stdio.c $(LIBS_PATH)/stdio.h giet_config.h |
---|
98 | $(CC) $(CFLAGS) $(HELLO_INCLUDE) -c -o $@ $< |
---|
99 | |
---|
100 | hello_main.o: $(HELLO_PATH)/main.c giet_config.h |
---|
101 | $(CC) $(CFLAGS) $(HELLO_INCLUDE) -c -o $@ $< |
---|
102 | |
---|
103 | ## application "fifo" compilation |
---|
104 | |
---|
105 | fifo.bin: $(FIFO_OBJS) $(FIFO_PATH)/fifo.ld |
---|
106 | $(LD) -o $@ -T $(FIFO_PATH)/fifo.ld $(FIFO_OBJS) |
---|
107 | $(DU) -D $@ > $@.txt |
---|
108 | |
---|
109 | fifo_stdio.o: $(LIBS_PATH)/stdio.c $(LIBS_PATH)/stdio.h giet_config.h |
---|
110 | $(CC) $(CFLAGS) $(FIFO_INCLUDE) -c -o $@ $< |
---|
111 | |
---|
112 | fifo_mwmr.o: $(LIBS_PATH)/mwmr.c $(LIBS_PATH)/mwmr.h giet_config.h |
---|
113 | $(CC) $(CFLAGS) $(FIFO_INCLUDE) -c -o $@ $< |
---|
114 | |
---|
115 | fifo_main.o: $(FIFO_PATH)/main.c giet_config.h |
---|
116 | $(CC) $(CFLAGS) $(FIFO_INCLUDE) -c -o $@ $< |
---|
117 | |
---|
118 | ## application "router" compilation |
---|
119 | |
---|
120 | router.bin: $(ROUTER_OBJS) $(ROUTER_PATH)/router.ld |
---|
121 | $(LD) -o $@ -T $(ROUTER_PATH)/router.ld $(ROUTER_OBJS) |
---|
122 | $(DU) -D $@ > $@.txt |
---|
123 | |
---|
124 | router_stdio.o: $(LIBS_PATH)/stdio.c $(LIBS_PATH)/stdio.h giet_config.h |
---|
125 | $(CC) $(CFLAGS) $(ROUTER_INCLUDE) -c -o $@ $< |
---|
126 | |
---|
127 | router_mwmr.o: $(LIBS_PATH)/mwmr.c $(LIBS_PATH)/mwmr.h giet_config.h |
---|
128 | $(CC) $(CFLAGS) $(ROUTER_INCLUDE) -c -o $@ $< |
---|
129 | |
---|
130 | router_main.o: $(ROUTER_PATH)/main.c giet_config.h |
---|
131 | $(CC) $(CFLAGS) $(ROUTER_INCLUDE) -c -o $@ $< |
---|
132 | |
---|
133 | ## application "pgcd" compilation |
---|
134 | |
---|
135 | pgcd.bin: $(PGCD_OBJS) $(PGCD_PATH)/pgcd.ld |
---|
136 | $(LD) -o $@ -T $(PGCD_PATH)/pgcd.ld $(PGCD_OBJS) |
---|
137 | $(DU) -D $@ > $@.txt |
---|
138 | |
---|
139 | pgcd_stdio.o: $(LIBS_PATH)/stdio.c $(LIBS_PATH)/stdio.h giet_config.h |
---|
140 | $(CC) $(CFLAGS) $(PGCD_INCLUDE) -c -o $@ $< |
---|
141 | |
---|
142 | pgcd_main.o: $(PGCD_PATH)/main.c giet_config.h |
---|
143 | $(CC) $(CFLAGS) $(PGCD_INCLUDE) -c -o $@ $< |
---|
144 | |
---|
145 | ### special rules |
---|
146 | |
---|
147 | clean: |
---|
148 | rm -f *.o *.bin *.txt core *~ |
---|