Self compiling

The place for any Hollywood tutorials

Self compiling

Postby lazi » Sat May 07, 2016 10:19 pm

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
lazi
 
Posts: 256
Joined: Fri Feb 25, 2011 12:08 am

Re: Self compiling

Postby airsoftsoftwair » Sun May 08, 2016 10:02 pm

Interesting, a quite creative solution to this problem :)
User avatar
airsoftsoftwair
 
Posts: 2198
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Self compiling

Postby bitRocky » Wed May 11, 2016 4:15 pm

And if you set the "s" bit to the source file, you don't even need the Execute command!
bitRocky
 
Posts: 53
Joined: Fri Nov 14, 2014 7:01 pm


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest