Jump to content
  • Advertisement
Sign in to follow this  
justinrwalsh

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

This topic is 4748 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

INCLUDE  :=
LIBPATHS :=

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

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

# --- 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

#EOF 

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
Advertisement
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-
AS= $(PATH)$(CROSS)as
CC= $(PATH)$(CROSS)gcc
LD= $(PATH)$(CROSS)gcc
OBJCOPY= $(PATH)$(CROSS)objcopy


would that be correct?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!