English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 04 May 2014, 15:52   #1
dalton
tulou
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 71
vbcc/vasm automatic dependency files?

Hi,

does anybody know a way of generating make dependency files for vbcc and vasm? It doesn't look like the compilers support it themselves, but maybe there is some external tool that can help?

Cheers
Dalton
dalton is offline  
Old 05 May 2014, 01:52   #2
Redwood
Registered User
 
Join Date: Jun 2008
Location: Sydney / Australia
Posts: 83
It's not much, but there's a couple of older tools on Aminet:

http://aminet.net/search?query=dependency
Redwood is offline  
Old 05 May 2014, 11:44   #3
dalton
tulou
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 71
Sorry, I meant for cross compiling.

Makedepend looks like an option for c-files, but what about asm-sources? I often have incbins and it would be nice if make would rebuild the asm file when the incbin has been updated.
dalton is offline  
Old 06 May 2014, 13:30   #4
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Yes, makedepend looks for C-preprocessor directives, so it is useless.

You have to adapt your Makefile manually. For example:
Code:
mysource.o: mysource.s incfile.i incbin.bin
        vasmm68k_mot -Fhunk -o mysource.o mysource.s
This will regenerate mysource.o as soon as either mysource.s, the include file incfile.i or the included binary incbin.bin have been modified.
phx is offline  
Old 27 August 2015, 06:37   #5
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by dalton View Post
Sorry, I meant for cross compiling.

Makedepend looks like an option for c-files, but what about asm-sources? I often have incbins and it would be nice if make would rebuild the asm file when the incbin has been updated.
Since I am an evil kangaroo, please allow me to unceremoniously revive this thread since I have the same need as the original poster:

I need to build (via vasm) an assembly language source which references - and thus depends on - other files via
incbin
and
include
directives. The corresponding makefile to generate is pretty simple but I will soon have a large number of such files and manually keeping track of these dependencies is not only a chore but more importantly extremely error prone. It is easy to forget one or misspell it or even forget to remove it when it is no longer needed, resulting in wasted hours figuring out why a build is not done when it should or done when it shouldn't.
I have been there already and I do not like this place.

Would it be hard to add an option to vasm to output the dependencies generated by the
inc(lude|bin)
directives?
This would allow to generate the build dependencies automatically, saving time and pointless debugging sessions over the course of a project.

I suppose it would be possible to obtain this result via the
-L
(listing file) option and the judicious placement of
list
and
nolist
directives but this too would ultimately be error prone and unnecessary work since
include
and
incbin
are self sufficient. Filtering the source file using a regular expression would also kind of work but would require to keep track of comments which is likely to be super tedious if not downright impossible.

If need be I am absolutely willing to pay for such an option. Be it in hugs, brownies, beers, or monies.
ReadOnlyCat is offline  
Old 28 August 2015, 00:38   #6
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Quote:
Originally Posted by ReadOnlyCat View Post
Would it be hard to add an option to vasm to output the dependencies generated by the
inc(lude|bin)
directives?
This would allow to generate the build dependencies automatically, saving time and pointless debugging sessions over the course of a project.
I agree this would be a useful feature, being also a person who likes to create dozens of separate assembler sources and include files for a single project.

But I still have no good idea how to do that. Would it be sufficient to have something similar to gcc's -M option? The only problem I see is that vasm will usually not assemble more than a single source text, which would come pretty handy when generating dependencies.
phx is offline  
Old 28 August 2015, 03:32   #7
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by phx View Post
But I still have no good idea how to do that. Would it be sufficient to have something similar to gcc's -M option? The only problem I see is that vasm will usually not assemble more than a single source text, which would come pretty handy when generating dependencies.
For my current needs this would actually be more of a feature than a limitation since I would like to obtain fine grained dependencies: per file rather than per group of files. Gcc's
-M
option would be a nice model indeed but I do not think it is strictly necessary to mention the final form of the file (the
.o
) since the name of the output can be changed nor to output the dependencies in the form of a "make" rule.

Something very simple like this would be perfect (for me):

