include $(MORPHEO_TOPLEVEL)/Makefile.tools #-----[ Directory ]--------------------------------------------------------------- DIRECTORY_OBJ = obj DIRECTORY_BIN = bin EXE = soft #-----[ Files ]------------------------------------------------------------------- OBJECTS = $(OBJECTS_SYS) $(OBJECTS_ASM) $(OBJECTS_C) #-----[ To the compilation ]------------------------------------------------------ OPTIMIZE = -O3 -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 = $(INCLUDE) $(OPTIMIZE) -Wlong-long # -DHAVE_LIBC OR32_AS_OPT = OR32_LD_OPT = -T$(DIRECTORY_LDSCRIPT)/or32.ld $(LIBRARY) OR32_OBJDUMP_OPT = -D OR32_NM_OPT = -n #-----[ Rules ]------------------------------------------------------------------- .PRECIOUS : $(DIRECTORY_BIN)/%.x.txt $(DIRECTORY_BIN)/%.x $(DIRECTORY_OBJ)/%.o all : test_env $(DIRECTORY_BIN)/$(EXE).x.txt $(DIRECTORY_BIN)/%.x.txt : $(DIRECTORY_BIN)/%.x @\ $(ECHO) "List symbols : $*"; \ $(OR32_NM) $(OR32_NM_OPT) $^ > $@.nm; \ $(ECHO) "Display info : $*"; \ $(OR32_OBJDUMP) $(OR32_OBJDUMP_OPT) $^ > $@; $(DIRECTORY_BIN)/%.x : $(OBJECTS) @ \ $(ECHO) "Linkage : $*"; \ $(OR32_LD) -o $@ $^ $(OR32_LD_OPT); $(DIRECTORY_OBJ)/%.o : $(DIRECTORY_ASM)/%.s @ \ $(ECHO) "Compilation : $*"; \ $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; # @$(OR32_AS) $(OR32_AS_OPT) $^ -o $@ $(DIRECTORY_OBJ)/%.o : $(DIRECTORY_SYS)/%.s @ \ $(ECHO) "Compilation : $*"; \ $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; # @$(OR32_AS) $(OR32_AS_OPT) $^ -o $@ $(DIRECTORY_OBJ)/%.o : $(DIRECTORY_C)/%.c @ \ $(ECHO) "Compilation : $*"; \ $(OR32_CC) $(OR32_CC_OPT) -o $@ -c $^ ; \ $(OR32_CC) $(OR32_CC_OPT) -S -o $@.s -c $^ ; #-----[ Environement ]------------------------------------------------------------ test_env : # ifeq ($(origin TOOLS), undefined) # $(error "variable TOOLS is undefined"); # endif # ifeq ($(origin SOFT), undefined) # $(error "variable SOFT is undefined"); # endif @$(MKDIR) $(DIRECTORY_OBJ) $(DIRECTORY_BIN) #-----[ Maintenance ]------------------------------------------------------------- clean : @\ $(ECHO) "Delete temporary files "`$(PWD)`; \ $(RM) $(DIRECTORY_OBJ) $(DIRECTORY_BIN); \ $(MAKE) clean_rec DIRECTORY_CLEAN=.; clean_rec : @\ $(ECHO) "Delete temporary files in directory $(DIRECTORY_CLEAN)"; \ $(RM) -f $(DIRECTORY_CLEAN)/*~; \ for files in `$(LS) $(DIRECTORY_CLEAN)`; do \ if $(TEST) -d $(DIRECTORY_CLEAN)/$$files; \ then \ $(MAKE) clean_rec DIRECTORY_CLEAN=$(DIRECTORY_CLEAN)/$$files; \ fi; \ done; #-----[ Help ]-------------------------------------------------------------------- help : @\ $(ECHO) "";\ $(ECHO) "List of directive : ";\ $(ECHO) " * make : Compile the software";\ $(ECHO) " * make clean : Erase all files generates";\ $(ECHO) "";