When linking with C++ files the linker also needs to link against the C++
libraries. This is done automatically when invoking the compiler upon linking.
Since we don't want C++ dependencies on C-only projects we check if we actually
have C++ files and use either the C or C++ compiler.
Rename CFLAGS since it's now used for both C and C++ compiler and add dedicated
CFLAGS, CXXFLAGS and LDFLAGS variables.
Change-Id: I9cc068a8038f21e8fd96b20173a8f790e6ab4b6e
- Change suffix of objects and depencency files to keep the original file
suffix. This makes it easy to distinguish between C and C++ files when
building and avoids implicit make rules trying to build in a way we don't
want to.
- Implicitly handle dependencies instead of having an explicit rule. Simplifies
things a bit.
- Support C++ files by adding an explicit rule for them. With keeping the
original file suffixes this becomes quite simple.
To use C++ files simply add them to SOURCES (or LIBSOURCES).
Change-Id: I22c56a6e153e281cfa675e91ad4a70fd18e2c43c
Split source files for library and stand-alone binary and use library as
dependency when building the stand-alone binary. This avoids dependencies
getting added multiple times.
Remove outdated RBARCH handling, we always create fat binaries on OS X these
days.
Change-Id: Ia15a731296edcbe90869a1bf66dda2c3d6c7e317
Newer versions of Xcode / OS X don't support PPC code anymore and replace gcc
with clang. When clang is detected assume we want to build for the default
architecture only and change the minimum OS X version to 10.5.
Change-Id: I5843fa9bb3d957ec6f0a537e857608ad99c31517
OS X ar operates on fat libaries. In this case updating the library isn't
possible and when those change ar will only return an error. Remove the output
file prior to running ar to work around this limitation.
Change-Id: I7ebc66efd092a8e6037ae86a3658afe6b4da777f
Command line order is important with newer gcc versions. mkzenboot extends
LDOPTS but the linker would ignore that since no object using it has been
mentioned on the command line. Moving it to the end should fix this.
Change-Id: I081e86fa88f95dba6077a50f2b4315bf3a805ae5
On OS X we're passing -arch twice which dependency generation doesn't like.
Since we don't have dependencies that differ between architectures simply don't
add them during dependency generation.
Change-Id: Ie3d58bf9af31edcacb88345c7debf39eb798e302
Automatically generate dependency files for all sources so changes in headers
are picked up automatically. Use one dependency file for each source file,
since that allows to create them without using external tools (except the
compiler of course).
Change-Id: I246c1ceb525692547af22a2e32c4bab0c11507e1
Windows mkdir doesn't know about the -p option and requires paths to use \ as
path separator. Try to detect when building on Windows and use the Windows
internal function instead of relying on a compatible mkdir in the path.
Change-Id: I47d47d45edeb38c672321f77d6e91268bf744dba
Create the object - source dependency internally and use a more generic rule
for compiling. Removes the need for explicit rules for source files located in
a different folder.
This adds the limitation for SOURCES and LIBSOURCES to only hold C files.
Change-Id: I56f6a4b1e7df36347cd2f54051e072251f456092
Make sure its value quotes are properly escaped. Otherwise make on Windows
causes problems. Also, expand CPPDEFINES only once.
Change-Id: I52e91f17626b2596f389811b22abc12d94f721d1
Using uname has a couple of problems, especially when cross compiling. Instead
check the defines set by the preprocessor to figure the type of binaries it
produces. This improves support for cross compiling as it allows to (1) select
the correct default target and (2) makes it possible to use separate build
folders for different targets.
Change-Id: I69a32904dab97755034f2f0d63f8402309d479d2
The working directory will usually be different than the one libtools.make is
located in, so make sure to use the correct starting folder for the relative
path.
Change-Id: I9a84a0573c9f1f32601f31587425689dcf8fb81f
Since the libs are now build as universal libs there is no need anymore to
create separate binaries for both architectures and run lipo on them, just
build in a single run now. Fixes building universal binaries and dmg for all
tools using libtools.make.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31590 a1c6a512-1295-4272-9138-f99709370657
- As done with libucl and librbspeex, create universal libraries using ar
instead of building twice and using lipo. This notably simplifies things.
- Allow overwriting the compiler via command line. This is required for
building on OS X.
- Update Rockbox Utility to the changed library rules. Fixes building which was
broken by the previous Makefile changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31588 a1c6a512-1295-4272-9138-f99709370657
- The OS X specific flags must not be set when cross compiling. Check for a
MinGW compiler on OS X before adding them.
- Do not set CC explicitly in chinachippatcher, it will be set from Rockbox
Utility's Makefile.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31527 a1c6a512-1295-4272-9138-f99709370657
This only works for Windows, so you need to use it on Windows or set CROSS
accordingly.
Update mkamsboot to make mkamsboot.dll build and link against ucl.dll.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31333 a1c6a512-1295-4272-9138-f99709370657
OS X requires some linker-only options. Remove them from CFLAGS to avoid a
compiler warning.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31330 a1c6a512-1295-4272-9138-f99709370657
This allows building libipodpatcher, which will make it possible to stop
building ipodpatcher files in Rockbox Utility directly. Move some OS X common
values to libtools.make as well (might fix building libmkamsboot on OS X).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31324 a1c6a512-1295-4272-9138-f99709370657
Extend common libtools.make with libucl dependency, which will be needed by
other tools as well. Update mkmpioboot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31259 a1c6a512-1295-4272-9138-f99709370657
Introduce a new Makefile holding the common functionality for building tools
used by Rockbox Utility (*patcher / mk*boot). This converts mktccboot to use
the common Makefile.
Also introduces BUILD_DIR variable to control the path used for placing
intermediate objects into. This should avoid filename clashes between different
tools. Filenames are (still) assumed to be unique withing a single tool.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31257 a1c6a512-1295-4272-9138-f99709370657