Does scons support to build a target without building its dependency? - scons

In SConstruct or SConscript, we can specify the dependency information, I just wish to know if scons has an extra option that doesn't build dependent modules? (Ignore dependency information for a target)
E.g.(from bdbaddog) a depends on b, b depends on c.
Case 1: I want to build a without scons rebuilding b or c if they need it. How to do this?
Case 2: I want to build b and not rebuild a. In this case, how to specify building b on the command line, or just have a never update if b updates?

Related

When "p4 copy -f" helps a lot?

The manual says that -f means
Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they
do not exist in the target, and files that are already identical are
copied if they are not connected by existing integration records.
Honestly, I don't quite understand when p4 copy -f can be very useful.
Could someone please show me some simple examples of the use cases of p4 copy -f?
Thank you.
If you’ve never encountered a situation where p4 copy -f seems like it might be useful, count yourself lucky and forget about it; there are a number of options in Perforce that are only ever useful if you’ve already dug yourself a hole and are determined to keep digging, and this is one of them.
That said, the classic case is:
Add foo in A.
Branch A to B.
Delete foo in B.
Branch B to C.
Merge C to A.
If foo never existed in C, it will not be included in a merge from C, so the change from step 3 is “lost” during the merge in step 5. Using p4 copy -f in step 4 prevents this by creating a dummy file in C that can propagate the delete to A.
Note that reparenting branches like this (going from A to B to C to A, rather than going from A to B to A) is not typically recommended as a best practice because it makes merging much more complicated in general.

Compile part of all dependencies as shared libraries

Say I got (regular source) libraries A and B and executable E which depends on both.
Now, I want E to include the object files of A directly, whereas B should be added as a shared library (concrete use: B contains shared types of a plugin architecture). How would I do that with existing tools, preferably stack?
Is that possible or is it rather an all-or-nothing choice (use only shared libraries or link everything into the same binary)?
Optimally, I'd like to specify for each dependency if it should be linked statically or dynamically. Also, that should probably go into the .cabal file, but we have to work with what we got...
(Well, technically that's both statically linked, but in the second case the object code is split up in different files, you get the idea).

Building a dependency graph in real time

A component of my system basically needs to build a dependency graph based on user input; there's gotta be a common way / library for doing this, I'm just unable to determine what it is. Example below (names / classes changed to protect the innocent):
User asks if a recipe has a cherry flavor, a potato flavor, and / or a mint flavor. We have various paths for the dependencies of each flavor (cherry goes recipeID -> A -> B -> C -> true/false, mint goes recipeID -> A -> D -> true/false etc). The idea is that whatever data source is called in A should only be called once. For simple cases, it's easy to come up with a solution, but as things get added like multiple inputs for a step (e.g. a diamond dependency) or needing to do batch calls (recipeID 1 for cherry, recipeID 2 for mint, should make a batch call to A(1,2) ) things get a lot more complicated.

How to check the availability of, and load, dynamic libraries in FORTRAN

I have written a FORTRAN library "B" which, depending on the way it is called, may or may not call routines in another library "C". The intent is for "B" to be used in applications "A".
So far, B and C are compiled as static libraries (.a files).
This means that C.a must be available and linked to when compiling B.a, which is okay.
This also means that C.a must be available when compiling the application A, even if A has no intention of using the functionality in B which depends on C. This is annoying and seems unnecessary, as one has to distribute C.a to users who will never use it.
Ideally I would want to have C as a dynamic/shared library, and in B do some run-time availability-check like this (pseudo-code):
if (requested feature from C)
if (is_available(libC.so))
call routine_from_C()
(Go on...)
else
call Error("You need to install C")
else
(We don't need C. Go on...)
Is something like this possible with FORTRAN on Linux?

differentiation of compiler switches for C and C++ compilation in SCONS

Is there an easy way of this. For various reasons, our build requires us to pass different -D switches to our C++ and C compilations (or bits of the build break). scons seems to be under the impression you'll always use the same switches (there's only CPPDEFS and CPPINCLUDES)
Instead of using the CPPDEFINES construction variable, for which SCons prepends the '-D' in a portable manner, you can put the defines in CFLAGS (c only) and CXXFLAGS (c++ only). You'll have to add the '-D' by hand though.
The CCFLAGS construction variable applies to both c and c++ compilations.
You could also create one environment for C compilations, and another for C++ compilations. Each environment would then have the appropriate flags.

Resources