DDE and Standard Makefiles
Steve Fryatt (216) 2105 posts |
Is there any documentation on using the new StdTools makefiles that come with current versions of the DDE? I’m trying to use them to build an application and a library which both use OSLib, but it’s not clear how to add the necessary include directories and library files. It seems to be necessary to manually edit # Makefile for exampleapp COMPONENT = ExampleApp # The name of the linked file defaults to COMPONENT, which is often the case # for single-file programs. But when the linked file lives in an application # directory, it is normally called !RunImage. TARGET = !RunImage # The list of source/object files defaults to TARGET, which again is often # the case for single-file programs. But we don't want our source file to be # called !RunImage. OBJS = main CINCLUDES = -IC:,OSLib: LIBS = OSLib:o.OSLib32 INSTDIR ?= <Obey$Dir> # The shared makefiles don't attempt to guess the application directory name # Usually you'll want to place it inside INSTDIR, which is passed in from # either the MkInstall file, or (for !Builder builds) the components file. # SEP expands to the directory separator character - we use this instead of # a literal '.' character to help with cross-compilation. INSTAPP = ${INSTDIR}${SEP}!Example # You need to specify all the files that go into the application directory. # The shared makefiles handle merging the various subdirectories of the # Resources directory for you. INSTAPP_FILES = !Boot !Run !Sprites !Sprites11 !Sprites22 !RunImage include CApp clean:: ${WIPE} ${INSTAPP} ${WFLAGS} # Dynamic dependencies: and this for the module: # Makefile for SFLib COMPONENT = SFLib TARGET = SFLib OBJS = colpick config debug errors event general heap icons \ menus msgs resources stack string tasks transfer url \ windows CINCLUDES = -IC:,OSLib: include CLibrary # Dynamic dependencies: but Is this how it should work, or am I heading in completely the wrong direction? ETA: I’ve found AcornC/C++.Makefiles.Docs, but it’s a little vague on specifics. Grepping the Makefile fragments for |
Sprow (202) 1158 posts |
The use of LIBS looks right, the key bit is that you ‘include CApp’ later on where it then appends the normal C library stubs, so it’s fine to set it to something prior to that. CINCLUDES also looks right, since the compiler will accept multiple -I switches (eg. -IC:,MyLib: is the same as writing -IC: -IMyLib:) so could be appended to even though it currently isn’t. This is not unlike the InetSetup plugin in RiscOS/Sources/SystemRes/InetSetup/Source/Makefile which links with OSLib. |
Steve Fryatt (216) 2105 posts |
Thanks – the fact the CINCLUDES didn’t seem to be mentioned in the comments in the example makefiles made me wonder if I was heading in the right direction. |
Steve Fryatt (216) 2105 posts |
Now that I’ve had a chance to properly look at the way that InetSetup builds, it seems to be expecting to find OSLib somewhere on C$Path? Also, the AppLibs Makefile defines {OSLIB} as C:OSLib.o.OSLib Does that mean that the correct place to install OSLib for the DDE is in AcornC/C++.Export.APCS-32.Lib? Also, the 32-bit OSLib is called OSLib32 as supplied: does this need renaming to make an install ‘standard’, or is some magic filename munging going on somewhere? If I were to download and try and build InetSetup using a copy of the DDE, would I need to find and install OSLib for myself or does it somehow get installed as part of the OS sources? Finally, if one adds additional third-party libraries to the system, is the preferred way to do it to put them into AcornC/C++.Export.APCS-32.Lib so they end up on C:, or somewhere else and update LIBS and CINCLUDES in the Makefile? Apologies for the range of questions. I’m in the process of trying to write a tutorial (ish) for compiling an OSLib-based application in the DDE. As such, I’d prefer the installation of OSLib that I describe to match what’s considered ‘standard’ to avoid confusing things – but as a long-time GCC user, I’ve never actually had to set up the DDE properly before. It would also be better to avoid the described process being unnecessarily complicated… |
Sprow (202) 1158 posts |
Correct, C$Path is a monster variable near the top of the exports which is just a handy stepping off place for all the other libraries to be relative to. For 26 bit builds it would be within Export.APCS-R.Lib and C:OSLib.o.OSLib will still do the right thing.
The renaming is to solve the above mentioned distinction, OSLib32 goes into APCS-32 (renamed as OSLib) and OSLib goes into APCS-R, then the makefiles only ever need to refer to OSLib and the choice of target is selected by the environment (ultimately by C$Path). The other slightly nonstandard thing to watch is that some of the headers get moved for the RISC OS build (inspect the makefile in mixed/RiscOS/Sources/ThirdParty/OSLib/Lib/OSLib). I believe its origins lie in that OSLib started out as a spare time project for Jonathan Coxhead (an Acorn employee) which got used within Acorn. When it became public it got shuffled about a bit and there are too many things tied to the internal way to be bothered changing them. It’s also worth noting it’s OSLib 6.90 which isn’t the very latest.
I think the preferred way is to put them in either the ModuleLibs or AppLibs shared makefile as a symbol, that way they can be anywhere you want on your harddisc, any apps needing them to build just indirects via that one. So in terms of OSLib, I think I’d ignore the one ROOL has and use the latest public one, then rename OSLib32 into the APCS-32 directory and OSLib into the APCS-R directory. |