#============================================================================ # 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. cygwin(to be precise cygwin1.dll) is installed on your machine and # is in the path. # 3. GCCHOME environment variable points to location of GCC cross compiler # 4. GCCLIBPATH environment variable points to location of libgcc.a # 5. BREWADDINS environment variable points to location of BREW Addins # 6. BREWDIR environment variable points to location of BREW SDK # 7. The PATH environment variable contains location of GCC (GCCHOME), (GCCHOME)\arm-elf\bin, # and (GCCHOME)\lib\gcc-lib\arm-elf\2.95.3 or whichever version of GCC is installed. # # Notes: # 1. While building the application using this make file, the following warnings may be # received. They can be safely ignored: # "Warning: _divsi3.o does not support interworking, whereas .elf does not" # "Warning: _dvmd_tls.o does not support interworking, whereas .elf does not" # "Warning: cannot find entry symbol _start; defaulting to 00008000" # #============================================================================ #============================================================================ BREW_HOME = $(BREWDIR) BREW_ADDINS = GCC_HOME = $(WINARM_HOME) GCC_LIBPATH = $(GCC_HOME)\lib\gcc\arm-elf\4.1.2# #GCC_LIBPATH = c:/gnude/lib/gcc-lib/arm-elf/3.3.1/# TARGET = testpin MAIN_OBJS = src/artevent.o src/maindelegate.o src/mainentry.o src/mainmenuprelaunch.o src/urlmenuitem.o src/utils/file.o src/utils/filemanager.o src/utils/image.o src/utils/imagestripanimation.o src/uiframelets/baseuicontrolgroup.o src/uiframelets/uiframeletgroup.o src/uicontrols/baseuicontrol.o src/uicontrols/squarecontrol.o src/uicontrols/testcarouselmenu.o src/tinyxml/tinystr.o src/tinyxml/tinyxml.o src/tinyxml/tinyxmlerror.o src/tinyxml/tinyxmlparser.o src/sysframelets/sysframelet.o src/primitives/brewobject.o src/keyhandlers/handleevent.o src/dialogs/commandinterface.o src/dialogs/lightweightdialog.o src/dialogs/lightweightdialogmanager.o src/dialogs/mainmenudialog.o src/dialogs/testcontroldialog.o src/dialogs/xmldisplaydialog.o src/commands/commandinterface.o src/commands/keycommand.o VSL_OBJS = vsl/basic/brewmenuctl.o vsl/basic/memory.o vsl/utils/text.o vsl/web/web.o vsl/web/webrequest.o vsl/web/webresp.o BREW_OBJS = $(AEESRCPATH)\AEEModGen.o $(AEESRCPATH)\AEEAppGen.o OBJS = $(BREW_OBJS) $(MAIN_OBJS) $(VSL_OBJS) APP_INCLUDES = -I "$(BREW_HOME)\inc" #------------------------------------------------------------------------------- # Target file name and type definitions #------------------------------------------------------------------------------- EXETYPE = elf # Target image file format BINARY = bin 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 #----------------------------------------------------------------------- # 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) #----------------------------------------------------------------------- AEESRCPATH = $(BREW_HOME)\src AEEINCPATH = $(BREW_HOME)\inc GCC = $(GCC_HOME)\bin\arm-elf-gcc GPP = $(GCC_HOME)\bin\arm-elf-g++ LD = $(GCC_HOME)\bin\arm-elf-ld DUMPTOOL = $(GCC_HOME)\bin\arm-elf-objdump ELF2MODTOOLPATH = C:\gnude #ELF2MODTOOL = $(ELF2MODTOOLPATH)\BREWelf2mod.exe#Old ELF2MODTOOL = $(ELF2MODTOOLPATH)\bin\elf2mod.exe GCCRESOLVEPATH = $(GCC_HOME) #----------------------------------------------------------------------- # Compiler optimization options # -O0 disables compiler optimizations. Other options probably work as # well. Set to taste. #----------------------------------------------------------------------- OPT = -Os# #----------------------------------------------------------------------- # Compiler code generation options # Add $(TARG) to the CODE line if you're building a Thumb binary (at # the moment, this doesn't work). #----------------------------------------------------------------------- # INLINEFN=-fno-keep-inline-functions END = -mlittle-endian AUX_TARG = -mtpcs-frame --mcallee-super-interworking # Suggested from http://brew.wardco.com/ (doesn't seem to make a different; AUX_CODE does all the hard optimizing) TARG = -mthumb $(AUX_TARG) AUX_CODE = -ffunction-sections -fno-exceptions -fno-unwind-tables# Suggested from http://brew.wardco.com/ CODE = $(END) -fshort-enums -fno-builtin $(AUX_CODE) #----------------------------------------------------------------------- # Include file search path options # (change this to point to where the BREW SDK headers are located) #----------------------------------------------------------------------- INC = -I$(GCC_HOME)\arm-elf\include -I$(AEEINCPATH) -I$(GCC_LIBPATH)\include -I$(GCC_HOME)\include #----------------------------------------------------------------------- # Library search path options # (You can change this to point to where your interworking version of # libgcc.a resides) #----------------------------------------------------------------------- #LIBDIRS = -L$(GCC_LIBPATH) -Lc:/gnude/arm-elf/lib LIBFOLDER = #LIBDIRS = -LC:\gnude\arm-elf\lib -LC:\gnude\lib\gcc-lib\arm-elf\3.3.1 # Works #LIBDIRS = -LC:\WinARM\arm-elf\lib -LC:\gnude\lib\gcc-lib\arm-elf\3.3.1 # uwind-pe.h errors #LIBDIRS = -LC:\gnude\arm-elf\lib -LC:\WinARM\lib\gcc\arm-elf\4.1.1 # Works LIBDIRS = -LC:\WinARM\arm-elf\lib -LC:\WinARM\lib\gcc\arm-elf\4.1.2 # uwind-pe.h errors #LIBDIRS = # cannot find -lgcc #LIBDIRS = -LC:\WinARM\lib\gcc\arm-elf\4.1.1# uwind-pe.h errors #LIBDIRS = -LC:\WinARM\arm-elf\lib # cannot find -lgcc #LIBDIRS = -LC:\WinArm\libtest -LC:\WinArm\libtest\gnude #----------------------------------------------------------------------- # 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) APCS = $(ROPI) $(INTRWK) #Because -mtpcs-frame is being used intead. #----------------------------------------------------------------------- # Compiler output options # -c sets object file output only #----------------------------------------------------------------------- OUT =# Removed the -c and put it directly behind the SRC_FILE in the patterns lower down. #----------------------------------------------------------------------- # Compiler/assembler debug Options # -g is the standard flag to leave debugging information in the # object files. #----------------------------------------------------------------------- DBG = -g #----------------------------------------------------------------------- # Linker Options # -o sets the output filename #----------------------------------------------------------------------- #LINK_CMD = -Ttext 0 --emit-relocs -entry AEEMod_Load -o LINK_SCRIPT = --script $(ELF2MODTOOLPATH)\bin\elf2mod.x #LINK_SCRIPT = --script $(ELF2MODTOOLPATH)\bin\armelf.brew LINK_CMD = $(LINK_SCRIPT) -Ttext 0 --emit-relocs -entry AEEMod_Load -t -o LIBS = -lsupc++ -lc -lgcc #libbgcc.a needs to remain at the end #----------------------------------------------------------------------- # HEXTOOL Options #----------------------------------------------------------------------- BINFORMAT = -O binary #----------------------------------------------------------------------- # Compiler flag definitions #----------------------------------------------------------------------- CFLAGS0 = $(CODE) $(DYNAPP) $(CPU) $(APCS) $(DBG) CFLAGS = $(CFLAGS0) $(INC) $(OPT)# CPPFLAGS = -fno-rtti $(CFLAGS0) $(INC) $(OPT)# #----------------------------------------------------------------------- # Linker flag definitions # no-warn-mismatch turns off the interworking errors. #----------------------------------------------------------------------- LDFLAGS = $(LIBDIRS) --no-warn-mismatch #----------------------------------------------------------------------- # Default target #----------------------------------------------------------------------- default: $(TARGET).$(MODULE) #----------------------------------------------------------------------- # All target #----------------------------------------------------------------------- all: $(TARGET).$(MODULE) #----------------------------------------------------------------------- # C Code inference rules (plus a few others, for debugging purposes) # "make foo.s" will compile foo.c into assembly code. # "make foo.sp" will produce a foo.s file with the information on # which pattern in the RTL was matched to produce each assembly # instruction # "make foo.dump" will make foo.o if necessary and then use objdump -D # on it, piping the results into foo.dump. This is slightly # different from the output of "make foo.s", in general. #----------------------------------------------------------------------- %.o: %.c $(GCC) $(CFLAGS) -o $@ $< %.o: %.cpp $(GPP) $(CPPFLAGS) -o $@ $< %.s: %.c $(GCC) $(CFLAGS) -S $< %.sp: %.c $(GCC) $(CFLAGS) -S -dp $< %.dump: %.o $(DUMPTOOL) -D $< > $@ # NB: $(@F) is just the file name; with out the F, the full path shows OBJ_CMD = -o # Command line option to specify output filename SRC_FILE = $(@:.o=.c) # Input source file specification SRC_CPP_FILE = $(@:.o=.cpp) # Input source file specification SRC_H_FILE = $(@:.o=.h) # Input source file specification OBJ_FILE = $(OBJ_CMD) $(@) # Output object file specification .SUFFIXES : .SUFFIXES : .o .dep .c .cpp .c.o: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GCC) $(CFLAGS) $(OBJ_FILE) $(SRC_FILE) @echo --------------------------------------------------------------- .cpp.o: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GPP) $(CPPFLAGS) $(OBJ_FILE) -c $(SRC_CPP_FILE) @echo --------------------------------------------------------------- .h.o: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GPP) $(CFLAGS) $(OBJ_FILE) $(SRC_H_FILE) @echo --------------------------------------------------------------- .c.mix: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GCC) -S -fs $(CFLAGS) $(INC) $(OBJ_FILE) $< @echo --------------------------------------------------------------- {$(AEESRCPATH)}.c.o: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GCC) $(CFLAGS) $(INC) $(OBJ_FILE) -c $(SRC_FILE) @echo --------------------------------------------------------------- {$(GCCRESOLVEPATH)}.c.o: @echo --------------------------------------------------------------- @echo OBJECT $(@F) $(GCC) $(CFLAGS) $(INC) $(OBJ_FILE) $(GCCRESOLVEPATH)\$(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) $(LINK_ORDER) #----------------------------------------------------------------------- # Cleanup #----------------------------------------------------------------------- clean: rm -f $(APP_OBJS) $(TARGET).$(EXETYPE) $(TARGET).$(MODULE) clean2: rm -f $(TARGET).$(EXETYPE) $(TARGET).$(MODULE) #----------------------------------------------------------------------- # Object File Dependencies # You may well want to add more dependencies here. #-----------------------------------------------------------------------