[88] | 1 | # |
---|
| 2 | # $Id: Makefile.Software 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 3 | # |
---|
| 4 | # [ Description ] |
---|
| 5 | # |
---|
| 6 | # Makefile |
---|
| 7 | # |
---|
[78] | 8 | |
---|
[88] | 9 | ifeq ($(origin MORPHEO_TOPLEVEL), undefined) |
---|
| 10 | $(error "variable MORPHEO_TOPLEVEL is undefined") |
---|
| 11 | else |
---|
| 12 | include $(MORPHEO_TOPLEVEL)/Makefile.tools |
---|
| 13 | endif |
---|
| 14 | |
---|
[78] | 15 | #-----[ Directory ]--------------------------------------------------------------- |
---|
[88] | 16 | DIR_OBJ = obj |
---|
| 17 | DIR_BIN = bin |
---|
[78] | 18 | |
---|
| 19 | EXE = soft |
---|
| 20 | |
---|
| 21 | #-----[ To the compilation ]------------------------------------------------------ |
---|
| 22 | OPTIMIZE = -O3 -fomit-frame-pointer -fdelayed-branch -mror -mcmov -msext -mhard-mul -msoft-div -msoft-float |
---|
| 23 | #Option : |
---|
| 24 | # -fomit-frame-pointer : n'utilise pas le pointeur de frame |
---|
| 25 | # -fdelayed-branch : utilise les delayed slot |
---|
| 26 | # ON OFF |
---|
| 27 | # -mror -mno-ror : utilisation de l'instruction l.ror |
---|
| 28 | # -mcmov -mno-cmov : utilisation de l'instruction l.cmov |
---|
| 29 | # -msext -mno-sext : utilisation des instructions l.extXX |
---|
| 30 | # -mhard-mul -msoft-mul : utilisation du multiplieur materiel |
---|
| 31 | # -mhard-div -msoft-div : utilisation du diviseur materiel |
---|
| 32 | # -mhard-float -msoft-float : utilisation du flottant materiel |
---|
| 33 | # -msibcall -mno-sibcall : Enable sibcall optimization |
---|
| 34 | # -mlogue -mno-logue : Schedule pro/epi-logue. |
---|
| 35 | # -maj -mno-aj : Use aligned jumps. |
---|
| 36 | |
---|
| 37 | # Tools |
---|
[81] | 38 | OR32_CC = $(OR1K_BIN)/or32-elf-gcc |
---|
| 39 | OR32_AS = $(OR1K_BIN)/or32-elf-as |
---|
| 40 | OR32_LD = $(OR1K_BIN)/or32-elf-ld |
---|
| 41 | OR32_OBJDUMP = $(OR1K_BIN)/or32-elf-objdump |
---|
| 42 | OR32_NM = $(OR1K_BIN)/or32-elf-nm |
---|
[78] | 43 | |
---|
| 44 | # Tools's option |
---|
[81] | 45 | OR32_CC_OPT = $(INCLUDE) $(OPTIMIZE) -Wlong-long |
---|
[78] | 46 | # -DHAVE_LIBC |
---|
[81] | 47 | OR32_AS_OPT = |
---|
[88] | 48 | OR32_LD_OPT = -T$(DIR_LDSCRIPT)/or32.ld $(LIBRARY) |
---|
[81] | 49 | OR32_OBJDUMP_OPT = -D |
---|
| 50 | OR32_NM_OPT = -n |
---|
[78] | 51 | |
---|
| 52 | #-----[ Rules ]------------------------------------------------------------------- |
---|
[88] | 53 | .PRECIOUS : $(DIR_BIN)/%.x.txt $(DIR_BIN)/%.x $(DIR_OBJ)/%.o |
---|
[78] | 54 | |
---|
[88] | 55 | vpath %.h $(DIR_INC) |
---|
| 56 | vpath %.c $(DIR_C) |
---|
| 57 | vpath %.s $(DIR_ASM):$(DIR_SYS) |
---|
| 58 | vpath %.o $(DIR_OBJ) |
---|
| 59 | vpath %.x $(DIR_BIN) |
---|
[78] | 60 | |
---|
[88] | 61 | all : |
---|
[78] | 62 | @\ |
---|
[88] | 63 | $(MKDIR) $(DIR_BIN) $(DIR_OBJ); \ |
---|
| 64 | $(MAKE) $(DIR_BIN)/$(EXE).x; |
---|
[78] | 65 | |
---|
[88] | 66 | $(DIR_BIN)/%.x : $(OBJECTS) |
---|
| 67 | @\ |
---|
| 68 | $(ECHO) "Linkage : $*.x"; \ |
---|
| 69 | $(OR32_LD) -o $@ $^ $(OR32_LD_OPT); \ |
---|
| 70 | $(ECHO) "List symbols : $*.x.nm"; \ |
---|
| 71 | $(OR32_NM) $(OR32_NM_OPT) $^ > $@.nm; \ |
---|
| 72 | $(ECHO) "Display info : $*.x.txt"; \ |
---|
| 73 | $(OR32_OBJDUMP) $(OR32_OBJDUMP_OPT) $^ > $@.txt; |
---|
[78] | 74 | |
---|
[88] | 75 | $(DIR_OBJ)/%.o : %.s |
---|
| 76 | @\ |
---|
| 77 | $(ECHO) "Compilation : $*.s"; \ |
---|
| 78 | $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ |
---|
[81] | 79 | $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; |
---|
| 80 | # @$(OR32_AS) $(OR32_AS_OPT) $^ -o $@ |
---|
[78] | 81 | |
---|
[88] | 82 | $(DIR_OBJ)/%.o : %.c |
---|
| 83 | @\ |
---|
| 84 | $(ECHO) "Compilation : $*.c"; \ |
---|
| 85 | $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ |
---|
[81] | 86 | $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; |
---|
[78] | 87 | |
---|
| 88 | #-----[ Maintenance ]------------------------------------------------------------- |
---|
| 89 | clean : |
---|
| 90 | @\ |
---|
[88] | 91 | $(ECHO) "Delete temporary files"; \ |
---|
| 92 | $(RM) $(DIR_OBJ) $(DIR_BIN) \ |
---|
| 93 | *~ \ |
---|
| 94 | $(DIR_SRC)/*~ \ |
---|
| 95 | $(DIR_C)/*~ \ |
---|
| 96 | $(DIR_ASM)/*~ \ |
---|
| 97 | $(DIR_SYS)/*~ \ |
---|
| 98 | $(DIR_INC)/*~ \ |
---|
| 99 | $(DIR_LDSCRIPT)/*~ \ |
---|
[78] | 100 | |
---|
[88] | 101 | clean_all : clean |
---|
[78] | 102 | |
---|
| 103 | #-----[ Help ]-------------------------------------------------------------------- |
---|
| 104 | help : |
---|
| 105 | @\ |
---|
| 106 | $(ECHO) "";\ |
---|
| 107 | $(ECHO) "List of directive : ";\ |
---|
[88] | 108 | $(ECHO) " * all : Compile the software";\ |
---|
| 109 | $(ECHO) " * clean : Erase all files generates";\ |
---|
| 110 | $(ECHO) " * clean_all : Erase all files generates";\ |
---|
[78] | 111 | $(ECHO) ""; |
---|