# # $Id: Makefile.Software 136 2009-10-20 18:52:15Z rosiere $ # # [ Description ] # # Makefile # ifeq ($(origin MORPHEO_TOPLEVEL), undefined) $(error "variable MORPHEO_TOPLEVEL is undefined") else include $(MORPHEO_TOPLEVEL)/Makefile.tools endif #-----[ Directory ]--------------------------------------------------------------- DIR_OBJ = obj DIR_BIN = bin EXE = soft DIR_COMMON = $(MORPHEO_TOPLEVEL)/Softwares/Common DIR_COMMON_C = $(DIR_COMMON)/src/c DIR_COMMON_ASM = $(DIR_COMMON)/src/asm DIR_COMMON_SYS = $(DIR_COMMON)/src/sys DIR_COMMON_INC = $(DIR_COMMON)/include OBJECTS_COMMON = $(patsubst $(DIR_COMMON_SYS)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_COMMON_SYS)/*.s)) \ $(patsubst $(DIR_COMMON_ASM)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_COMMON_ASM)/*.s)) \ $(patsubst $(DIR_COMMON_C)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_COMMON_C)/*.c)) #-----[ To the compilation ]------------------------------------------------------ OPTIMIZE = -O3 -std=c99 -fomit-frame-pointer -fdelayed-branch -mror -mcmov -msext -mhard-mul -msoft-div -msoft-float #Option : # -fomit-frame-pointer : n'utilise pas le pointeur de frame # -fdelayed-branch : utilise les delayed slot # ON OFF # -mror -mno-ror : utilisation de l'instruction l.ror # -mcmov -mno-cmov : utilisation de l'instruction l.cmov # -msext -mno-sext : utilisation des instructions l.extXX # -mhard-mul -msoft-mul : utilisation du multiplieur materiel # -mhard-div -msoft-div : utilisation du diviseur materiel # -mhard-float -msoft-float : utilisation du flottant materiel # -msibcall -mno-sibcall : Enable sibcall optimization # -mlogue -mno-logue : Schedule pro/epi-logue. # -maj -mno-aj : Use aligned jumps. # Tools OR32_CC = $(OR1K_BIN)/or32-elf-gcc OR32_AS = $(OR1K_BIN)/or32-elf-as OR32_LD = $(OR1K_BIN)/or32-elf-ld OR32_OBJDUMP = $(OR1K_BIN)/or32-elf-objdump OR32_NM = $(OR1K_BIN)/or32-elf-nm # Tools's option OR32_CC_OPT = -Wall $(INCDIR) $(OPTIMIZE) -Wlong-long -DMorpheo $(FLAGS) # -DHAVE_LIBC OR32_AS_OPT = OR32_LD_OPT = -T$(DIR_LDSCRIPT)/or32.ld $(LIBDIR) $(LIBNAME) $(OR1K_LIBDIR) $(OR1K_LIBNAME) OR32_OBJDUMP_OPT = -D OR32_NM_OPT = -n #-----[ Rules ]------------------------------------------------------------------- .PRECIOUS : $(DIR_BIN)/%.x.txt $(DIR_BIN)/%.x $(DIR_OBJ)/%.o vpath %.h $(DIR_INC):$(DIR_COMMON_INC) vpath %.c $(DIR_C):$(DIR_COMMON_C) vpath %.s $(DIR_ASM):$(DIR_SYS):$(DIR_COMMON_ASM):$(DIR_COMMON_SYS) vpath %.o $(DIR_OBJ) vpath %.x $(DIR_BIN) all : $(DIR_BIN)/$(EXE).x $(DIR_BIN)/%.x : $(DIR_BIN) $(DIR_OBJ) @\ $(MAKE) $(OBJECTS); \ $(ECHO) "Linkage : $*.x"; \ $(OR32_LD) -o $@ $(OBJECTS) $(OR32_LD_OPT); \ $(ECHO) "List symbols : $*.x.nm"; \ $(OR32_NM) $(OR32_NM_OPT) $@ > $@.nm; \ $(ECHO) "Display info : $*.x.txt"; \ $(OR32_OBJDUMP) $(OR32_OBJDUMP_OPT) $@ > $@.txt;\ echo $($(GREP) "l.jal 0" $@.txt); $(DIR_OBJ)/%.o : %.s @\ $(ECHO) "Compilation : $*.s"; \ $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; # $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; $(DIR_OBJ)/%.o : %.c @\ $(ECHO) "Compilation : $*.c"; \ $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; # $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; $(DIR_BIN) $(DIR_OBJ) : @\ $(MKDIR) $@; #-----[ Maintenance ]------------------------------------------------------------- clean : @\ $(ECHO) "Delete temporary files"; \ $(RM) $(DIR_OBJ) \ *~ \ $(DIR_SRC)/*~ \ $(DIR_C)/*~ \ $(DIR_ASM)/*~ \ $(DIR_SYS)/*~ \ $(DIR_INC)/*~ \ $(DIR_LDSCRIPT)/*~ \ clean_all : clean $(RM) $(DIR_BIN) #-----[ Help ]-------------------------------------------------------------------- help : @\ $(ECHO) "";\ $(ECHO) "List of directive : ";\ $(ECHO) " * all : Compile the software";\ $(ECHO) " * clean : Erase all files generates";\ $(ECHO) " * clean_all : Erase all files generates";\ $(ECHO) "";