-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build vs. target targets #25
Comments
Hello again :) In general there should be no problem with cross-compilation (this was my initial use case) however so far I had no case where in the same tree I would have tools (meant to be used for "build" machine and during build) and code (meant to be cross-compiled to target machine). But let's try to think it over together. Case A. I can't speculate much for your case B since I don't know your However I can show you how I just solved/worked around (you choose :)) your need. I've added couple dummy wrappers (norm-gcc, norm-g++, cross-gcc, cross-g++) which do nothing then just pass arguments to real gcc/g++ (I don't have any cross toolchain ready) so I can see which toolchain is used. In config-default.mk I've changed defaults to "cross-gcc" and "cross-g++" so by default everything is meant for cross compilation. Then I put something like:
This seems to do what you wanted (if I understood your need correctly). It has some drawbacks though - main being the fact that in I'm also not sure what you really expect from case B. I have just build the tool but my suspicion is that it is not needed per se but it is needed to do something (generate, modify ...). If this is so then it would fall under case A - I'd then just give a name/alias to this tool in its Rules.mk and refer to it whenever I need to use it. Let me know what you think. |
Thanks. I'll start by commenting on case A first in case I don't get to B tonight. It does appear to work as expected, yes, but you're correct about generated.c not working in Some modified output, although this one with a generated header:
|
Before I get to case B, some notes on the makefile modifications I've made so far:
Additional variables/defines (I took a lazy copy & paste approach for now) in skel.mk:
...in def_rules.mk:
...in footer.mk:
...in header.mk, BUILD_TARGETS is cleared. I believe that's it. |
On to case B (though I should have stopped for tonight by now). I just discovered two odd things. My B is actually a blend of A and B, with a First. I have:
Apparently this works because I do not use a wildcard in Second: If I add As with what you mention about the paths, the The thing that puzzles me is that I have to add Ah ha. OK. Now it doesn't puzzle me. It's because if In
The output path for the object files is still |
For now, I did end up adding Not the most elegant thing having duplicated so much to do this. I'll have to think about possible refinements later. One I have done was to make |
Working well enough for me, so I'll close this. I'll have to polish it up into a form I can share in my fork in case it's useful for anyone. |
Sorry for not getting back but I'm overloaded with my daily tasks. If I'll get some spare time I'll try to think about this more (as a challenge - I don't predict myself having such a need :)). Best regards |
Thanks. :) |
I've extrapolated the terminology in gcc's configure options to mean that when I'm building my software, build is the machine I'm building on and target is the machine the software will run on.
I'm running up against a problem when target is a different architecture than build. Have you come across anything like this, or thought about it?
There are several build tools mixed into my code base. For now, I've defined a set of
BUILD_xx
variables as well as aBUILD_TARGETS
equivalent ofTARGETS
andOBJPATH_BUILD
forOBJPATH
(should beBUILD_OBJPATH
, I guess).In footer.mk, just above the
CLEAN_$(d) :=
assignment, I've got:This generally works when I have something like:
However, when a subdirectory contains only a
BUILD_TARGETS
entry and noTARGETS
,SRCS
unsurprisingly does not work well:If machine is ARM and build is amd64,
tool
'sOBJS
will be built for ARM, but an amd64 linker will be used to try to createtool
.Some thoughts I've had, but not experimented with:
$(tool)_SRCS
and$(tool)_OBJS_$(d)
BUILD_SRCS
andBUILD_OBJS_$(d)
TARGETS
and there areBUILD_TARGETS
, assumeSRCS
are meant to be used forBUILD_TARGETS
. (Not so nice if this is more like the first case, but instead of building a daemon, we simply want to compile all the .c files in the current directory for use by some target in the parent directory.)Any other suggestions or different insight into how to solve the problem?
(Edited to correct OBJDIR to OBJPATH.)
The text was updated successfully, but these errors were encountered: