#104774 - OOPMan - Mon Oct 02, 2006 4:30 pm
Hey all, I've been having some problems with a rather detailed makefile. Basically, I've been adapting a makefile used pretty much as standard in the MTCLib source in order to build demos for the NDS build of the library. After struggling for a while I think I'm pretty close to getting it working, but it seems that one major obstacle remains.
First off, here's the makefile:
Right, so there's the makefile. When I run make I get this:
From the looks of it, the problem may be here:
or here:
Is this the case? From the looks of it it seems to be having issue with the rule that calls the linked on .obj files, to the extent that it's not bothering to get to the point of actually compiling the source files...
Or rather, to illustrate it as a chain...
.nds.gba <- .nds <- .bin <- .elf <.o < .c
With the problem occurring when make attempts to follow the rule chain from .elf to .o
Does anyone have any advice on this? What am I doing wrong?
EDIT: Quote has buggered up the tabs, so don't worry about the makefile's tabbing being screwed (Which causes problems in real life :-)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...
First off, here's the makefile:
Quote: |
# GNU makefile to build MTC app with devkitPro
# # REVISION HISTORY # # No Date By Reason # ------------------------------------------------------------------------- # 01 25 Sep 02 lvr Creation # 02 11 Feb 06 lvr Modified for SwsMtc # 03 01 Oct 06 acj Modified for devkitPro # ------------------------------------------------------------------------- # # Instructions # ------------ # type make -f makefile to use. Add "DEBUG=1" to build at debug. # Default to ndebug build # ifndef NDEBUG ifndef DEBUG NDEBUG = 1 endif endif # Executable TARGET = demo1.nds.gba # The filename of this makefile MAKEFILE = makefile # The platform PLATFORM = nds ######################## # Paths vpath ifdef DEBUG OBJ = ./dbg OBJDIR = ./dbg else OBJ = ./rel OBJDIR = ./rel endif vpath %.obj $(OBJ)/ vpath %.elf $(OBJ)/ vpath %.bin $(OBJ)/ vpath %.nds $(OBJ)/ SRC = .. vpath %.c $(SRC) vpath %.cpp $(SRC) INC2 = ../../../include INCLUDE += -I$(INC2) INCLUDE += -I$(DEVKITPRO)/libnds/include vpath %.h $(INC2) INC3 = $(DEVKITPRO)/libnds/include INCLUDE += -I$(INC3) vpath %.h $(INC3) # Libraries: MTCDIR = ../../../lib/$(PLATFORM) NDSLIB_LIB=$(DEVKITPRO)/libnds/lib ######################## # Objects to build APPOBJS = $(OBJ)/demo1.obj ELFOBJS = $(OBJ)/arm9.elf BINOBJS = $(OBJ)/arm9.bin NDSOBJS = $(OBJ)/demo1.nds $(TARGET) : $(NDSOBJS) $(NDSOBJS) : $(BINOBJS) $(BINOJS) : $(ELFOBJS) $(ELFOBJS) : $(APPOBJS) # Common build options CPPFLAGS += -DMTC_LIB -DNDS -DARM9 ######################## # Tools # C compiler CC = arm-eabi-g++ CFLAGS = -c -mcpu=arm9tdmi -mtune=arm9tdmi -ffast-math -mthumb-interwork CCOUT = -o CPPFLAGS += $(INCLUDE) CSTRICT = -pedantic # Warnings CFLAGS += -Wall -W -Wunused\ -Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align -Wshadow \ -Wno-nested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations # gcc 2.95.2-9 extras. Linux kernel 2.2.12 ships with gcc 2.7.2 CFLAGS += -Wmultichar -Wunknown-pragmas -Wsign-compare # C++ compiler CXX = arm-eabi-g++ CXXFLAGS = -c -x c++ -mcpu=arm9tdmi -mtune=arm9tdmi -ffast-math -mthumb-interwork CXXSTRICT = -pedantic # C++ warnings CXXFLAGS += -Wall -W -Wunused \ -Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align -Wshadow \ -ffor-scope \ -Wno-reorder -Wno-ctor-dtor-privacy \ -Wno-effc++ -Wno-old-style-cast # NB g++ 2.95.2 doesnt put STL iterators in std:: so force no-honor-std #CXXFLAGS += -fno-honor-std # Assembler AS = arm-eabi-as ASFLAGS = ASOUT = -o # Linker LD = arm-eabi-g++ LDFLAGS = -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs LDOUT = -o # Lib AR = arm-eabi-ar ARFLAGS = r # Elf to Bin Objcopy OBJCOPY = arm-eabi-objcopy OBJCOPYFLAGS = OBJCOPYOUT = -o # NDSTool NDSTOOL = ndstool NDSTOOLFLAGS = NDSTOOLOUT = -c # DSBuild DSBUILD = dsbuild DSBUILDFLAGS = DSBUILDOUT = -o ifdef DEBUG # Debug options CFLAGS += -ggdb -g3 CXXFLAGS += -ggdb -g3 CPPFLAGS += -DMTC_DEBUG=$(DEBUG) #ASFLAGS += -defsym MTC_DEBUG=$(DEBUG) --gdwarf2 ASFLAGS += -DMTC_DEBUG=$(DEBUG) /Zi LDFLAGS += -ggdb -g3 ifeq ( 1, 0) #Force C++ compile/link CC = $(CXX) CFLAGS = $(CXXFLAGS) CSTRICT = $(CXXSTRICT) LD = $(CXX) endif else # Release options CFLAGS += -O3 -fomit-frame-pointer CXXFLAGS += -O3 CPPFLAGS += -DNDEBUG ASFLAGS += -DNDEBUG=1 LDFLAGS += -s # strip symbols endif ######################## # SwsMtc library ifndef DEBUG MTC = mtcarm9 else MTC = mtcarm9d endif LIBS = -L$(MTCDIR) -L$(NDSLIB_LIB) LIBS += -l$(MTC) -lnds9 LIBRARY = $(MTCDIR)/lib$(MTC).a $(LIBRARY) : $(MAKE) -C $(MTCDIR) lib$(MTC).a $(TARGET) : $(LIBRARY) ######################## # Implicit rules .SUFFIXES : .SUFFIXES : .nds .bin .elf .c .cpp .asm .h .obj .a $(OBJ)/%.nds : %.bin $(NDSTOOL) $(NDSTOOLFLAGS) $(NDSTOOLOUT)$@ -9 $< $(OBJ)/%.bin : %.elf $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYOUT)$@ $< $(OBJ)/%.elf : %.obj $(LD) $(LDFLAGS) $(LDOUT)$@ $^ $(LIBS) $(OBJ)/%.obj : %.c $(CC) $(CSTRICT) $(CFLAGS) $(CPPFLAGS) $(CCOUT)$@ $< $(OBJ)/%.obj : %.cpp $(CXX) $(CXXSTRICT) $(CXXFLAGS) $(CPPFLAGS) $(CCOUT)$@ $< $(OBJ)/%.obj : %.asm $(AS) $(ASFLAGS) $(ASOUT)$@ $< ######################## # Explicit rules for building objects go here. all : $(TARGET) $(OBJ) : -mkdir $(OBJDIR) $(TARGET) : $(OBJ) $(NDSOBJS) $(DSBUILD) $(NDSOBJS) $(DSBUILDFLAGS) $(DSBUILDOUT) $@ $(NDSOBJS) : $(BINOBJS) $(NDSTOOL) $(NDSTOOLFLAGS) $(NDSTOOLOUT)$@ -9 $< $(BINOJS) : $(ELFOBJS) $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYOUT)$@ $< $(ELFOBJS) : $(APPOBJS) $(LD) $(LDFLAGS) $(LDOUT)$@ $^ $(LIBS) clean : -rm -r -f $(OBJDIR) -rm -f $(TARGET) ######################## # Dependencies DEPEND = $(OBJ) # $(MAKEFILE) $(APPOBJS): $(DEPEND) $(INC2)/mtc.h # End of file |
Right, so there's the makefile. When I run make I get this:
Quote: |
$ make
make: *** No rule to make target `arm9.elf', needed by `rel/arm9.bin'. Stop. |
From the looks of it, the problem may be here:
Quote: |
$(OBJ)/%.elf : %.obj
$(LD) $(LDFLAGS) $(LDOUT)$@ $^ $(LIBS) |
or here:
Quote: |
$(ELFOBJS) : $(APPOBJS)
$(LD) $(LDFLAGS) $(LDOUT)$@ $^ $(LIBS) |
Is this the case? From the looks of it it seems to be having issue with the rule that calls the linked on .obj files, to the extent that it's not bothering to get to the point of actually compiling the source files...
Or rather, to illustrate it as a chain...
.nds.gba <- .nds <- .bin <- .elf <.o < .c
With the problem occurring when make attempts to follow the rule chain from .elf to .o
Does anyone have any advice on this? What am I doing wrong?
EDIT: Quote has buggered up the tabs, so don't worry about the makefile's tabbing being screwed (Which causes problems in real life :-)
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI
You can find my NDS homebrew projects here...