Code:
# file with dependencies:
$> vasm -Dependz scrolling.s
DH1:Dev/Commodore/Includes/customchips.i
config.i
Bin/copperlist.bin
$>
# file without dependencies:
$> vasm -Dependz hasnodep.s
$>
Obviously the name of the option is meant as a joke and it should take defined symbols into account, include paths, etc. just like a regular run.
ReadOnlyCat is offline  
Old 28 August 2015, 16:41   #8
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Ok, that's not too difficult. I added the new option -depend=<type>. With "-depend=list" the assembler will output a list of file names like in your example (one on each line). With "-depend=make" you can output a single line of dependencies, suitable for a Makefile.

Example for -depend=list:
Code:
Devel:games/sqrxz4OCS> vasmm68k_mot -depend=list -Fbin -quiet -x -DKILLOS -I :SDK/NDK_3.9/Include/include_i -o diskimage diskimage.asm
:SDK/NDK_3.9/Include/include_i/exec/io.i
:SDK/NDK_3.9/Include/include_i/exec/ports.i
:SDK/NDK_3.9/Include/include_i/exec/nodes.i
:SDK/NDK_3.9/Include/include_i/exec/types.i
:SDK/NDK_3.9/Include/include_i/exec/lists.i
:SDK/NDK_3.9/Include/include_i/exec/libraries.i
:SDK/NDK_3.9/Include/include_i/exec/memory.i
:SDK/NDK_3.9/Include/include_i/exec/execbase.i
:SDK/NDK_3.9/Include/include_i/exec/interrupts.i
:SDK/NDK_3.9/Include/include_i/devices/trackdisk.i
:SDK/NDK_3.9/Include/include_i/exec/devices.i
custom.i
files.i
loader.bk
gfx/rg-guru.bk
gfx/rg-logo.bk
mods/y.jingle.mod.bk
sqrxz4raw.chip.bk
sqrxz4raw.fast.bk
password.enc
mods/x.levelcomplete.mod.bk
mods/0.solitude.mod.bk
mods/1.agameoffun.mod.bk
mods/2.insanityofme.mod.bk
mods/3.semicircles.mod.bk
mods/4.wedoitlive.mod.bk
mods/5.chipmachine.mod.bk
mods/6.yetidance.mod.bk
mods/7.chipmycarrot.mod.bk
mods/8.cashiscash.mod.bk
mods/9.bunnyrun.mod.bk
mods/10.icemarbles.mod.bk
mods/z.engineroom.mod.bk
gfx/storya.bk
gfx/storyb.bk
gfx/storyc.bk
gfx/storyd.bk
gfx/storye.bk
gfx/storyf.bk
Example for -depend=make:
Code:
Devel:games/sqrxz4OCS> vasmm68k_mot -depend=make -Fvobj -quiet -x -DKILLOS -I :SDK/NDK_3.9/Include/include_i -o game.o game.asm
game.o: game.asm custom.i display.i view.i game.i tiles.i logo.i hero.i sound.i hiscores.i password.i files.i macros.i gfx/game.cmap gfx/logo.bin
New vasm source snapshot will be available in 13 hours.
http://sun.hasenbraten.de/vasm/index.php?view=source
phx is offline  
Old 29 August 2015, 12:37   #9
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by phx View Post
Ok, that's not too difficult. I added the new option -depend=<type>. With "-depend=list" the assembler will output a list of file names like in your example (one on each line). With "-depend=make" you can output a single line of dependencies, suitable for a Makefile.
[...]
[/code]New vasm source snapshot will be available in 13 hours.
http://sun.hasenbraten.de/vasm/index.php?view=source
Wow! This is so extremely super cool! It feel like Christmas has come four months in advance.
Thanks a lot, I will be testing it this Saturday!

What will happen in the "make" case if file names contain spaces? Will they be double quoted? This is not an issue in the "list" case since file names are delimited by new lines but it seems like one in the "make" case.

