GP2X Simplified Make File


Galleon

Still Fresh
Joined
Dec 8, 2005
Messages
14
I'm just getting back into some development with the GP2X, so I'm spending time getting back up to speed. I thought I'd bung some notes down here with links for anyone else who might find them helpful.

I knocked up this very simple make file that works for me (on a basic demo - but you get the idea). It avoids using the 'arm-linux-sdl-config' file that the other make file uses and hopefully makes it a bit simpler to understand whats happening. I wanted to get my head around what was actually happening in the compilation process.

See this link for a short introduction to make files. See this link for a good online book introducing the gcc compiler. In particular to understand the compilation and linking check out Chapters 2 & 3.



Code:
CROSS_COMPILE = C:/devkitpro/devkitGP2X/bin/arm-linux-
BASE = C:/devkitpro/devkitGP2X
LDFLAGS = -static

CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++.exe
STRIP = $(CROSS_COMPILE)strip

SDLTEST_SOURCE = SDLTest.cpp
SDLTEST_OBJS = SDLTest.o
SDLTEST_TARGET = SDLTest.gpe

all : $(SDLTEST_TARGET)

# This case compiles the c plus plus (cpp) file and creates the object file
# -I is the include path, you can repeat this statement multiple times on a line
$(SDLTEST_OBJS) : $(SDLTEST_SOURCE)
	$(CXX) -Wall -c $(SDLTEST_SOURCE) -I$(BASE)/include/SDL
  
# This case creates the executable gpe from the object file
# The -L is a path to a directory with libraries
# -l tells the linker to look for libraries that contain the letters SDL
$(SDLTEST_TARGET) : $(SDLTEST_OBJS)
	$(CXX) $(LDFLAGS) -o $(SDLTEST_TARGET) $(SDLTEST_OBJS) -L$(BASE)/lib -lSDL
	$(STRIP) $(SDLTEST_TARGET)
	

clean:
	rm -f $(ALL_TARGETS) *.o *~
 
Back
Top