This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
how_to_use_xcode2_as_ide_on_a_mac [2007/09/10 23:05] audiocommander explained make process & targets |
how_to_use_xcode2_as_ide_on_a_mac [2011/07/22 14:51] (current) digineural removed spam |
||
---|---|---|---|
Line 17: | Line 17: | ||
\\ | \\ | ||
+ | |||
====== About Targets and Makefiles ====== | ====== About Targets and Makefiles ====== | ||
Line 23: | Line 24: | ||
To generate the myapplication.syx file that we can upload to the Core, a process of different steps has to be processed. This process is normally handled by a script called "Makefile": | To generate the myapplication.syx file that we can upload to the Core, a process of different steps has to be processed. This process is normally handled by a script called "Makefile": | ||
* (SDCC) Preprocess the sources (=> main.c & otherfiles.c) | * (SDCC) Preprocess the sources (=> main.c & otherfiles.c) | ||
- | * (SDCC) Compile the sources (=> *.asm) | + | * (SDCC) Compile the sources (=> output/*.asm) |
- | * (SDCC) Assemble to objects (=> *.o) | + | * (SDCC) Assemble to objects (=> output/*.o) |
* (GAPSM / GPLINK) Link objects to executeable (=> *.hex) | * (GAPSM / GPLINK) Link objects to executeable (=> *.hex) | ||
* (hex2syx.pl) Convert to SysEx (=> *.syx) | * (hex2syx.pl) Convert to SysEx (=> *.syx) | ||
Line 30: | Line 31: | ||
If you're using the [[ACSim]], you need a different script; now the GCC compiler is used instead of SDCC because the executeable should run on the Macintosh and not on the box, so the process above would look like this: | If you're using the [[ACSim]], you need a different script; now the GCC compiler is used instead of SDCC because the executeable should run on the Macintosh and not on the box, so the process above would look like this: | ||
* (GCC) Preprocess the sources (=> main.c & otherfiles.c) | * (GCC) Preprocess the sources (=> main.c & otherfiles.c) | ||
- | * (GCC) Compile the sources (=> *.asm) | + | * (GCC) Compile the sources (=> build/myApp.build/*.asm) |
- | * (GCC) Assemble to objects (=> *.o) | + | * (GCC) Assemble to objects (=> build/myApp.build/*.o) |
- | * Link objects to binary executeable (=> *.bin) | + | * Link objects to binary executeable (=> build/Debug/*.bin) |
- | Okay, now you could either sit down and write your own Makefile (uuhh, that's for real nerds only), or you do it the easy way by calling some scripts! In Xcode (and any other IDE) you can generate as many applications out of your sources as you like, by setting up different targets. So once you've set up a target it can easily be selected by a drop-down menu. Don't forget to choose the right target before compiling your sources ;) | + | Okay, now you could either sit down and write your own Makefile (uuhh, that's for the real nerds only), or you do it the easy way by calling some scripts! In Xcode (and any other IDE) you can compile/assemble/link as many executeables out of your sources as you like, by setting up different targets for each application. So once you've set up a target it can easily be selected by a drop-down menu. Don't forget to choose the right target before compiling your sources ;) |
But targets aren't only useful to generate executeables, they can also be used to generate the Makefile! | But targets aren't only useful to generate executeables, they can also be used to generate the Makefile! | ||
Line 79: | Line 80: | ||
PATH=/usr/local/bin:$PATH | PATH=/usr/local/bin:$PATH | ||
+ | cd "$SRCROOT" | ||
+ | ./tools/mkmk.pl "$SRCROOT/MAKEFILE.SPEC" | ||
+ | echo Makefile replaced. | ||
- | cd $SRCROOT/tools | + | exit 0 |
- | ./mkmk.pl $SRCROOT/MAKEFILE.SPEC | + | </code> |
+ | for Xcode 3 you need to strip the quotes: | ||
+ | <code bash> | ||
+ | # shell script goes here | ||
+ | |||
+ | PATH=/usr/local/bin:$PATH | ||
+ | cd $SRCROOT/tools | ||
+ | ./mkmk.pl "$SRCROOT/MAKEFILE.SPEC" | ||
echo Makefile replaced. | echo Makefile replaced. | ||
- | echo Success. | ||
exit 0 | exit 0 | ||
+ | </code> | ||
+ | |||
+ | If you get an error like "line x: ./mkmk.pl: Permission denied", you need to give the perl script execute rights. Easiest way to do this is open your favorite FTP program and set "Executeable" or use the Terminal: | ||
+ | <code> | ||
+ | chmod 750 <drag mkmk.pl in terminal window, path should appear) | ||
</code> | </code> | ||
Line 102: | Line 117: | ||
Now this is basically the same as before. | Now this is basically the same as before. | ||
- | Repeat the steps above, but call your target like your application. The bash script would look like this in the "Run Script": | + | Repeat the steps above, but name your target like your application. The bash script would look like this in the "Run Script": |
<code bash> | <code bash> | ||
Line 109: | Line 124: | ||
PATH=/usr/local/bin:$PATH | PATH=/usr/local/bin:$PATH | ||
- | cd $SRCROOT | + | cd "$SRCROOT" |
make | make | ||
exit 0 | exit 0 | ||
</code> | </code> | ||
+ | |||
+ | For XCode 3.0 (under Leopard) do not forget to remove the quotes around the $SRCROOT (the variable points to your project directory). | ||
As you see, the only trick is, to invoke the makefile. | As you see, the only trick is, to invoke the makefile. | ||
Line 140: | Line 157: | ||
If you have questions, feel free to post them here: http://www.midibox.org/forum/index.php?topic=6527.0 | If you have questions, feel free to post them here: http://www.midibox.org/forum/index.php?topic=6527.0 | ||
+ | |||
+ |