| 1 | ############################################################################ | 
|---|
| 2 | # Makefile for the ALMOS-MKH "sort" application on the TSAR architecture | 
|---|
| 3 | ############################################################################ | 
|---|
| 4 |  | 
|---|
| 5 | CC = mipsel-unknown-elf-gcc | 
|---|
| 6 | AS = mipsel-unknown-elf-as | 
|---|
| 7 | LD = mipsel-unknown-elf-ld | 
|---|
| 8 | DU = mipsel-unknown-elf-objdump | 
|---|
| 9 | AR = mipsel-unknown-elf-ar | 
|---|
| 10 |  | 
|---|
| 11 | LIBS = ../../libs | 
|---|
| 12 |  | 
|---|
| 13 | HAL  = ../../hal | 
|---|
| 14 |  | 
|---|
| 15 | KERNEL = ../../kernel | 
|---|
| 16 |  | 
|---|
| 17 | CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -g -O2 \ | 
|---|
| 18 |                  -fno-delete-null-pointer-checks -fomit-frame-pointer | 
|---|
| 19 |  | 
|---|
| 20 | OBJS = sort.o                   \ | 
|---|
| 21 |        $(LIBS)/build/stdlib.o   \ | 
|---|
| 22 |        $(LIBS)/build/stdio.o    \ | 
|---|
| 23 |        $(LIBS)/build/pthread.o  \ | 
|---|
| 24 |        $(LIBS)/build/malloc.o   \ | 
|---|
| 25 |        $(LIBS)/build/nostdio.o  \ | 
|---|
| 26 |        $(LIBS)/build/hal_user.o | 
|---|
| 27 |  | 
|---|
| 28 | INCLUDES = -I. -I$(LIBS) -I$(KERNEL)/syscalls -I$(HAL)/generic | 
|---|
| 29 |  | 
|---|
| 30 | sort.elf : $(OBJS) sort.ld | 
|---|
| 31 |         $(LD) -o $@ -T sort.ld $(OBJS)  | 
|---|
| 32 |         $(DU) -D $@ > $@.txt | 
|---|
| 33 |  | 
|---|
| 34 | sort.o : sort.c | 
|---|
| 35 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 36 |         $(DU) -D $@ > $@.txt | 
|---|
| 37 |  | 
|---|
| 38 | $(LIBS)/build/hal_user.o : $(HAL)/tsar_mips32/core/hal_user.c $(HAL)/generic/hal_user.h | 
|---|
| 39 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 40 |         $(DU) -D $@ > $@.txt | 
|---|
| 41 |  | 
|---|
| 42 | $(LIBS)/build/stdlib.o : $(LIBS)/stdlib.c $(LIBS)/stdlib.h | 
|---|
| 43 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 44 |         $(DU) -D $@ > $@.txt | 
|---|
| 45 |  | 
|---|
| 46 | $(LIBS)/build/stdio.o : $(LIBS)/stdio.c $(LIBS)/stdio.h | 
|---|
| 47 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 48 |         $(DU) -D $@ > $@.txt | 
|---|
| 49 |  | 
|---|
| 50 | $(LIBS)/build/pthread.o : $(LIBS)/pthread.c $(LIBS)/pthread.h | 
|---|
| 51 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 52 |         $(DU) -D $@ > $@.txt | 
|---|
| 53 |  | 
|---|
| 54 | $(LIBS)/build/malloc.o : $(LIBS)/malloc.c $(LIBS)/malloc.h | 
|---|
| 55 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 56 |         $(DU) -D $@ > $@.txt | 
|---|
| 57 |  | 
|---|
| 58 | $(LIBS)/build/nostdio.o : $(LIBS)/nostdio.c $(LIBS)/nostdio.h | 
|---|
| 59 |         $(CC) $(INCLUDES) $(CFLAGS) -c -o  $@ $< | 
|---|
| 60 |         $(DU) -D $@ > $@.txt | 
|---|
| 61 |  | 
|---|
| 62 | clean: | 
|---|
| 63 |         rm -f *.o *.elf *.txt core $(LIBS)/build/*.o $(LIBS)/build/*.txt | 
|---|