1 | # |
---|
2 | # $Id: Makefile.Software 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | # |
---|
4 | # [ Description ] |
---|
5 | # |
---|
6 | # Makefile |
---|
7 | # |
---|
8 | |
---|
9 | ifeq ($(origin MORPHEO_TOPLEVEL), undefined) |
---|
10 | $(error "variable MORPHEO_TOPLEVEL is undefined") |
---|
11 | else |
---|
12 | include $(MORPHEO_TOPLEVEL)/Makefile.tools |
---|
13 | endif |
---|
14 | |
---|
15 | #-----[ Directory ]--------------------------------------------------------------- |
---|
16 | DIR_OBJ = obj |
---|
17 | DIR_BIN = bin |
---|
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 |
---|
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 |
---|
43 | |
---|
44 | # Tools's option |
---|
45 | OR32_CC_OPT = $(INCLUDE) $(OPTIMIZE) -Wlong-long |
---|
46 | # -DHAVE_LIBC |
---|
47 | OR32_AS_OPT = |
---|
48 | OR32_LD_OPT = -T$(DIR_LDSCRIPT)/or32.ld $(LIBRARY) |
---|
49 | OR32_OBJDUMP_OPT = -D |
---|
50 | OR32_NM_OPT = -n |
---|
51 | |
---|
52 | #-----[ Rules ]------------------------------------------------------------------- |
---|
53 | .PRECIOUS : $(DIR_BIN)/%.x.txt $(DIR_BIN)/%.x $(DIR_OBJ)/%.o |
---|
54 | |
---|
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) |
---|
60 | |
---|
61 | all : |
---|
62 | @\ |
---|
63 | $(MKDIR) $(DIR_BIN) $(DIR_OBJ); \ |
---|
64 | $(MAKE) $(DIR_BIN)/$(EXE).x; |
---|
65 | |
---|
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; |
---|
74 | |
---|
75 | $(DIR_OBJ)/%.o : %.s |
---|
76 | @\ |
---|
77 | $(ECHO) "Compilation : $*.s"; \ |
---|
78 | $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ |
---|
79 | $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; |
---|
80 | # @$(OR32_AS) $(OR32_AS_OPT) $^ -o $@ |
---|
81 | |
---|
82 | $(DIR_OBJ)/%.o : %.c |
---|
83 | @\ |
---|
84 | $(ECHO) "Compilation : $*.c"; \ |
---|
85 | $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ |
---|
86 | $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; |
---|
87 | |
---|
88 | #-----[ Maintenance ]------------------------------------------------------------- |
---|
89 | clean : |
---|
90 | @\ |
---|
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)/*~ \ |
---|
100 | |
---|
101 | clean_all : clean |
---|
102 | |
---|
103 | #-----[ Help ]-------------------------------------------------------------------- |
---|
104 | help : |
---|
105 | @\ |
---|
106 | $(ECHO) "";\ |
---|
107 | $(ECHO) "List of directive : ";\ |
---|
108 | $(ECHO) " * all : Compile the software";\ |
---|
109 | $(ECHO) " * clean : Erase all files generates";\ |
---|
110 | $(ECHO) " * clean_all : Erase all files generates";\ |
---|
111 | $(ECHO) ""; |
---|