# ----------------------------------------------------------------------------- # \file makefile # \brief The SGADE template make file # \date September 5, 2002 # # \author Jaap Suter, Mark T. Price # # This file contains the make-instructions for a SGADE project. In # order to use this make file you need to change # GCC_DIR, # PROJECT_DIR, # SOCRATES_LIB_DIR and # SOCRATES_INC_DIR and # to the locations on your own computer. # # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # Project name definition; # ----------------------------------------------------------------------------- PROJECT = Sample # ----------------------------------------------------------------------------- # Base directory of the project. Replace this with wherever # you have put the sample application on your computer # ----------------------------------------------------------------------------- PROJECT_DIR = . # ----------------------------------------------------------------------------- # GCC Version you're using. If you're using the latest DevKitAdv this # should be correct already. # ----------------------------------------------------------------------------- GCC_VERSION = 3.0.2 # ----------------------------------------------------------------------------- # Base directory for GCC Arm-Agb-Elf compiler. Replace with # wherever you have put it. # ----------------------------------------------------------------------------- GCC_DIR = C:/consapps/devkitadv # ----------------------------------------------------------------------------- # Socrates library and header directories. Replace this with wherever # you have put the Socrates on your computer # ----------------------------------------------------------------------------- SOCRATES_LIB_DIR = C:/dev/gba/SGADE/lib/ SOCRATES_INC_DIR = C:/dev/gba/SGADE/include/ # ----------------------------------------------------------------------------- # Socrates library itself; # ----------------------------------------------------------------------------- SOCRATES_LIB = $(SOCRATES_LIB_DIR)/libSocrates.a # ----------------------------------------------------------------------------- # Compiler directories for includes and libs. # Assuming you are using Devkit Advance there should be no need to change # these, since they are derived from the above CMP_DIR directory definition. # ----------------------------------------------------------------------------- STD_LIB_DIR0 = $(GCC_DIR)/lib/gcc-lib/arm-agb-elf/$(GCC_VERSION)/interwork STD_LIB_DIR1 = $(GCC_DIR)/arm-agb-elf/lib/interwork STD_INC_DIR0 = $(GCC_DIR)/lib/gcc-lib/arm-agb-elf/$(GCC_VERSION)/include STD_INC_DIR1 = $(GCC_DIR)/arm-agb-elf/include # ----------------------------------------------------------------------------- # Project directories. # ----------------------------------------------------------------------------- INC_DIR = $(PROJECT_DIR)/include SRC_DIR = $(PROJECT_DIR)/source CRT0_S_DIR = $(PROJECT_DIR) LINK_SCRIPT_DIR = $(PROJECT_DIR) OBJ_DIR = $(PROJECT_DIR)/bin ELF_DIR = $(PROJECT_DIR)/bin DAT_DIR = $(PROJECT_DIR)/data # ----------------------------------------------------------------------------- # Define the flags for the compiler, the assembler and the linker; # ----------------------------------------------------------------------------- C_FLAGS = -I$(DAT_DIR) -I$(INC_DIR) -I $(SOCRATES_INC_DIR) -I$(STD_INC_DIR0) -I$(STD_INC_DIR1) -I $(SGADE_SRC_DIR) -mthumb -mthumb-interwork -c -g -Wall -fverbose-asm CPP_FLAGS = -I$(DAT_DIR) -I$(INC_DIR) -I $(SOCRATES_INC_DIR) -I$(STD_INC_DIR0) -I$(STD_INC_DIR1) -I $(SGADE_SRC_DIR) -mthumb -mthumb-interwork -c -g -Wall -fverbose-asm S_FLAGS = -I$(DAT_DIR) -I$(INC_DIR) -I $(SOCRATES_INC_DIR) -I$(STD_INC_DIR0) -I$(STD_INC_DIR1) -mthumb-interwork L_FLAGS = -lSocrates -L $(SOCRATES_LIB_DIR) -L$(STD_LIB_DIR0) -L$(STD_LIB_DIR1) -T $(LINK_SCRIPT_DIR)/lnkscript -lgcc # ----------------------------------------------------------------------------- # Define the list of object files # ----------------------------------------------------------------------------- O_FILES_FROM_C = $(PROJECT).o O_FILES_FROM_CPP = O_FILES_FROM_C_FULL_PATH = $(addprefix $(OBJ_DIR)/, $(O_FILES_FROM_C)) O_FILES_FROM_CPP_FULL_PATH = $(addprefix $(OBJ_DIR)/, $(O_FILES_FROM_CPP)) CRT0_O = $(OBJ_DIR)/crt0.o #CRTBEGIN_O = $(STD_LIB_DIR0)/crtbegin.o #CRTEND_O = $(STD_LIB_DIR0)/crtend.o O_FILES_FULL_PATH = $(CRT0_O) $(CRTBEGIN_O) $(CRTEND_O) $(O_FILES_FROM_C_FULL_PATH) $(O_FILES_FROM_CPP_FULL_PATH) # ----------------------------------------------------------------------------- # Define the final dependecy; # ----------------------------------------------------------------------------- all : $(PROJECT_DIR)/$(PROJECT).gba @echo Done # ----------------------------------------------------------------------------- # Define the copy from .elf to .gba file # ----------------------------------------------------------------------------- $(PROJECT_DIR)/$(PROJECT).gba : $(ELF_DIR)/$(PROJECT).elf @echo Object copying @$(GCC_DIR)/bin/objcopy -v -O binary $< $@ # ----------------------------------------------------------------------------- # Define the linker instruction; # ----------------------------------------------------------------------------- $(ELF_DIR)/$(PROJECT).elf : $(O_FILES_FULL_PATH) $(SOCRATES_LIB) @echo Linking object files @$(GCC_DIR)/bin/ld $(O_FILES_FULL_PATH) -o$@ $(L_FLAGS) # ----------------------------------------------------------------------------- # Define the C compiles; # ----------------------------------------------------------------------------- $(O_FILES_FROM_C_FULL_PATH) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c @echo Making $@ @$(GCC_DIR)/bin/gcc -c $< -o$@ $(C_FLAGS) # ----------------------------------------------------------------------------- # Define the CPP compiles; # ----------------------------------------------------------------------------- $(O_FILES_FROM_CPP_FULL_PATH) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp @echo Making $@ @$(GCC_DIR)/bin/gcc -c $< -o$@ $(CPP_FLAGS) $(O_FILES_FROM_CXX_FULL_PATH) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cxx @echo Making $@ @$(GCC_DIR)/bin/gcc -c $< -o$@ $(CPP_FLAGS) $(O_FILES_FROM_CC_FULL_PATH) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cc @echo Making $@ @$(GCC_DIR)/bin/gcc -c $< -o$@ $(CPP_FLAGS) # ----------------------------------------------------------------------------- # Define the assembly of the crt0 file; # ----------------------------------------------------------------------------- $(CRT0_O) : $(OBJ_DIR)/%.o : $(CRT0_S_DIR)/%.S @echo Making $@ @$(GCC_DIR)/bin/gcc -c $< -o$@ $(S_FLAGS) # ----------------------------------------------------------------------------- # Clean definition; # ----------------------------------------------------------------------------- .PHONY : clean clean : @echo Cleaning object, .elf and .gba files. @$(GCC_DIR)/bin/rm -f $(OBJ_DIR)/*.o @$(GCC_DIR)/bin/rm -f $(ELF_DIR)/$(PROJECT).elf @$(GCC_DIR)/bin/rm -f $(PROJECT_DIR)/$(PROJECT).gba @echo Clean done... # ----------------------------------------------------------------------------- # EOF; # -----------------------------------------------------------------------------