Advertisement Jump to content
Sign in to follow this  

GBA :: devkitARM :: makefiles! i need help please

This topic is 4927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a 2 parter... Part 1: I do not understand exactly how this makefile works...
# === Project details (add your own stuff here) ===
PROJ    := foo


LIBS    :=
COBJS   := $(PROJ).o
SOBJS   :=
OBJS    := $(COBJS) $(SOBJS)

# --- boot type ---
MB = 0
ifeq ($(MB),1)
EXT     := mb.gba
SPECS   := -specs=gba_mb.specs
EXT     := gba
SPECS   := -specs=gba.specs

# --- Compiling ---
CROSS:= arm-elf-
AS= $(CROSS)as
CC= $(CROSS)gcc
LD= $(CROSS)gcc
OBJCOPY= $(CROSS)objcopy

MODEL   := -mthumb-interwork -mthumb
CBASE   := $(INCLUDE) -O2 -Wall -mthumb-interwork

ASFLAGS := -mthumb-interwork
CFLAGS  := $(CBASE) -mthumb
LDFLAGS := $(SPECS) $(MODEL) $(LIBPATHS) $(LIBS)  -Wl,-Map,$(PROJ).map

# === Building steps ===
build: $(PROJ).$(EXT)

# --- convert to binary ---
$(PROJ).$(EXT) : $(PROJ).elf
   @$(OBJCOPY) -v -O binary $< $@
   -@gbafix $@

# --- link ---
$(PROJ).elf : $(OBJS)
   $(LD) $(OBJS) $(LDFLAGS) -o $@

# --- compile ---
$(COBJS) : %.o : %.c
   $(CC) $(CFLAGS) -c $< -o $@

# === Clean ===
.PHONY : clean
clean :
   @rm -fv $(OBJS)
   @rm -fv $(PROJ).$(EXT)
   @rm -fv $(PROJ).elf


Now my question's are, how does this file know where to find the tools that i have stored on my computer..? like can it find gcc all by itself? If not, all my tools are in... /Developer/GameBoy\ Advance/devkitARM /Developer/GameBoy\ Advance/libgba In what section would i put that path into the makefile to get a good compile? Part 2: How can i make sure that the ANSI C std libs are makeing it in at link time? Do i have to compile these libs as well? Because I know if i use vHAM for GBA Developemnt, i can use stdlib.h just fine, but when i tried it under devkitAdvance <old> it couldnt find the functions at link time. THANKS VERY MUCH Justin Walsh

Share this post

Link to post
Share on other sites
I'm assuming you're using Windows.

The make utility finds your compiler because you either a) put it's path in the path environment variable (which is a global list of paths the system searches when no path is given and the file doesn't exist in the current directory... in case you didn't know) or b) invoke it in your makefile using an absolute path.

Standard libs are placed on the line marked 'LIBS :='. Consult the GCC manual on how to specify lib named to the linker, e.g. -lm for the math library.

Share this post

Link to post
Share on other sites
So in the example make file baove would i just put in the full path i these lines...

CROSS:= arm-elf-
AS= $(CROSS)as
CC= $(CROSS)gcc
LD= $(CROSS)gcc
OBJCOPY= $(CROSS)objcopy

and make it something like...

PATH:= /Developer/GameBoy\ Advance/devkitARM/
CROSS:= arm-elf-
CC= $(PATH)$(CROSS)gcc
LD= $(PATH)$(CROSS)gcc

would that be correct?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!