In any case, thanks again for the fantastic reactivity!
Expect a testing report soon.
ReadOnlyCat is offline  
Old 30 August 2015, 03:32   #10
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
And of course I got completely diverted by offline life stuff so I did not get a chance to recompile vasm and test.

I will definitely do it tomorrow!
ReadOnlyCat is offline  
Old 02 September 2015, 02:38   #11
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by ReadOnlyCat View Post
And of course I got completely diverted by offline life stuff so I did not get a chance to recompile vasm and test.

I will definitely do it tomorrow!
I got to finally download the source on Sunday but the compiled version did not seem to know about the
-depend
option. I just downloaded the September 1st source code so I will be re-testing in a few minutes once it's all compiled and installed again.

Stay tuned.

Update:
It looks like the source I got on Sunday did not have the option yet, or possibly I messed up and extracted the wrong because the source downloaded today accepts the option and produces the expected result.

My only issue is that the source I'm testing it on does output some text while it compiles and I need to mute it so the messages are not mixed with the dependencies list but I likely just need to find the option which does that.

Thanks again Phx!

Last edited by ReadOnlyCat; 02 September 2015 at 03:25.
ReadOnlyCat is offline  
Old 03 September 2015, 19:42   #12
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Quote:
Originally Posted by ReadOnlyCat View Post
What will happen in the "make" case if file names contain spaces? Will they be double quoted?
Good point. I missed that. Fixed (maybe) in tomorrow's snapshot.

Quote:
Originally Posted by ReadOnlyCat View Post
It looks like the source I got on Sunday did not have the option yet
Sometimes the CVS server may be offline, so the nightly checkout cannot take place. The source will appear sooner or later.

Quote:
Originally Posted by ReadOnlyCat View Post
My only issue is that the source I'm testing it on does output some text while it compiles
What kind of output is that? Maybe vasm should avoid such output when a -depend option is given.
phx is offline  
Old 04 September 2015, 05:17   #13
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by phx View Post
Good point. I missed that. Fixed (maybe) in tomorrow's snapshot.
You are a most fluffy kitten!

Quote:
Originally Posted by phx View Post
Sometimes the CVS server may be offline, so the nightly checkout cannot take place. The source will appear sooner or later.
Could be but I am quite sure I just messed up and extracted my old archive instead of the newly downloaded one last time.

Quote:
Originally Posted by phx View Post
What kind of output is that? Maybe vasm should avoid such output when a -depend option is given.
I think it would be sensible indeed. I wasn't shocked by having to use the
-quiet
option though during my tests but since the output of the
-depend
can only be parsed correctly when it does not include any other information maybe all other outputs ought to be switched off? I would be personally fine with any solution.

The assembly code which generates the output in the file I tested is the following:
Code:
BB_SIZE=                        BB_END-BB_START
                if      BB_SIZE<1024
                        printt ""
                        printt "IT FITS! bytes left:"
                        printv 1024-BB_SIZE
                        dcb.b   1024-BB_SIZE,"x"
                else
The
printt
statements are the culprits.
(The code is from one of Hannibal's toolchain examples.)
ReadOnlyCat is offline  
Old 04 September 2015, 13:03   #14
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Quote:
Originally Posted by ReadOnlyCat View Post
I wasn't shocked by having to use the
-quiet
option though during my tests but since the output of the
-depend
can only be parsed correctly when it does not include any other information maybe all other outputs ought to be switched off?
Agreed.
printt
and
printv
should be ignored when
-depend=<mode>
is given. Fixed that now.
But you still need
-quiet
to suppress the copyright header.
phx is offline  
Old 05 September 2015, 15:32   #15
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by phx View Post
Agreed.
printt
and
printv
should be ignored when
-depend=<mode>
is given. Fixed that now.
But you still need
-quiet
to suppress the copyright header.
Thanks! This is perfect and I will be testing it today.
Once again, you are a most fluffy kitten!
ReadOnlyCat is offline  
Old 05 September 2015, 23:04   #16
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Quote:
Originally Posted by ReadOnlyCat View Post
Once again, you are a most fluffy kitten!
Not being a native speaker I'm not sure if this is a compliment...
phx is offline  
Old 06 September 2015, 00:56   #17
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by phx View Post
Not being a native speaker I'm not sure if this is a compliment...
Ah, I keep forgetting that fluffy can also be used in a pejorative way.
Be ensured that I always use it only for its positive meaning!

Update:
I just tested again with
 05 Sep 2015 01:55:15 GMT: vasm.tar.gz (380480 bytes)
and it effectively suppresses
printt/v
output.

Thanks again!

Update2:

It turns out my test was not very thorough since the source did not actually contain any
include/incbin
(although I could swear I did check beforehand, but it looks like my memory was failing me).

Testing on a file which has a real dependency it indeed works like a charm for the
=list
option.

However, with the
=make
option, if the
-o <somefile.o>
option is not used it will not include the result file in the output (logically so, since none is specified) and produce a rule which is not a valid make rule:

Code:
# working example (with -o):
> vasmm68k_mot -quiet -depend=make -o kangaroo "ExampleBootBlock/UnpackBootBlockWrapper.s" -DDebug=1
kangaroo: ExampleBootBlock/UnpackBootBlockWrapper.s "out_d/bbpacked.bin"

# non working (without -o):
> vasmm68k_mot -quiet -depend=make "ExampleBootBlock/UnpackBootBlockWrapper.s" -DDebug=1
 ExampleBootBlock/UnpackBootBlockWrapper.s "out_d/bbpacked.bin"

^
+----< leading space but no "outputfile:" since none was given.
The absence of output file specification is not a problem with the
=list
option but for the
=make
I guess it should probably be reported as an error since an output file is necessary to produce a valid make rule.
It is not a problem for me since I will be using the
=list
form though.

Last edited by ReadOnlyCat; 06 September 2015 at 01:40. Reason: Added better test and possible bug.
ReadOnlyCat is offline  
Old 11 September 2015, 23:03   #18
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,032
Quote:
Originally Posted by ReadOnlyCat View Post
The absence of output file specification is not a problem with the
=list
option but for the
=make
I guess it should probably be reported as an error since an output file is necessary to produce a valid make rule.
The missing left side of the rule, including the colon, when not specifying an output file, was intentional. See it as a third dependency format. You can complete the rules yourself later.
I don't think an error message would be much better.
phx is offline  
Old 12 September 2015, 03:33   #19
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 50
Posts: 1,176
Quote:
Originally Posted by phx View Post
The missing left side of the rule, including the colon, when not specifying an output file, was intentional. See it as a third dependency format. You can complete the rules yourself later.
I don't think an error message would be much better.
This is perfectly sensible indeed and since file names containing spaces will be enclosed within double quotes the leading space cannot be mistaken for being part of the first dependency's name so all is good.

Thanks for the update! 
ReadOnlyCat is offline  
Old 29 August 2016, 21:21   #20
dalton
tulou
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 71
Thanks for implementing this feature!

I think there's a problem with the way VBCC generates the dependency files though. Include statements are usually written relative to the location of the c-file. For instance if we have a subfolder called foo, then foo/bar.c uses
Code:
#include "bar.h"
to include foo/bar.h. The makefile dependencies however, must be relative to the working directory of the compiler, which is not foo.
The VBCC dependency file looks like this:
Code:
foo/bar.o: foo/bar.c bar.h
, and it fails because the inclusion of bar.h has not been translated as relative to the working directory. The correct dependency file looks like this:
Code:
foo/bar.o: foo/bar.c foo/bar.h
dalton is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vasm question marduk_kurios Coders. Asm / Hardware 7 14 February 2014 21:06
vasm fsincos dalton Coders. Asm / Hardware 4 03 September 2012 11:35
Windows dependency resle support.WinUAE 3 31 January 2012 22:50
rexxsyslib dependency bug in WinUAE? KillaByte support.WinUAE 2 07 October 2009 12:29
REQ: Automatic resolution change ; automatic resolution detection Borg_Number_One request.UAE Wishlist 3 21 August 2004 15:16

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.09933 seconds with 14 queries