Abuse of filenaming and portability
GavinWraith (26) 1563 posts |
In RISC OS the the user has free rein over where she puts her files and what she calls them, outside of $.!Boot, with the exception of names reserved by the OS like !Boot, !Run, !Help and !Sprite which signal their singularity with a leading pling. By abuse of filenaming I mean anything which breaks this freedom. Sadly the Toolbox does this by insisting on the name Res for ResourceFiles. My own stick program does too by insisting on !Drag, Select and !Adjust but I plead mitigation in view of the leading plings. An application should never hardwire filenames into its code. It should use system variables instead, initializing them to particular filenames in !Run (or some Obey file called before the application is started) and then using those in its code. There are lots of hygienic reasons for this, which I won’t deviate into here. My reason for bringing this up is that Unix has no qualms about abusing filenames. In the absence of separate filetypes, Unix applications, and in particular C compilers and Make filename extenders play a huge role. RISC OS has willy nilly followed suit, but with an extra twist of confusion. Where Unix expects C source code to be in a file named foo.c and headers in foo.h, RISC OS might reasonably expect to see foo/c and foo/h. But somebody decided that was too simple-minded and that c.foo and h.foo would do instead. So how should host/buildvm.c get I am trying to port LuaJIT 2.5.2 to RISC OS and the above-mentioned mess is doing my head in. I believe this to be a feasible, even useful project. LuaJIT is blindingly fast and would be a convenient tool. But I fear that there is nothing for it but actually to understand what the makefile is saying and then to do swathes of renaming so that the port of GNU make to RISC OS can do its stuff in this project. I would prefer it all just to work, so that I can let the understanding part go hang. Lee Noar has been very kind and given good advice. More help needed, people! There is a ripe juicy pay-off hanging on a low-branch, that is yet too high for my confused brain. Come and get it. |
Rick Murray (539) 13850 posts |
Isn’t toolbox the one that uses numbers for internationalised things?
It’s “tidier”. All the c files together, all the header files together, and all the assembler files together.
In RISC OS terms, it ought to be host.c.buildvm.
Sounds like what you need is a little Lua program to take the various source files, strip the extension, and put them in the correct subdirectories.
I’m not sure what happens if subdirectories are specified, like host/something.c but I believe that Make/AMU convert references to “this.c” to be “@.c.this”.
I cannot help more with MakeFiles. They’re a certain sort of magical incantation. I got a MakeFile working nicely once. So now I just copy that and change the names of thing as appropriate. Simpler than actually figuring out MakeFile syntax. |
Chris Johns (8262) 242 posts |
GCC seems to be “all or nothing” so if you want to use foo/c and foo/h EVERYTHING has to be that form, including the libraries. I have a similar mess trying to get python to compile C code into extensions. |
Paolo Fabio Zaino (28) 1882 posts |
@ Gavin (and others) for GCC have you tried to define a path variable? For example: Set MyLib$Path <Obey$Dir>. And then pass it to GCC via -I option as follow: gcc blah blah -IMyLib: Then in the c source you can use: #include <mylib.h> And finally for ld linker you can use: For static libraries:
|
Steffen Huber (91) 1953 posts |
With a 77 files/dir limit (or even 47 for the older formats), did they have much choice? |
Steve Fryatt (216) 2105 posts |
Maybe DOS, but that’s not universal. GCC, in the SDK guise at least, is quite happy to have different folders for different things. All of my .c and .h files live in src/, for example, while .d and .o end up in obj/. This means that
to remove all of the compiler’s intermediate junk while leaving the files in src/ alone. |
Stuart Swales (1481) 351 posts |
No. |
Chris Johns (8262) 242 posts |
I also wonder if c.foo / h.foo has some history in the MOS and DFS, where that was about the only way you could do it. |
Stuart Swales (1481) 351 posts |
Exactly that, Chris. |