gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Yep, I'm hopeless (more makefile trouble)

#65643 - Linkiboy - Wed Jan 04, 2006 7:07 pm

I'm still having makefile trouble, whenever I try to make my simple one script text program, it igves me the error..
Code:

> "make"
makefile:1: *** missing separator.  Stop.

> Process Exit Code: 2
> Time Taken: 00:01


And my makefile is this:

Code:

gcc -c -mthumb -mthumb-interwork -o test.elf main.c
objcopy -O binary test.elf test.gba


What am I doing wrong?? -_-

#65644 - DekuTree64 - Wed Jan 04, 2006 7:21 pm

You need to put the dependencies for the files above the rules. Try something like

Code:
all: test.gba

test.gba: test.elf
   objcopy -O binary test.elf test.gba

test.elf: main.c
   gcc -c -mthumb -mthumb-interwork -o test.elf main.c


Basically that says you need to build test.gba, and test.gba depends on test.elf, and test.elf depends on main.c, so all the rules cascade down and everything gets built.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#65647 - Linkiboy - Wed Jan 04, 2006 7:26 pm

Now I get
Code:

> "make"
makefile:4: *** missing separator.  Stop.

> Process Exit Code: 2
> Time Taken: 00:00


Hey, at least I'm getting somewhere.

I think is has to do something with my C file not being programmed correctly...

#65648 - keldon - Wed Jan 04, 2006 7:26 pm

You must preceed with tabs and not spaces for commands.

#65649 - Linkiboy - Wed Jan 04, 2006 7:38 pm

keldon wrote:
You must preceed with tabs and not spaces for commands.


OK, I did that, now I get

Code:

> "make"
gcc   -c   -mthumb   -mthumb   -interwork   -o test.elf main.c
"make": gcc: Command not found
"make": *** [test.elf] Error 127

> Process Exit Code: 2
> Time Taken: 00:00


I'm really sorry to bother you all with something that is really simple, but everyone was a newb once, too...

#65650 - DekuTree64 - Wed Jan 04, 2006 7:48 pm

Darn forum, converting my tabs to spaces :P

Anyway, looks like you don't have your path set up properly. Before you call make from the command line, do something like
Code:
SET PATH=c:\devkitpro\msys\bin;c:\devkitpro\devkitarm\bin

Assuming that's where your devkit is installed to, and it should be able to find all the tools.

I usually just make a batch file like this so I can run it from VStudio (or windows explorer):
Code:
SET PATH=c:\devkitpro\msys\bin;c:\devkitpro\devkitarm\bin
make
pause

_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#65653 - Linkiboy - Wed Jan 04, 2006 7:59 pm

DekuTree64 wrote:
Darn forum, converting my tabs to spaces :P

Anyway, looks like you don't have your path set up properly. Before you call make from the command line, do something like
Code:
SET PATH=c:\devkitpro\msys\bin;c:\devkitpro\devkitarm\bin

Assuming that's where your devkit is installed to, and it should be able to find all the tools.

I usually just make a batch file like this so I can run it from VStudio (or windows explorer):
Code:
SET PATH=c:\devkitpro\msys\bin;c:\devkitpro\devkitarm\bin
make
pause

I'm not fully understanding that... oh and I'm using Programmer's Notepad, and I can't find a way to put that before executing the make command.

#65661 - Linkiboy - Wed Jan 04, 2006 9:36 pm

Well, I put the PATH= C:\devkitPro\devkitARM\bin infront of everything in the makefile, but I still get the same error....

#65671 - DekuTree64 - Wed Jan 04, 2006 10:33 pm

Make a text file in the same folder as your makefile, and name it something like build.bat. Then paste those 3 lines from the bottom of my last post into it, and double click it from windows explorer and see if that works.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#65673 - Cearn - Wed Jan 04, 2006 10:47 pm

There's no such tool as gcc in devkitARM, it's arm-elf-gcc. Also, tonc:setup for more on getting compiling with devkitARM.

#65687 - Linkiboy - Thu Jan 05, 2006 12:03 am

DekuTree64 wrote:
Make a text file in the same folder as your makefile, and name it something like build.bat. Then paste those 3 lines from the bottom of my last post into it, and double click it from windows explorer and see if that works.
The results of doing that are disasterous... As soon as a open the BAT file, it keeps looping and doesn't stop. Here is what it says:

(my directory)> SET PATH= (my path)
(my directory)>make

and it keeps repeating.

and yes I do have the pause in there.

and i've repleaced gcc with arm-elf-gcc, and I still get

> "make"
arm-elf-gcc -c -mthumb -mthumb -interwork -o test.elf main.c
"make": arm-elf-gcc: Command not found
"make": *** [test.elf] Error 127

> Process Exit Code: 2
> Time Taken: 00:00

#65688 - Linkiboy - Thu Jan 05, 2006 12:09 am

Reading the tutorial Cearn gave me, I changed SET PATH just to PATH. it now recognizes arm-elf-cgg, but doesn't recognize "-interwork"

> "make"
arm-elf-gcc -c -mthumb -mthumb -interwork -o test.elf main.c
cc1.exe: error: unrecognized command line option "-interwork"
"make": *** [test.elf] Error 1

> Process Exit Code: 2
> Time Taken: 00:01

#65689 - poslundc - Thu Jan 05, 2006 12:11 am

The options are -mthumb and -mthumb-interwork.

Not -mthumb twice, followed by -interwork.

Dan.

#65690 - Linkiboy - Thu Jan 05, 2006 12:15 am

YES!! The makefile works! Now I need to program my main.c correctly. :P

#65691 - Cearn - Thu Jan 05, 2006 12:16 am

If your batch file is called make.bat, it might run that recursively. Or did you use build.bat like DekuTree64 suggested? In that case, nevermind.

Here's another trick you might try: more recent devkitARMs have a set of build rules which you can include to your makefile and save you some hassle. Try adding
Code:
include $(DEVKITARM)/gba_rules
to your makefile. Note that it does rely on the DEVKITARM system variable being set, which should happen automatically when you installed devkitPro/ARM. And you can also set the variable or path via My Computer/System Properties/Advanced/Environment Variables.

#65693 - Linkiboy - Thu Jan 05, 2006 12:41 am

I did both make and build.bat

And I have the most recent DevKit, too.

Anyways the problem is solved now thanks for all your help everyone.