22 July 2022, 11:40 | #1 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Compile directory, work directory and relative paths
In the past I made multiple changes in vasm concerning locating files via compile- and work-directory. Still I have the impression that it's not quite right.
I think we agree on the following definition:
|
22 July 2022, 16:56 | #2 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,098
|
GCC's (implementation defined) way of handling quoted include paths matches my (perhaps learned) intuition.
I.e. if the work directory is "PROJECT:", I run "vasm -Iinc src/foo/bar.S" and "bar.S" includes "lib/lib.i", I would expect it to try PROJECT:src/foo/lib/lib.i first, then PROJECT:inc/lib/lib.i, and give up if neither file exist. That's without considering anything else though. If say VBCC's preprocessor or a prominent legacy assembler does something noticeably different then that should certainly be considered. |
23 July 2022, 05:17 | #3 |
Registered User
Join Date: Jan 2019
Location: Brisbane
Posts: 99
|
I would prefer compile then work directory, nothing else considered ??
|
23 July 2022, 09:12 | #4 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
I would also prefer compile directory first.
|
23 July 2022, 12:29 | #5 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Thanks for the input!
It's interesting that most suggest compile-dir first, and paraj even wants to ignore the work-dir. For a comparison I just checked Devpac, BAsm and PhxAss, and all of them ignore the compile-dir! Seems that the concept of a compile directory doesn't exist for assemblers (68k-assemblers, Amiga-assemblers)? Although my personal preference would also be to use the compile-dir with high priority. Quote:
Quote:
Quote:
The most prominent legacy assembler would be Devpac, and it ignores the compile-dir. But as most of us (including myself) like compile-dirs, it may be a compromise to search the work-dir first, to avoid bad surprises with legacy source texts? Anyway, currently vasm's search strategy seems broken, because it locates a file without a path in the compile-dir first, but looks for relative include-paths in the work-dir first... |
|||
23 July 2022, 13:01 | #6 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
Let's say you have file foo.s including bar.i and now you want to create a temporary copy of bar.i to perform some tests.
So you put that copy somewhere, assemble your source from this new place (= new work-dir)... and discover your changes are ignored because compile-dir, which contains original version, is used first. Argh. It's not hard to fix - just rename the original file or duplicate the whole tree - but nevertheless. As current 68k assemblers seem to ignore compile-dir and because of the above example, i'd choose work-dir first. |
23 July 2022, 13:07 | #7 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,038
|
Well, in c/c++ you can include as "" or <>, giving you a choice (and on top of that you can use -I on cmd line).
In asms, the ones I've been using more or less for the last 30 years (from seka to asm-one derivatives), base dir is the source dir (or an optionally configurable dir), and if you want to look elsewhere you can use INCDIR. Now on the other hand, devpac style asms (non-interactive)... They could benefit from a -I parameter, so you could keep your sources independent that way. And finally, when it comes to conflicts I'd prefer source dir first so I could overrider whichever file is or potentially could cause problems. |
23 July 2022, 13:09 | #8 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,038
|
|
23 July 2022, 14:52 | #9 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
I tend to agree with Meynaf, and work-dir-first could solve most of the problems and keeps compatibility, while still finding files in the compile-dir with lower priority.
Although a current work directory, which accidently has the same include file name as in your compile directory, may also be the reason for puzzling bugs. Quote:
Another question would be if relative include paths should actually be searched in the compile-dir at all, or just in the work-dir. Now I think this is also what paraj wanted to indicate in his example. |
|
23 July 2022, 15:06 | #10 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
At worse you can always make the behaviour user-configurable.
|
23 July 2022, 15:16 | #11 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,038
|
|
23 July 2022, 20:48 | #12 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,098
|
FWIW I don't have a strong opinion and was just offering my 2 cents. The reason I mentioned VBCC, even though you only asked about VASM, is precisely because of the scenario brought up by meynaf. If you're working a on mixed ASM/C project and it behaves differently for assembly and C include files that could be confusing.
Also don't know if you're just considering m68k or other supported archs (which I don't care much about ). Either way it probably I'd probably prefer whatever is most compatible with existing code, as I can always adapt new code (which when written in ASM, isn't going to rely on these things). |
24 July 2022, 16:47 | #13 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Thanks for the input! I understand it is important to look into the work-dir first. I also added the new option
-nocompdirto ignore the compile-dir completely. Doing further tests, I noticed that Devpac is one of the few classic assemblers which supports a compile-dir, but after work-dir and not for relative include paths, which are always work-dir based. Some assemblers (e.g. basm) will search in incdirpaths before the work-dir. I chose to search work-dir, then compile-dir, first, following Devpac as reference. |
25 July 2022, 15:31 | #14 |
Registered User
Join Date: Jan 2019
Location: Brisbane
Posts: 99
|
I have compile dir and work dir as the same as I deploy a custom vasm build to my work dir. I also have any dependencies within a subdir here. I like to keep all my project deps together per project. If I were not doing that ie with seperate dirs I would expect work dir first when an include path has not been set.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
vasm Get Current Work Directory (Windows expert needed) | phx | Coders. General | 13 | 15 October 2018 20:57 |
Config file directory paths | hexaae | support.WinUAE | 6 | 24 June 2018 17:28 |
Trying to have portable configuration, relative paths relative to C:\Public\... ? | Turrican | support.WinUAE | 3 | 24 June 2011 16:33 |
Relative paths (WAS: Has anybody ever gotten Shiftrix to work?) | rsn8887 | support.WinUAE | 9 | 27 August 2010 06:56 |
Relative paths | Toni Wilen | request.UAE Wishlist | 0 | 16 August 2009 16:06 |
|
|