GP32 makefile help


bfg

Still Fresh
Joined
May 16, 2003
Messages
58
Hi !

I need help with makefile in devkitdav.

I've a huge .c with a bmp converted with gp32conv. In my gpmain.c i include it with #include "mygfx.c" but it is compiled every time ...

How can i make a .h who "reference" the .c and change the makefile for compile it only when he is changed ?!

Can somebody help me ?!

here is my makefile :

# devkitadv base dir
export CCBASE=c:/devkitadv
# User options passed to the compiler
export CUSER=-DLITTLE_ENDIAN -DGP32
include $(CCBASE)/gp32.mk
#------------------------------

all: hello.fxe

gpmain.o: gpmain.c

hello.elf: gpmain.o
$(LINK)

hello.fxe: hello.gxb


clean:
del hello.gxb hello.fxe hello.elf gpmain.o
 
all: hello.fxe

gpmain.o: gpmain.c
mygfx.o: mygfx.c

hello.elf: gpmain.o mygfx.o
$(LINK)

hello.fxe: hello.gxb


clean:
del hello.gxb hello.fxe hello.elf gpmain.o





Replace the include "mygfx.c" to "mygfx.h" in you gpmain and make a mygfx.h with

#ifndef _MYGFX
#define _MYGFX

extern unsigned char mygfx[];

#endif

Something like that.
 
Ok, first of all you make the include file. In it simpliest form, all this needs is a declaration of the array you want to use.
Im guessing you have something like:

short myBitmap[1024][1024]= {4234, 432.....} in your C file?
In that case you would put:

extern short myBitmap[1024][1024];

in your header file. Change your #include so this is included instead of the .c file.

Changes to the makefile are easy. All you need to do is change

hello.elf: gpmain.o

To:

hello.elf: gpmain.o mybitmap.o

Where mybitmap.o is the name of your .c file, with a .o extension. This tells make that it needs to link the object file mybitmap.o to make hello.elf. Luckily, Make is smart, and when it can only find mybitmap.c, it knows how to compile it to make the necessary .o file.

Knowing this, you discover that the line "gpmain.o: gpmain.c" is completely unneccesary.
 
I'll try !!

Thank you very much for your help guys !!

EDIT * 2 :

I found why it wasn't working !!! It's ok now ! THANKS A LOT !
 
Back
Top