source: soft/giet_vm/Makefile @ 281

Last change on this file since 281 was 272, checked in by cfuguet, 10 years ago
  • Adding the stdlib.o object among the dhrystone application objects
File size: 13.0 KB
Line 
1export # export all variable to sub-Makefile
2CC = mipsel-unknown-elf-gcc
3AS = mipsel-unknown-elf-as
4LD = mipsel-unknown-elf-ld
5DU = mipsel-unknown-elf-objdump
6
7### FAT parameters definition for Disk image
8### sector_size          = 512
9### partition_begin_lba  = 300
10### sector_per_cluster   = 8
11### partition sectors    = 524832
12
13MAP_XML      = mappings/4c_1p_iob_four.xml
14
15### Objects to be linked for kernel.elf
16KERNEL_OBJS  = build/common/utils.o        \
17               build/common/vmem.o          \
18               build/fat32/fat32.o        \
19               build/drivers/dma_driver.o \
20               build/drivers/fbf_driver.o \
21               build/drivers/xcu_driver.o \
22               build/drivers/icu_driver.o \
23               build/drivers/ioc_driver.o \
24               build/drivers/iob_driver.o \
25               build/drivers/mmc_driver.o \
26               build/drivers/mwr_driver.o \
27               build/drivers/nic_driver.o \
28               build/drivers/tim_driver.o \
29               build/drivers/tty_driver.o \
30               build/kernel/giet.o        \
31               build/kernel/switch.o      \
32               build/kernel/ctx_handler.o \
33               build/kernel/exc_handler.o \
34               build/kernel/sys_handler.o \
35               build/kernel/irq_handler.o \
36               build/kernel/kernel_init.o
37
38### Objects to be linked for boot.elf
39BOOT_OBJS    = build/common/utils.o        \
40               build/common/vmem.o          \
41               build/fat32/fat32.o        \
42               build/drivers/tty_driver.o \
43               build/drivers/xcu_driver.o \
44               build/drivers/dma_driver.o \
45               build/drivers/mwr_driver.o \
46               build/drivers/ioc_driver.o \
47               build/drivers/nic_driver.o \
48               build/drivers/mmc_driver.o \
49               build/kernel/ctx_handler.o \
50               build/kernel/switch.o      \
51               build/boot/boot.o
52
53### Objects to be linked for display.elf
54DISPLAY_OBJS = build/display/main.o \
55               build/libs/stdio.o
56
57### Objects to be linked for router.elf
58ROUTER_OBJS  = build/router/main.o        \
59               build/libs/mwmr_channel.o  \
60               build/libs/stdio.o
61
62### Objects to be linked for hello.elf
63HELLO_OBJS   = build/hello/main.o   \
64               build/libs/stdio.o         
65
66### Objects to be linked for pgcd.elf
67PGCD_OBJS    = build/pgcd/main.o          \
68               build/libs/stdio.o
69
70### Objects to be linked for game.elf
71GAMEOFLIFE_OBJS = build/gameoflife/main.o \
72                  build/libs/stdio.o      \
73                  build/libs/barrier.o
74
75### Objects to be linked for dhrystone.elf
76DHRYSTONE_OBJS = build/dhrystone/dhry_1.o \
77                 build/dhrystone/dhry_2.o \
78                 build/libs/stdlib.o      \
79                 build/libs/stdio.o       \
80                 build/libs/string.o      \
81                 build/libs/spin_lock.o   \
82                 build/libs/malloc.o
83
84### Objects to be linked for sort.elf
85SORT_OBJS   = build/sort/main.o        \
86              build/libs/stdio.o       \
87              build/libs/spin_lock.o   \
88              build/libs/barrier.o
89
90
91CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32
92
93GIET_INCLUDE = -Igiet_boot    \
94               -Igiet_kernel  \
95               -Igiet_xml     \
96               -Igiet_fat32   \
97               -Igiet_drivers \
98               -Igiet_common  \
99               -Igiet_libs    \
100               -I.
101
102USER_INCLUDE = -Igiet_libs    \
103               -Igiet_xml     \
104               -I.
105
106all: map.bin                         \
107     build/boot/boot.elf             \
108     build/kernel/kernel.elf         \
109     build/display/display.elf       \
110     build/router/router.elf         \
111     build/hello/hello.elf           \
112     build/pgcd/pgcd.elf             \
113     build/dhrystone/dhrystone.elf   \
114     build/gameoflife/gameoflife.elf \
115     build/sort/sort.elf             \
116     hdd/virt_hdd.dmg
117
118### Disk image generation
119### This requires the generic LINUX/MacOS script "create_dmg" script
120### written by C.Fuguet. (should be installed in GIET-VM root directory).
121hdd/virt_hdd.dmg: map.bin                   \
122         build/boot/boot.elf            \
123         build/kernel/kernel.elf        \
124         build/display/display.elf      \
125         build/hello/hello.elf          \
126         build/pgcd/pgcd.elf            \
127         build/router/router.elf        \
128         build/dhrystone/dhrystone.elf  \
129         build/gameoflife/gameoflife.elf
130### remove all content of virtual disk virt_hdd
131        rm -rf hdd/virt_hdd/*
132### copy content to virtual disk from build, misc and map.bin
133### the boot.elf file is not copied on the virtual disk
134        cp -r build hdd/virt_hdd
135        rm -rf hdd/virt_hdd/build/boot
136        cp -r hdd/misc hdd/virt_hdd
137        cp map.bin  hdd/virt_hdd
138### create temporary partition image (partition_image.dmg)
139        ./create_dmg create hdd/virt_hdd partition_image
140### copy standard MBR into virtual disk image (mbr.dmg)
141        cp hdd/mbr.dmg $@ 
142### copy boot.elf into virtual disk image (sector 2)
143        dd if=build/boot/boot.elf of=$@ seek=2
144### copy partition image into virtual disk image (sector 300)
145        dd if=partition_image.dmg of=$@ seek=300 
146### remove partition image
147        rm partition_image.dmg
148
149### mapping compilation
150map.bin: $(MAP_XML)
151        $(MAKE) -C giet_xml
152        giet_xml/xml2bin $< .
153
154### drivers compilation
155build/drivers/dma_driver.o: giet_drivers/dma_driver.c  \
156                            giet_drivers/dma_driver.h  \
157                            giet_config.h              \
158                            $(MAP_XML)
159        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
160
161build/drivers/fbf_driver.o: giet_drivers/fbf_driver.c  \
162                            giet_drivers/fbf_driver.h  \
163                            giet_config.h              \
164                            $(MAP_XML)
165        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
166
167build/drivers/xcu_driver.o: giet_drivers/xcu_driver.c  \
168                            giet_drivers/xcu_driver.h  \
169                            giet_config.h              \
170                            $(MAP_XML)
171        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
172
173build/drivers/icu_driver.o: giet_drivers/icu_driver.c  \
174                            giet_drivers/icu_driver.h  \
175                            giet_config.h              \
176                            $(MAP_XML)
177        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
178
179build/drivers/ioc_driver.o: giet_drivers/ioc_driver.c  \
180                            giet_drivers/ioc_driver.h  \
181                            giet_config.h              \
182                            $(MAP_XML)
183        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
184
185build/drivers/iob_driver.o: giet_drivers/iob_driver.c  \
186                            giet_drivers/iob_driver.h  \
187                            giet_config.h              \
188                            $(MAP_XML)
189        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
190
191build/drivers/mmc_driver.o: giet_drivers/mmc_driver.c  \
192                            giet_drivers/mmc_driver.h  \
193                            giet_config.h              \
194                            $(MAP_XML)
195        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
196
197build/drivers/mwr_driver.o: giet_drivers/mwr_driver.c  \
198                            giet_drivers/mwr_driver.h  \
199                            giet_config.h              \
200                            $(MAP_XML)
201        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
202
203build/drivers/nic_driver.o: giet_drivers/nic_driver.c  \
204                            giet_drivers/nic_driver.h  \
205                            giet_config.h              \
206                            $(MAP_XML)
207        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
208
209build/drivers/tim_driver.o: giet_drivers/tim_driver.c  \
210                            giet_drivers/tim_driver.h  \
211                            giet_config.h              \
212                            $(MAP_XML)
213        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
214
215build/drivers/tty_driver.o: giet_drivers/tty_driver.c  \
216                            giet_drivers/tty_driver.h  \
217                            giet_config.h              \
218                            $(MAP_XML)
219        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
220
221### fat32 compilation
222build/fat32/fat32.o: giet_fat32/fat32.c \
223                     giet_fat32/fat32.h \
224                     giet_config.h      \
225                     $(MAP_XML)
226        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
227
228### utils compilation
229build/common/utils.o: giet_common/utils.c \
230                      giet_common/utils.h \
231                      giet_config.h       \
232                      $(MAP_XML)
233        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
234
235### vmem compilation
236build/common/vmem.o: giet_common/vmem.c \
237                     giet_common/vmem.h \
238                     giet_config.h    \
239                     $(MAP_XML)
240        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
241
242### boot compilation
243build/boot/boot.elf: $(BOOT_OBJS) 
244        $(LD) -o $@ -T giet_boot/boot.ld $(BOOT_OBJS) 
245        $(DU) -D $@ > $@.txt
246
247build/boot/boot.o: giet_boot/boot.c          \
248                   giet_common/utils.h       \
249                   giet_fat32/fat32.h        \
250                   giet_common/vmem.h          \
251                   giet_drivers/tty_driver.h \
252                   giet_drivers/ioc_driver.h \
253                   giet_config.h             \
254                   $(MAP_XML)
255        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
256
257### kernel compilation
258build/kernel/kernel.elf: $(KERNEL_OBJS) giet_kernel/kernel.ld
259        $(LD) -o $@ -T giet_kernel/kernel.ld $(KERNEL_OBJS)
260        $(DU) -D $@ > $@.txt
261
262build/kernel/%.o: giet_kernel/%.c giet_config.h $(MAP_XML)
263        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
264
265build/kernel/%.o: giet_kernel/%.s giet_config.h $(MAP_XML)
266        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
267
268
269
270
271### libs compilation
272build/libs/stdio.o: giet_libs/stdio.c \
273                    giet_libs/stdio.h \
274                    giet_config.h 
275        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
276
277build/libs/mwmr_channel.o: giet_libs/mwmr_channel.c \
278                           giet_libs/mwmr_channel.h \
279                           giet_config.h
280        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
281
282build/libs/malloc.o: giet_libs/malloc.c         \
283                     giet_libs/malloc.h         \
284                     giet_libs/malloc_private.h \
285                     giet_config.h
286        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
287
288build/libs/barrier.o: giet_libs/barrier.c \
289                      giet_libs/barrier.h \
290                      giet_config.h
291        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
292
293build/libs/stdlib.o: giet_libs/stdlib.c \
294                     giet_libs/stdlib.h \
295                     giet_config.h
296        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
297
298build/libs/string.o: giet_libs/string.c \
299                     giet_libs/string.h \
300                     giet_config.h
301        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
302
303build/libs/spin_lock.o: giet_libs/spin_lock.c \
304                        giet_libs/spin_lock.h \
305                        giet_config.h
306        $(CC) $(CFLAGS) $(USER_INCLUDE) -c -o $@ $<
307
308
309
310
311### display compilation
312build/display/display.elf: $(DISPLAY_OBJS) display/display.ld
313        $(LD) -o $@ -T display/display.ld $(DISPLAY_OBJS)
314        $(DU) -D $@ > $@.txt
315
316build/display/main.o: display/main_cma.c
317        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
318
319### router compilation
320build/router/router.elf: $(ROUTER_OBJS) router/router.ld
321        $(LD) -o $@ -T router/router.ld $(ROUTER_OBJS)
322        $(DU) -D $@ > $@.txt
323
324build/router/main.o: router/main.c
325        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
326
327### hello compilation
328build/hello/hello.elf: $(HELLO_OBJS) hello/hello.ld
329        $(LD) -o $@ -T hello/hello.ld $(HELLO_OBJS)
330        $(DU) -D $@ > $@.txt
331
332build/hello/main.o: hello/main.c
333        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
334
335### pgcd compilation
336build/pgcd/pgcd.elf: $(PGCD_OBJS) pgcd/pgcd.ld
337        $(LD) -o $@ -T pgcd/pgcd.ld $(PGCD_OBJS)
338        $(DU) -D $@ > $@.txt
339
340build/pgcd/main.o: pgcd/main.c
341        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
342
343### gameoflife compilation
344build/gameoflife/gameoflife.elf: $(GAMEOFLIFE_OBJS) gameoflife/gameoflife.ld
345        $(LD) -o $@ -T gameoflife/gameoflife.ld $(GAMEOFLIFE_OBJS)
346        $(DU) -D $@ > $@.txt
347
348build/gameoflife/main.o: gameoflife/main.c
349        $(CC) $(USER_INCLUDE) $(CFLAGS) -O3 -c -o $@ $<
350
351### dhrystone compilation
352build/dhrystone/dhrystone.elf: $(DHRYSTONE_OBJS) dhrystone/dhrystone.ld
353        $(LD) -o $@ -T dhrystone/dhrystone.ld $(DHRYSTONE_OBJS)
354        $(DU) -D $@ > $@.txt
355
356build/dhrystone/dhry_1.o: dhrystone/dhry_1.c
357        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
358
359build/dhrystone/dhry_2.o: dhrystone/dhry_2.c
360        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
361
362### sort compilation
363build/sort/sort.elf: $(SORT_OBJS) sort/sort.ld
364        $(LD) -o $@ -T sort/sort.ld $(SORT_OBJS)
365        $(DU) -D $@ > $@.txt
366
367build/sort/main.o: sort/main.c
368        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
369
370### clean
371clean:
372        rm -f *.o *.elf *.bin *.txt core  giet_vsegs.ld hard_config.h map.bin*~
373        $(MAKE) -s clean -C giet_xml
374        rm -rf build/boot/*
375        rm -rf build/fat32/*
376        rm -rf build/common/*
377        rm -rf build/drivers/*
378        rm -rf build/kernel/*
379        rm -rf build/reset/*
380        rm -rf build/libs/*
381        rm -rf build/pgcd/*
382        rm -rf build/hello/*
383        rm -rf build/display/*
384        rm -rf build/router/*
385        rm -rf build/gameoflife/*
386        rm -rf build/dhrystone/*
387        rm -rf build/sort/*
388        rm -rf build/map.bin
389        rm -rf hdd/virt_hdd/*
390        rm -rf hdd/virt_hdd.dmg
Note: See TracBrowser for help on using the repository browser.