Commit graph

31 commits

Author SHA1 Message Date
Dominik Riebeling
3ee79724f6 Fix linking with C++ files.
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
2016-12-16 21:50:36 +01:00
Dominik Riebeling
78cb7f0cf0 Support C++ in libtools.make and rewrite dependency handling.
- 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
2016-12-16 19:46:08 +01:00
Dominik Riebeling
6f4beaa52c Don't add LIBSOURCES to SOURCES.
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
2016-12-16 19:46:07 +01:00
Dominik Riebeling
258e4ad850 OS X: detect clang and build for x86 target only.
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
2014-03-20 22:26:24 +01:00
Dominik Riebeling
17a1867c9c Fix rm function on Windows once more.
Windows del doesn't handle a non-existing folder gracefully, so check for
existence first.

Change-Id: I9c401f3f3a3e1e01b80d29e335256fbf3db22d35
2014-01-05 17:08:50 +01:00
Dominik Riebeling
82b30de20f Fix rm function on Windows.
Windows del doesn't handle paths with / as separators, need to convert them
first.

Change-Id: Idb3efa96167aec5666517feabab67385ebd2db1a
2014-01-05 17:05:11 +01:00
Dominik Riebeling
f3a1a33b9f Fix rebuilding of libs on OS X.
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
2014-01-05 16:55:23 +01:00
Dominik Riebeling
17a781d8b2 Move LDOPTS to the end of the linker call.
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
2013-11-12 22:51:59 +01:00
Dominik Riebeling
33bda05469 Treat arch flags separately when building libraries.
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
2013-06-09 19:43:37 +02:00
Dominik Riebeling
e073bc9484 Implement dependency generation in libtools.make.
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
2013-05-11 20:34:12 +02:00
Dominik Riebeling
4f3fa9accb Change mkdir -p to work on Windows.
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
2013-05-11 20:34:12 +02:00
Dominik Riebeling
8a4075d454 Make libtools compile rule more generic.
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
2013-05-11 20:34:11 +02:00
Dominik Riebeling
8568a8de13 Set APPVERSION globally for extralibs Makefile.
Make sure its value quotes are properly escaped. Otherwise make on Windows
causes problems. Also, expand CPPDEFINES only once.

Change-Id: I52e91f17626b2596f389811b22abc12d94f721d1
2013-05-10 17:48:01 +02:00
Dominik Riebeling
460e959aa9 Allow overriding make variables via environment variables.
Fixes cross compiling for Rockbox Utility.

Change-Id: I3419cb4c89836ec3bee10072495042b3732fd66b
2013-05-04 21:41:49 +02:00
Dominik Riebeling
703bc407b4 Fix ipodpatcher on OS X.
Fix a typo and update CC handling for OS X.

Change-Id: Icde3cb5956ffe45ee1d610ff34957ed7b17f3f02
2013-04-05 20:03:45 +02:00
Dominik Riebeling
ea0bfe7520 Replace the use of uname to get the build output.
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
2013-04-05 19:49:04 +02:00
Dominik Riebeling
45cda1fdcc Fix version handling for patchers.
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
2013-01-01 15:06:40 +01:00
Frank Gevaerts
9a84bcfe4b Add quotes around APPVERSION to avoid issues when it has spaces.
Change-Id: If281c0e37f56f81cb5dd57e264f82fb32bc08d3b
2012-07-27 14:55:03 +02:00
Dominik Riebeling
308f099874 Move bin2c handling to libtools.make
Change-Id: I60353bb9f9fd2658d66ba7f352e04f7489c7bf5d
2012-04-28 12:05:50 +02:00
Rafaël Carré
db3afb03a2 Make sure we use POSIX/C99 printf() when building for windows
Change-Id: I429ed40dc2b9d4fb238762113bd40936df896df0
Reviewed-on: http://gerrit.rockbox.org/85
Reviewed-by: Dominik Riebeling <Dominik.Riebeling@gmail.com>
2012-02-05 20:36:31 +01:00
Dominik Riebeling
ded02d82e7 Remove OS X special universal binary handling.
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
2012-01-06 09:24:38 +00:00
Dominik Riebeling
c6dcec4e0d Update OS X library building.
- 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
2012-01-05 22:26:08 +00:00
Dominik Riebeling
1f0e653038 Fix cross compiling on OS X.
- 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
2012-01-02 17:45:16 +00:00
Dominik Riebeling
8c6c6a6b20 libtools.make: allow overriding variables via environment.
Simplify a bit while at it as well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31523 a1c6a512-1295-4272-9138-f99709370657
2012-01-02 16:59:22 +00:00
Dominik Riebeling
84205025c7 libtools.make: add rule to build a DLL.
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
2011-12-16 21:10:29 +00:00
Dominik Riebeling
6c6123143f ipodpatcher: move linker only options out of CFLAGS.
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
2011-12-16 20:25:56 +00:00
Dominik Riebeling
98becd2076 mkamsboot: fix building as universal library.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31325 a1c6a512-1295-4272-9138-f99709370657
2011-12-16 18:59:38 +00:00
Dominik Riebeling
b056e027fc ipodpatcher: convert to use libtools.make.
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
2011-12-16 18:35:01 +00:00
Dominik Riebeling
17a0c83482 Break some long lines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31281 a1c6a512-1295-4272-9138-f99709370657
2011-12-15 18:44:57 +00:00
Dominik Riebeling
6b8f0b0267 mkmpioboot: use common Makefile.
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
2011-12-14 22:00:06 +00:00
Dominik Riebeling
b24e562061 Initial common Makefile for Rockbox Utility tools / libs.
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
2011-12-14 21:59:37 +00:00