gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > makefile xcode mac os

#162362 - genecyst - Mon Sep 01, 2008 8:46 am

hi guys, i'm frankie, i read your forum since 1 year ago and i'm started now to develop my first gba game...
i'm going to ask you where i can find (and if it exist) a tutorial which explain how makefile works with mac os shell. i've tried to convert the explaination given in tonc guide but i've obtained nothing at all.
sorry for my english and thanks a lot!
frnkz


ps. give me also an opinion about my first sprites... thanks!

http://farm4.static.flickr.com/3004/2595326620_4684e9e268.jpg?v=0

http://sp5.fotologs.net/photo/21/58/98/genecyst/1215438824032_f.jpg

http://sp5.fotologs.net/photo/21/58/98/genecyst/1211717948_f.jpg
last background is taken from cave's IBARA

#163128 - genecyst - Tue Sep 23, 2008 1:27 pm

hi,
can someone tell me a possible reason why when i try to use the functions defined in libGba (devkitpro r21), xcode tell me the building fails everytime whitout a reason?
if i don't use them i obtain my .gba rom perfectly working...
i think it should be a problem connected to the makefile but if someone got some ideas please tell me...

i can't understand...

#163212 - gmiller - Thu Sep 25, 2008 12:54 pm

If it errors when you use code from libGba then your link step in your make file may not be using the library. There should be a -lgba somewhere in the link command (assuming the name of the library is "libgba.a" and not "libGba.a" as your post implies.

Of course it could be that you have the "-lgba" in the link command but the library path is not allowing the linker to find the library. The library path can be appended to with the "-L path" parameter.

Without the text of the error this is all SWAG (Scientific Wild Ass Guess) so I could be totally off ...

BTW: if you are using a make file you should be able to go to the command line and do this by hand. I have an apple laptop (intel based) and I use it for checking the port of my Linux/Windows/OSx code.

#163213 - genecyst - Thu Sep 25, 2008 3:03 pm

this is the makefile i use:
it's a template that i've found around the net...


OBJECTS = $(SOURCES:.c=.o)

# --- Main build target
build: $(ROM_NAME)

# --- Build .elf file into .gba ROM file
$(ROM_NAME) : $(ELF_NAME)
$(OBJCOPY) $(OBJCOPYFLAGS) $(ELF_NAME) $(ROM_NAME)
$(GBAFIX) $(ROM_NAME)

# --- Build .o files into .elf file
$(ELF_NAME) : $(OBJECTS)
$(LD) $(OBJECTS) $(LDFLAGS) -o $@

# -- Build .c files into .o files
$(OBJECTS) : %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@

clean:
@rm -rfv $(ROM_NAME)
@rm -rfv $(ELF_NAME)
@rm -rfv *.o


i understand almost all of what this code do... but there isn't any path to devkitpro/ARM so i don't know how it can usually compile well...
i feel a little bit lost...
thanks...

#163232 - gmiller - Fri Sep 26, 2008 3:04 pm

well the $(CC) in the makefile need to point to the compiler you are using but I would set up a symbol for it. The standard command line syntax for symbol definition is:

NEW_SYMBOL=some_really_locng_text
export NEW_SYMBOL


at this point this symbol is defined for the terminal session and any sub processes.

Of course the $(LD) needs to point to the linker and the other symbols need to map appropriately.

To see the definition of a symbol use the following:

echo $NEW_SYMBOL


and in the make file use $(NEW_SYMBOL)

#163428 - genecyst - Thu Oct 02, 2008 7:40 am

thanks for the answer, i hope to find some free time this weekend, to try it out.
thanks again!