English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   Host type variable in vasm? (http://eab.abime.net/showthread.php?t=102318)

grond 20 May 2020 13:50

Host type variable in vasm?
 
I have recently played a little with cross-assemblation using vasm on my linux computer and find it very convenient. I now wonder whether there is an internal variable or another way to make one and the same source code assemble in vasm on the Amiga and in vasm on linux. The problem is a small one, on the Amiga I have an include directory called Include:, on linux the includes are obviously in a different place. I could, of course, specify the include directory on the command line or in the makefile but then again I would need to remember everything in order to successfully assemble my stuff in a few years from now (that's usually the biggest challenge...) or setup two different makefiles. I would prefer to just change the declaration in the source file depending on whether I assemble the code on the Amiga or on my linux computer. I think this could be done by using some IFDEF-type construct which would obviously require a way of finding out whether vasm is running on the Amiga or not. Is there some internal variable in vasm that could be checked to determine the type of the build system?

roondar 20 May 2020 13:59

I tend to have a shared makefile and a "proper" makefile. The shared one sets up directories, flags, etc and I include that in the "proper" one. Not really what you asked for, but it's a workaround anyway ;)

phx 20 May 2020 17:02

Quote:

Originally Posted by grond (Post 1401239)
on the Amiga I have an include directory called Include:, on linux the includes are obviously in a different place.
...
Is there some internal variable in vasm that could be checked to determine the type of the build system?

No, not yet. There is also no code to determine the host OS in vasm. The only OS-dependant code (for automatic path-conversions) is selected by compiling vasm with an AMIGA, _WIN32, MSDOS or ATARI define. Default is Unix-style paths.

Maybe I could introduce a symbol which reflects the current path-style (AMIGA, DOS, UNIX)? Does that help?

Quote:

Originally Posted by roondar (Post 1401242)
I tend to have a shared makefile and a "proper" makefile. The shared one sets up directories, flags, etc and I include that in the "proper" one.

Yes, that's also what I did in the past. Usually there is more than just an include path which differs, so I always have sub-Makefile to include for the different platforms.

grond 20 May 2020 17:34

Quote:

Originally Posted by phx (Post 1401284)
No, not yet. There is also no code to determine the host OS in vasm. The only OS-dependant code (for automatic path-conversions) is selected by compiling vasm with an AMIGA, _WIN32, MSDOS or ATARI define. Default is Unix-style paths.

As I'm not much of a programmer, I don't know how this could be done in the most convenient way, but obviously vasm wouldn't have to determine the host OS at run time but only at compile time which shouldn't require much code inside vasm.


Quote:

Maybe I could introduce a symbol which reflects the current path-style (AMIGA, DOS, UNIX)? Does that help?
That would solve the problem for me.


Quote:

Yes, that's also what I did in the past. Usually there is more than just an include path which differs, so I always have sub-Makefile to include for the different platforms.
I guess I should learn more about makefiles, both on linux and the Amiga. In linux I just use GNU make (and the most simple structure), on the Amiga I used to use smake back in the day, but it sucks because it can't even determine which object files need updates.

meynaf 20 May 2020 18:37

There we see the interest of having a simple config file, like Phxass does...

Thomas Richter 20 May 2020 19:22

I would not have two separate makefiles, but rather use vamos to build on Linux, and just use the Amiga binaries. This works surprisingly well now. 3.1.4 was built like this, and P96 is also build like this.

alkis 21 May 2020 06:05

Wouldn't "-Idir1:,dir2" work?

phx 21 May 2020 13:35

Ok, depending on whether vasm is compiled with -DUNIX, -DAMIGA, -DATARI, -DMSDOS, etc. it defines one of these internal symbols:
__UNIXFS __AMIGAFS __MSDOSFS

Otherwise no such symbol is defined. The value is currently 0, which might change in the future. You should check for them with
IFD
.

Feel free to try tomorrow's source snapshot.

Quote:

Originally Posted by Thomas Richter (Post 1401333)
I would not have two separate makefiles, but rather use vamos to build on Linux, and just use the Amiga binaries.

Yes. That's another solution. Although it complicates the build environment by depending on vamos and python (installing, configuring).

jotd 21 May 2020 13:38

personally I find that vamos on windows is unusable... I wanted to use lha on it, and just could get the help page... Any native solutions are always preferable.

vasm forever!

phx 21 May 2020 13:38

Quote:

Originally Posted by alkis (Post 1401424)
Wouldn't "-Idir1:,dir2" work?

Yes, maybe. As long as a path doesn't generate strange errors on one OS.

grond 21 May 2020 13:41

Thank you, I will try it some of these days!

hooverphonique 22 May 2020 21:06

You can do conditional stuff in a makefile based on host OS.


All times are GMT +2. The time now is 10:16.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.04694 seconds with 11 queries