Changeset 78 for trunk/Softwares/Min.or32/Makefile
- Timestamp:
- Mar 27, 2008, 11:04:49 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Softwares/Min.or32/Makefile
r68 r78 1 1 # common definition 2 include Makefile.morpheo 2 DIRECTORY_SRC = ./src 3 DIRECTORY_C = $(DIRECTORY_SRC)/c 4 DIRECTORY_ASM = $(DIRECTORY_SRC)/asm 5 DIRECTORY_SYS = $(DIRECTORY_SRC)/sys 6 DIRECTORY_INCLUDE = $(DIRECTORY_C)/include 7 DIRECTORY_LDSCRIPT = $(DIRECTORY_SRC)/ldscript/ 3 8 4 #-----[ Directory ]--------------------------------------------------------------- 5 DIR_SRC = ./src 6 DIR_C = $(DIR_SRC)/c 7 DIR_ASM = $(DIR_SRC)/asm 8 DIR_SYS = $(DIR_SRC)/sys 9 DIR_INC = $(DIR_C)/include 10 11 DIR_OBJ = obj 12 DIR_BIN = bin 13 14 EXE = soft 9 INCLUDE = -I$(DIRECTORY_INCLUDE) 10 LIBRARY = 15 11 16 12 #-----[ Files ]------------------------------------------------------------------- 17 OBJ _ASM = $(patsubst $(DIR_ASM)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_ASM)/*.s))18 OBJ _SYS = $(patsubst $(DIR_SYS)/%.s,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SYS)/*.s))19 OBJ _C = $(patsubst $(DIR_C)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_C)/*.c))13 OBJECTS_ASM = $(patsubst $(DIRECTORY_ASM)/%.s,$(DIRECTORY_OBJ)/%.o,$(wildcard $(DIRECTORY_ASM)/*.s)) 14 OBJECTS_SYS = $(patsubst $(DIRECTORY_SYS)/%.s,$(DIRECTORY_OBJ)/%.o,$(wildcard $(DIRECTORY_SYS)/*.s)) 15 OBJECTS_C = $(patsubst $(DIRECTORY_C)/%.c,$(DIRECTORY_OBJ)/%.o,$(wildcard $(DIRECTORY_C)/*.c)) 20 16 21 OBJ = $(OBJ_SYS) $(OBJ_ASM) $(OBJ_C) 17 include ../Makefile.Software 22 18 23 #-----[ Rules ]-------------------------------------------------------------------24 .PRECIOUS : $(DIR_BIN)/%.x $(DIR_OBJ)/%.o $(DIR_OBJ)/%.a25 26 all : test_env $(DIR_BIN)/$(EXE).x.txt27 28 $(DIR_BIN)/%.x.txt : $(DIR_BIN)/%.x29 @\30 $(ECHO) "List symbols of $*"; \31 $(NM) $(NM_OPT) $^ > $@.nm; \32 $(ECHO) "Display information of $*"; \33 $(OBJDUMP) $(OBJDUMP_OPT) $^ > $@;34 35 $(DIR_BIN)/%.x : $(OBJ_SYS) $(OBJ)36 @ \37 $(ECHO) "Linkage of $*"; \38 $(LD) -o $@ $^ $(LD_OPT);39 40 $(DIR_OBJ)/%.o : $(DIR_ASM)/%.s41 @ \42 $(ECHO) "Compile of $*"; \43 $(CC) $(CC_OPT) -I$(DIR_INC) -o $@ -c $^ ; \44 $(CC) $(CC_OPT) -I$(DIR_INC) -S -o $@.s -c $^ ;45 # @$(AS) $(AS_OPT) $^ -o $@46 47 $(DIR_OBJ)/%.o : $(DIR_SYS)/%.s48 @ \49 $(ECHO) "Compile of $*"; \50 $(CC) $(CC_OPT) -I$(DIR_INC) -o $@ -c $^ ; \51 $(CC) $(CC_OPT) -I$(DIR_INC) -S -o $@.s -c $^ ;52 # @$(AS) $(AS_OPT) $^ -o $@53 54 $(DIR_OBJ)/%.o : $(DIR_C)/%.c55 @ \56 $(ECHO) "Compile of $*"; \57 $(CC) $(CC_OPT) -I$(DIR_INC) -o $@ -c $^ ; \58 $(CC) $(CC_OPT) -I$(DIR_INC) -S -o $@.s -c $^ ;59 60 #-----[ Environement ]------------------------------------------------------------61 test_env :62 # ifeq ($(origin TOOLS), undefined)63 # $(error "variable TOOLS is undefined");64 # endif65 # ifeq ($(origin SOFT), undefined)66 # $(error "variable SOFT is undefined");67 # endif68 @$(MKDIR) $(DIR_OBJ) $(DIR_BIN)69 70 #-----[ Maintenance ]-------------------------------------------------------------71 clean :72 @\73 $(ECHO) "Delete temporary files "`$(PWD)`; \74 $(RM) $(DIR_OBJ) $(DIR_BIN); \75 $(MAKE) clean_rec DIR_CLEAN=.;76 77 #Clean recursive78 clean_rec :79 @\80 $(ECHO) "Delete temporary files in directory $(DIR_CLEAN)"; \81 $(RM) -f $(DIR_CLEAN)/*~; \82 for files in `$(LS) $(DIR_CLEAN)`; do \83 if $(TEST) -d $(DIR_CLEAN)/$$files; \84 then \85 $(MAKE) clean_rec DIR_CLEAN=$(DIR_CLEAN)/$$files; \86 fi; \87 done;88 89 #-----[ Help ]--------------------------------------------------------------------90 help :91 @\92 $(ECHO) "";\93 $(ECHO) "List of directive : ";\94 $(ECHO) " * make : Compile the software";\95 $(ECHO) " * make clean : Erase all files generates";\96 $(ECHO) "";
Note: See TracChangeset
for help on using the changeset viewer.