Self compiling

The place for any Hollywood tutorials
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Self compiling

Post by lazi »

I found very practical for simple C sources to have the compile command line included in the beginning of the source.
Something like this:

;/*
gcc -o bmodx bmodx.c -nostdlib
strip -R.comment bmodx
quit
;*/

#include <proto/dos.h>
...

And here can continue the C cource.

When you execute the source as a DOS script, it will create the executable and you can keep everything in one file.
Now I decided to try it with Hollywood.

The problem is that you can not use ;/* because after the semicolon the rest is ignored by the Hollywood interpreter.
On the other hand you can not use /* because that does not mean a remark for a DOS script.

The solution looks like this:

Code: Select all

/* "Assembling release pack"
hollywood Hollywood:Projects/SQLMan/SQLMan.hws -compile ram:SQLMan -exetype classic881|classic|amigaos4|morphos|aros -linkplugins xmlparser.hwp|muiroyale.hwp|sqlite3.hwp -overwrite -compress -quiet
Echo "OS4..."
copy ram:SQLMan_OS4 to hollywood:projects/sqlman/sqlman/Amiga_OS4/
echo "OS3 FPU..."
copy ram:SQLMan_68881 to hollywood:projects/sqlman/sqlman/Amiga_OS3/
echo "OS3 non FPU..."
copy ram:SQLMan_OS3 to hollywood:projects/sqlman/sqlman/Amiga_OS3/
echo "MOS..."
copy ram:SQLMan_MorphOS to hollywood:projects/sqlman/sqlman/MorphOS/
echo "Aros..."
copy ram:SQLMan_Aros to hollywood:projects/sqlman/sqlman/Arosi386/

quit
*/
@DISPLAY {hidden=True}
@REQUIRE "sqlite3",1,0
@REQUIRE "muiroyale",{version=1,revision=2}    
...
Here can continue the Hollywood script.
The trick is that you have to add a shell alias for /* before executing the Hollywood script:

Code: Select all

New Shell process 11
11.WorkBench:> alias /* echo
11.WorkBench:> execute Tool:Hollywood/Projects/SQLMan/SQLMan.hws 
Assembling release pack
OS4...
OS3 FPU...
OS3 non FPU...
MOS...
Aros...
11.WorkBench:> 
You may add alias permanently.
This way you can set compiling parameters and do not need to maintain a separate file for it. The above example not just compile the script for several platforms, it copies the executables to the desired drawers.

I hope you found it useful.

(Of course it is working on Amiga like systems, where everything is possible just as you imagined!)

Bye!
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Self compiling

Post by airsoftsoftwair »

Interesting, a quite creative solution to this problem :)
bitRocky
Posts: 120
Joined: Fri Nov 14, 2014 6:01 pm

Re: Self compiling

Post by bitRocky »

And if you set the "s" bit to the source file, you don't even need the Execute command!
Post Reply