Hi,
Here is an example of the makefile (Mr.Mirkos) I use.
My main c file is called:
main.c
I also have:
second.h, second.c
third.h, third.c
This is how I compile all of the files into a program called 'myprog.fxe'
Code:
CC = arm-elf-gcc
LD = arm-elf-gcc
AS = arm-elf-as
AR = arm-elf-ar
NAME = My_prog_name
AUTHOR = Pea
PRG = myprog
ICON = myprog.bmp
OBJS = main.o second.o third.o
LIBS = -L../lib -lmirkoSDK -lm
CRT0 = ../lib/crt0.S
LNKSCRIPT = ../lib/lnkscript
INCLUDES = -I../lib.src/include
CFLAGS = $(INCLUDES) -O3 -s -mtune=arm9tdmi
all: $(OBJS)
$(CC) -c -o crt0.o $(CRT0)
$(LD) -nostartfiles -s -Wall -Wl,-Map,Test.map -T $(LNKSCRIPT) crt0.o -o $(PRG).elf $(OBJS) $(LIBS)
arm-elf-objcopy -O binary $(PRG).elf $(PRG).bin
b2fxec -a $(AUTHOR) -t $(NAME) $(PRG).bin $(PRG).fxe
As you can see, only edit the variables NAME, AUTHOR, PRG, ICON and OBJS:
OBJS:
This is a list of all the code files that you want to compile together. This relates directly to your question. Just list all the .c files here with a space between them, but rename them so that the .c is a .o - this will automatically search for a .c file with the same name (or a .S file, which is ASM) and compile it to a .o
I'm not sure if the order is important or not. I always have the main .c file first.
Also, as long as 'second.h' is #include'ed from within 'second.c', it will also be compiled in to your program
NAME:
This is the descriptive name that is inserted into the fxe, and displayed from within your launcher on the GP32. I don't think it can have spaces. It can be longer than 8 chars. e.g. This_is_my_program. (edit: Looks like it can have spaces if you surround with double quotes as in "This is my program")
AUTHOR:
Your name I guess. Not sure about spaces. (edit: Looks like it can have spaces if you surround with double quotes as in "Firstname lastname")
PRG:
The file name (without and extension) of your final fxe. Must be 8 chars or less.
ICON:
The name of a BMP icon 24x24 pixels in the standard palette that will be used as the icon for your fxe. If the icon can't be found, it will simply have the default icon (but it won't error or anything like that, so don't worry). This is a new variable I added, its not in the original.
EDIT:
Unfortunately, the format of makefiles is fairly complicated, doubly so if you're trying to modify someone else's make files for your own purposes.
Sorry unit3, but in this case, Mr.Mirko (or another author) has especially developed this makefile to be modifiable. I use it for all of my projects (except libMikMod) and it's great.
Hope it helps