#============================================================================ # Name: # $(TARGET).mak # # Description: # Makefile to build the $(TARGET) downloadable module. # # The following nmake targets are available in this makefile: # # all - make .elf and .mod image files (default) # clean - delete object directory and image files # filename.o - make object file # # The above targets can be made with the following command: # # nmake /f $(TARGET).mak [target] # # Assumptions: # 1. nmake requires you to have GCC cross compiler installed on your machine. # 2. SFHOME environment variable points to location of SophiaFramework # 3. BREWDIR environment variable points to location of BREW SDK # 4. YAGARTO44HOME environment variable points to location of GCC cross compiler # 5. ELF2MOD_TOOL_PATH environment variable points to location of BREW Elf2Mod # #============================================================================ #============================================================================ SF_HOME = $(SFHOME) BREW_HOME = $(BREWDIR) BREW_ADDINS = $(BREWADDINS) GCC_HOME = $(YAGARTO44HOME) GCC_LIBPATH = $(GCC_HOME)\lib\gcc\arm-elf\4.4.2 TARGET = OBJS = APP_INCLUDES = -I "$(BREWDIR)\inc" -I "$(SF_HOME)\Include" #------------------------------------------------------------------------------- # Target file name and type definitions #------------------------------------------------------------------------------- EXETYPE = elf # Target image file format MODULE = mod # Downloadable module extension #----------------------------------------------------------------------- # Target compile time symbol definitions # # Tells the SDK source stuffs that we're building a dynamic app. #----------------------------------------------------------------------- DYNAPP = -DDYNAMIC_APP # Use KDDI Wrapper Classes #DYNAPP = -DDYNAMIC_APP -DTARGET_EXTENSION_KDDI #----------------------------------------------------------------------- # Software tool and environment definitions # (PREFIX needs to be set to the location of your gcc cross-compiler # and binutils. STUBTOOL needs to be the path and filename of your # copy of makestub) #----------------------------------------------------------------------- GCC = "$(GCC_HOME)\bin\arm-elf-gcc" LD = "$(GCC_HOME)\bin\arm-elf-ld" DUMPTOOL = "$(GCC_HOME)\bin\arm-elf-objdump" ELF2MODTOOLPATH = $(ELF2MOD_TOOL_PATH) ELF2MODTOOL = "$(ELF2MODTOOLPATH)\elf2mod.exe" LINKERSCRIPT = "$(SF_HOME)\Utility\GNU\LinkerScript\elf2mod_sf.x" #----------------------------------------------------------------------- # Compiler optimization options # -O0 disables compiler optimizations. Other options probably work as # well. Set to taste. #----------------------------------------------------------------------- OPT = -O2 #----------------------------------------------------------------------- # Compiler code generation options # Add $(TARG) to the CODE line if you're building a Thumb binary (at # the moment, this doesn't work). #----------------------------------------------------------------------- END = -mlittle-endian TARG = # Use Thumb #TARG = -mthumb CODE = $(END) $(TARG) \ -fno-builtin -fno-nonansi-builtins -fno-exceptions -fno-enforce-eh-specs \ -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fshort-enums \ -fno-threadsafe-statics -fno-stack-check -ffunction-sections -fdata-sections #----------------------------------------------------------------------- # Include file search path options # (change this to point to where the BREW SDK headers are located) #----------------------------------------------------------------------- INC = $(APP_INCLUDES) #----------------------------------------------------------------------- # Library search path options # (You can change this to point to where your interworking version of # libgcc.a resides) #----------------------------------------------------------------------- LIBDIRS = -L"$(GCC_LIBPATH)\interwork" -L"$(SF_HOME)\Library" # Include Math Library path #LIBDIRS = -L"$(GCC_LIBPATH)\interwork" -L"$(GCC_HOME)\arm-elf\lib\interwork" -L"$(SF_HOME)\Library" # Include Thumb Math Library path #LIBDIRS = -L"$(GCC_LIBPATH)\thumb\interwork" -L"$(GCC_HOME)\arm-elf\lib\thumb\interwork" -L"$(SF_HOME)\Library" #----------------------------------------------------------------------- # Nothing below here (except for the dependencies at the bottom of the # file) should need to be changed for a reasonably normal compilation. #----------------------------------------------------------------------- #----------------------------------------------------------------------- # Processor architecture options # Sets the designated target processor for this applet. # Currently, all BREW phones use the ARM 7t chip #----------------------------------------------------------------------- CPU = -mcpu=arm7tdmi #----------------------------------------------------------------------- # ARM Procedure Call Standard (APCS) options # -fPIC sets posititon independent code. Other option: -fpic # -mthumb-interwork enables switching between ARM and Thumb code # -mapcs-frame runs on systems with the frame ptr. specified in the APCS #----------------------------------------------------------------------- ROPI = INTRWK = -mthumb-interwork APCS = -mapcs-frame $(ROPI) $(INTRWK) #----------------------------------------------------------------------- # Compiler output options # -c sets object file output only #----------------------------------------------------------------------- OUT = -c #----------------------------------------------------------------------- # Compiler/assembler debug Options # -g is the standard flag to leave debugging information in the # object files. #----------------------------------------------------------------------- DBG = #----------------------------------------------------------------------- # Linker Options # -o sets the output filename #----------------------------------------------------------------------- LINK_CMD = --script $(LINKERSCRIPT) --gc-sections --emit-relocs -o # Use Thumb #LINK_CMD = -script $(LINKERSCRIPT) --gc-sections --emit-relocs --stub-group-size=2 --pic-veneer -o LIBS = -lSophiaFrameworkBrew310EngYAGARTO44 -lgcc # Link Math Library #LIBS = -lSophiaFrameworkBrew310EngYAGARTO44 -lm -lgcc -lc # Link KDDI Wrapper Class Library #LIBS = -lSophiaFrameworkKDDI310EngYAGARTO44 -lSophiaFrameworkBrew310EngYAGARTO44 -lgcc # Link Thumb SophiaFramework Library #LIBS = -lSophiaFrameworkBrew310EngYAGARTO44Thumb -lgcc # Link Thumb SophiaFramework Library and Math Library #LIBS = -lSophiaFrameworkBrew310EngYAGARTO44Thumb -lm -lgcc -lc # Link Thumb SophiaFramework Library and Thumb KDDI Wrapper Class Library #LIBS = -lSophiaFrameworkKDDI310EngYAGARTO44Thumb -lSophiaFrameworkBrew310EngYAGARTO44Thumb -lgcc #----------------------------------------------------------------------- # HEXTOOL Options #----------------------------------------------------------------------- BINFORMAT = -O binary #----------------------------------------------------------------------- # Compiler flag definitions #----------------------------------------------------------------------- CFLAGS0 = $(OUT) $(DYNAPP) $(CPU) $(APCS) $(CODE) $(DBG) CFLAGS = $(CFLAGS0) $(INC) $(OPT) #----------------------------------------------------------------------- # Linker flag definitions #----------------------------------------------------------------------- LDFLAGS = $(LIBDIRS) #----------------------------------------------------------------------- # Default target #----------------------------------------------------------------------- default: $(TARGET).$(MODULE) #----------------------------------------------------------------------- # All target #----------------------------------------------------------------------- all: $(TARGET).$(MODULE) #----------------------------------------------------------------------- # C++ Code inference rules #----------------------------------------------------------------------- %.o: %.cpp $(GCC) $(CFLAGS) -o $@ $< OBJ_CMD = -o # Command line option to specify output filename SRC_FILE = $(@F:.o=.cpp) # Input source file specification OBJ_FILE = $(OBJ_CMD) $(@F) # Output object file specification .SUFFIXES : .SUFFIXES : .o .dep .cpp .cpp.o: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GCC) $(CFLAGS) $(OBJ_FILE) $(SRC_FILE) @echo --------------------------------------------------------------- #=============================================================================== # MODULE SPECIFIC RULES #=============================================================================== APP_OBJS = $(OBJS) #----------------------------------------------------------------------- # Targets for making the actual binary #----------------------------------------------------------------------- $(TARGET).$(MODULE) : $(TARGET).$(EXETYPE) $(ELF2MODTOOL) $(TARGET).$(EXETYPE) $(TARGET).$(MODULE) $(TARGET).$(EXETYPE) : $(APP_OBJS) $(LD) $(LINK_CMD) $(TARGET).$(EXETYPE) $(LDFLAGS) $(APP_OBJS) $(LIBS) #----------------------------------------------------------------------- # Cleanup #----------------------------------------------------------------------- clean: del /f $(APP_OBJS) $(TARGET).$(EXETYPE) $(TARGET).$(MODULE) #----------------------------------------------------------------------- # Object File Dependencies # You may well want to add more dependencies here. #----------------------------------------------------------------------- #---------------------------------------------------------------------------- # Applet Specific Rules #---------------------------------------------------------------------------- # -------------------------------------------- # DEPENDENCY LIST, DO NOT EDIT BELOW THIS LINE # --------------------------------------------