| Branch: | Revision:

root / rules.mak @ feature-archipelago

History | View | Annotate | Download (8.4 kB)

# Date Author Comment
17969268 02/20/2014 02:14 pm Fam Zheng

rules.mak: introduce DSO rules

Add necessary rules and flags for shared object generation.
The new rules introduced here are:

1) %.o in $(common-obj-m) is compiled to %.o, then linked to

2) in $(common-obj-m) is the placeholder for for pattern...

e26110cf 02/20/2014 02:14 pm Fam Zheng

module: implement module loading

This patch adds loading, stamp checking and initialization of modules.

The init function of dynamic module is no longer directly called as
attribute((constructor)) in static linked version, it is called
only after passed the checking of presense of stamp symbol:...

ba1183da 02/20/2014 02:12 pm Fam Zheng

rules.mak: fix $(obj) to a real relative path includes rule.mak and unnested common-obj-y, then prefix
them with '../', this will ignore object specific QEMU_CFLAGS in subdir

$(obj)/curl.o: QEMU_CFLAGS += $(CURL_CFLAGS)...
5c0d52bc 02/20/2014 02:12 pm Fam Zheng

rules.mak: allow per object cflags and libs

Adds extract-libs in LINK to expand any "per object libs", the syntax to define
such a libs options is like:

foo.o-libs := $(CURL_LIBS)

in block/Makefile.objs.


foo.o-cflags := $(FOO_CFLAGS)...
c3dc9fd5 02/08/2014 04:50 pm Peter Maydell

rules.mak: Support .cc as a C++ source file suffix

The A64 disassembler libvixl uses .cc as its suffix for
C++ source files, so add support for it (we already support

Signed-off-by: Peter Maydell <>
Reviewed-by: Richard Henderson <>

3144f78b 02/08/2014 04:50 pm Peter Maydell

rules.mak: Link with C++ if we have a C++ compiler

If we have a C++ compiler available, link with it, because we might be
linking some C++ files in. This allows us to include C++ object files
in the QEMU binary proper.

Signed-off-by: Peter Maydell <>...

837a2e26 10/16/2013 07:21 pm Peter Maydell

rules.mak: New logical functions for handling y/n values

Add new logical functions for handling y/n values like those we
use in CONFIG_FOO variables:
lnot : logical NOT
land : logical AND
lor : logical OR
lxor : logical XOR
leqv : logical equality, inverse of lxor...

9ef622e3 10/16/2013 07:21 pm Peter Maydell

rules.mak: New string testing functions

Add new string testing functions which return a y/n result:
eq : are two strings equal (ignoring leading/trailing space)?
ne : are two strings unequal?
isempty : is a string empty?
notempty : is a string non-empty?...

83f73fce 09/09/2013 10:17 pm Tomoki Sekiyama

configure: Support configuring C++ compiler

Add configuration for C++ compiler in configure and Makefiles.
The C++ compiler is choosed as following:
- ${CXX}, if it is specified.
- ${cross_prefix}g++, if ${cross_prefix} is specified.
- Otherwise, c++ is used....

fba90ac1 05/03/2013 08:04 pm Paolo Bonzini

win32: fix compilation again

While commit c02817e5bfbb27955cac970019e6670dc427bc41 fixed compilation
without an installed libtool, moving the dependencies to rules.mak does
not work because the version-*-y variables are not defined yet. Building
in a clean tree thus fails....

7e7da8e3 04/30/2013 05:52 pm Dunrong Huang Fix build breakage

The following error occurs when building dtc module:

CHK version_gen.h
CC libfdt/fdt.o
cc1: error: dtc: No such file or directory [-Werror]
cc1: all warnings being treated as errors
make[1]: *** [libfdt/fdt.o] Error 1...
c02817e5 04/27/2013 01:28 am Paolo Bonzini

win32: move Makefile dependencies on version-obj-y to rules.mak

This makes the test on $(LIBTOOL) work. Otherwise, LIBTOOL
is /bin/false by the time the test is done.

Fixes Win32 compilation without a working cross-libtool.

Signed-off-by: Paolo Bonzini <>

6821cdc7 04/27/2013 01:28 am Paolo Bonzini

win32: add generic RC rules to rules.mak

Signed-off-by: Paolo Bonzini <>

5354e4d2 04/24/2013 11:47 am Marc-André Lureau

libcacard: fix mingw64 cross-compilation

Compile and link with version.lo

Signed-off-by: Marc-André Lureau <>
Reviewed-by: Alon Levy <>

37746c5e 04/24/2013 11:47 am Marc-André Lureau

build-sys: must link with -fstack-protector

It is needed to give that flag to the linker as well, but latest
libtool 2.4.2 still swallows that argument, so let's pass it with
libtool -Wc argument.

qemu-1.4.0/stubs/arch-query-cpu-def.c:6: undefined reference to `__stack_chk_guard'...

4b25966a 01/30/2013 01:31 am Michael S. Tsirkin

rules.mak: cleanup config generation rules

This addresses two issues with config generation
1. rule generating timestamp has side effect.
Thus cleanup on error does not work.
2. rule for handling timestamp is too generic.
It can create any missing .h file....

7586317b 01/30/2013 01:31 am Michael S. Tsirkin

rules/mak: make clean should blow away timestamp files

Using a global pattern makes it easier to clean out
old generated files.

Signed-off-by: Michael S. Tsirkin <>

bf0842b7 01/12/2013 07:42 pm Paolo Bonzini

build: move version-obj-y to the generic LINK rule

There is no reason for it to be in block-obj-y, in particular.

Signed-off-by: Paolo Bonzini <>

b6fc675b 01/12/2013 06:19 pm Paolo Bonzini

libcacard: require libtool to build it

Do not fail at build time, instead just disable the library if libtool
is not present.

Signed-off-by: Paolo Bonzini <>

21655882 01/12/2013 06:19 pm Paolo Bonzini

build: support linking with libtool objects/libraries

This patch moves the complication of using libtool to the generic
rules.mak file.

Signed-off-by: Paolo Bonzini <>

2c13ec50 01/12/2013 06:19 pm Paolo Bonzini

build: move dtrace rules to rules.mak

Signed-off-by: Paolo Bonzini <>

f141ccfa 01/12/2013 06:19 pm Paolo Bonzini

build: make libtool verbose when making with V=1

Signed-off-by: Paolo Bonzini <>

3dd46c78 01/12/2013 02:40 pm Blue Swirl

optionrom: build with discrete CPP and AS steps

Build option ROM .S files with separate preprocessor and
assembler steps because the C compiler could be unsuitable.

Signed-off-by: Blue Swirl <>

9d9199a0 12/19/2012 09:29 am Paolo Bonzini

build: adjust setting of QEMU_INCLUDES

Make it correct for nested directories, and move the static part
from Makefile to configure.

Signed-off-by: Paolo Bonzini <>

4e8cb28c 12/19/2012 09:29 am Paolo Bonzini

build: add $(TARGET_DIR) to "GEN config-target.h" lines

Signed-off-by: Paolo Bonzini <>

3bc2f570 11/18/2012 09:19 pm Paolo Bonzini

build: replace weak symbols with a static library

Weak symbols were a nice idea, but they turned out not to be a good one.
Toolchain support is just too sparse, in particular llvm-gcc is totally

This patch uses a surprisingly low-tech approach: a static library....

3c4a4d0d 08/16/2012 09:41 pm Peter Maydell

Support using a different compiler for Objective-C files

MacOSX 10.8 ("Mountain Lion") requires us to compile our one
Objective-C source file with clang even if the rest of QEMU
requires a real gcc, because the system headers we use make
use of Apple's "Blocks" extension to C/ObjC, and mainline...

1435ddb8 07/28/2012 12:16 pm Paolo Bonzini

build: get dependency file directories from object file names

After commit dcff25f2cd8c11a9368cc2369aeb0319c32d9e26, Dependency file
are taken from the directories that have a Makefile.objs file. This is
not enough, since files can be included from other directories....

dcff25f2 06/19/2012 09:32 pm Anthony Liguori

make: automatically include dependencies in recursive subdir rules (v2)

I think I understand enough of what's going on in these rules to ensure this is
right. But I could certainly use a second or third opinion...

Signed-off-by: Anthony Liguori <>

2dee8d54 06/07/2012 10:21 am Paolo Bonzini

build: do not create directories at configure time

Signed-off-by: Paolo Bonzini <>

e05804ee 06/07/2012 08:17 am Paolo Bonzini

build: add rules for nesting

This adds the 'magic' rules that take care of subdirectories.
The subdirectory makefiles in the source tree are not complete; they
only define some variables (listed in nested-vars) according to the

The magic rules descend into subdirectory makefiles and gather the...

c0424934 04/25/2012 04:21 pm Lluís Vilanova

Beautify makefile commands for generation of files with tracetool

Signed-off-by: Lluís Vilanova <>
Signed-off-by: Stefan Hajnoczi <>

b93b63f5 03/30/2012 04:14 pm Paolo Bonzini

test makefile overhaul

This introduces new test reporting infrastructure based on
gtester and gtester-report.

Also, all existing tests are moved to tests/, and tests/Makefile
is reorganized to factor out the commonalities in the rules.

Signed-off-by: Anthony Liguori <>...

e2a99ad3 09/01/2011 09:12 pm Stefan Hajnoczi

build: sort objects to remove duplicates for link

Avoid duplicate object files during the link. There are legitimate
cases where a link command-line would include duplicate object files
because two independent subsystems both depend on common infrastructure....

3f534581 08/22/2011 06:20 pm Brad

Improvements to libtool support.

Improvements to the libtool support in QEMU. Replace hard coded
libtool in the infrastructure with $(LIBTOOL) and allow
overriding the libtool binary used via the configure

Reviewed-by: Andreas F=E4rber <>...

76dc3cf8 08/12/2011 04:31 pm Jiri Denemark


This patch fixes build when any of the include paths from QEMU_CFLAGS
contains a header file with similar name to a header file in qemu
sources. I hit it with error.h included by qapi/qapi-types-core.h. GCC
decided to use /usr/include/alsa/error.h instead of qemu's error.h....

44dc0ca3 06/14/2011 05:34 pm Alon Levy

libcacard: add target

No flag to configure is required. Instead, added a target that
is not built by default, only when requested explicitly via:

mkdir build
cd build
make install-libcacard

Uses libtool to do actual linking of object files and shared library, and...

4c3b5a48 01/20/2011 10:54 pm Blue Swirl

Add scripts directory

Move build and user scripts into scripts directory.

Signed-off-by: Blue Swirl <>

f9728943 01/14/2011 06:11 pm Paolo Bonzini

do not pass bogus $(SRC_PATH) include paths to cc during configure

Non-existent -I paths are dropped silently by the compiler, but still
it is not polite to pass bogus options. Configure-time tests do not
need any include files from the source path, so only include -I flags...

2b2e59e6 10/23/2010 05:47 pm Paolo Bonzini

rewrite i386 tests Makefile

1) compute path to i386 compiler from configure. If it is found, run
the i386 tests. I use macros so that this approach could be applied
for other arches as well.

2) provide an easily extensible way to add tests

Most tests fail, but at least "make test" does something meaningful....

a71cd2a5 05/22/2010 11:31 am Jan Kiszka

Put dependency files in proper subdir

This seems to resolve subtle breakages of our build system:

Dependency files generated for targets like 'dir/foo.o' were saved as
'foo.d'. Now, if there was also a target 'foo.o', one of the dependency
file was overwritten. Concrete example: libhw*/macio.o vs....

288e7bcc 05/03/2010 08:39 pm Nathan Froyd

fix whitespace bogon in some versions of make

With three different make binaries I have available, configuring a
pristine QEMU tree and attempting to make gives the cryptic:

Makefile:27: *** missing separator. Stop.

This patch fixes it (presumably because it makes the output of...

59bc10ee 01/09/2010 12:55 am Paolo Bonzini

finish VPATH -> vpath translation

This adds a few more vpath suffixes and points the remaining two paths
explicitly to $(SRC_PATH) in order to eliminate the VPATH assignment
from config-host.mak.

Signed-off-by: Paolo Bonzini <>
Cc: Juan Quintela <>...

076d2471 01/08/2010 05:58 pm Paolo Bonzini

Use vpath directive

The vpath directive has two advantages over the VPATH variable:
1) it allows to skip searching of .o files; 2) the default semantics
are to append to the vpath, so there is no confusion between "VPATH=xyz"
and "VPATH+=xyz".

Since "vpath %.c %.h PATH" is not valid, I'm introducing a wrapper...

0e8c9214 01/07/2010 08:08 pm Andreas Färber

Drop --whole-archive and static libraries

Juan has contributed a cool Makefile infrastructure that enables us to drop
static libraries completely:

Move shared obj-y definitions to Makefile.objs, prefixed {common-,hw-,user-},
and link those object files directly into the executables....

7dbbbb0c 12/08/2009 12:34 am Michael S. Tsirkin

qemu: delete rule target on error

Instruct make to remove any rule target on error. This prevetns
situation where there was an error during build but generated file still
stays behind.

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

7ebf54bc 12/03/2009 11:25 pm Stefan Weil

Fix build for mingw32 on windows ($@ in macro)

Make using mingw32 on windows does not preserve $@ in macros
when they are modified using this pattern:
target: macro += something

This behaviour results in an error when QEMU_CFLAGS containing
"-MMD -MP -MT $@" is modified for compilation of source files...

3e65aaf5 11/14/2009 10:32 pm malc

Do not execute shell scripts directly

Signed-off-by: malc <>

ef2fad65 11/12/2009 07:23 pm Juan Quintela

fix type in CFLAGS name

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

f527c579 11/12/2009 07:23 pm Juan Quintela

fix parallel build

Based on a ideas of Daniel Jacobowitz + Stefan Weil

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

fa394727 10/30/2009 03:39 pm Peter Hjalmarsson

Add *CFLAGS to LINK in rules.mak

Sometimes when linking with gcc to get a predictable result you are suggested to also apply the compiler flags to the linker command.

For reference, please read:

02d5467e 10/11/2009 04:08 pm malc

Move dependency generation falgs out of configure

Signed-off-by: malc <>

1215c6e7 10/09/2009 05:17 am Juan Quintela

Move generation of config-host.h to Makefile from configure

Use timestamp based appreach to avoid not needed recompilation.
Add it to rules.mak

Many thanks to Paolo Bonzini for helpding the design, and the debug.

Patchworks-ID: 35190
Signed-off-by: Juan Quintela <>...

5ab28867 10/06/2009 10:46 pm Juan Quintela

Don't use implicit rules for Makefile

This remove implicit rules + implicit variables.
Explicit rules like the generation of %.h and %.c from %.hx still works
as expected.

As an added bonus, now the output of make -d is readable.

As another added bonus, time spend on Makefiles is way smaller....

fc3baad7 10/05/2009 05:32 pm Thomas Monjalon

restore CFLAGS check for conflict and fix recursive CFLAGS issue

cc-option uses more make-syntax to replace the shell "if/else".

Issue with recursive += is fixed by doing the first assignment
simply-expanded, as explained in

8a2e6ab5 09/10/2009 01:31 am Juan Quintela

Remove CFLAGS parameter in cc-option

With cc-option we are testing if gcc just accept a particular option, we don't need CFLAGS at all. And this fixes the recursive problem with CFLAGS

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

a558ee17 08/10/2009 09:05 pm Juan Quintela


Now we have to variables: QEMU_CFLAGS: flags without which we can't compile
CFLAGS: "-g -O2"

We can now run:

make CFLAGS="-fbar" foo.o
make CFLAGS="" foo.o
make CFLAGS="-O3" foo.o

And it all should work.

Signed-off-by: Juan Quintela <>...

70071e17 07/27/2009 10:10 pm Juan Quintela

move cc-option definition to rules.mak

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

9c7f170e 06/30/2009 02:10 pm Paul Brook

Remove bogus -Werror

Revert rules.mak changes from aba800a. These should not have been here
to start with.

Signed-off-by: Paul Brook <>

aba800a3 06/24/2009 05:09 pm Michael S. Tsirkin

qemu/virtio: MSI-X support in virtio PCI

This enables actual support for MSI-X in virtio PCI.
First user will be virtio-net.

Signed-off-by: Michael S. Tsirkin <>
Signed-off-by: Anthony Liguori <>

9abbdbfe 05/15/2009 01:03 am Anthony Liguori

Fix build on Solaris and WIN32

Signed-off-by: Anthony Liguori <>

0bfe3ca5 05/14/2009 09:29 pm Anthony Liguori

Constructor support

Allow devices/drivers to register themselves via constructors.
Destructors are not needed (can be registered from a constructor)
and "priority" has been renamed and changed to an enum for clarity.

Signed-off-by: Paul Brook <>...

28c699a2 01/26/2009 07:07 pm aliguori

build system: Further improve quiet mode (Jan Kiszka)

Derived from Stuart Brady's patch: Show the target directory as prefix
to the current module when building in quiet mode. This helps to gain
overview of the current build progress, specifically when running...

b23d3d8f 01/24/2009 05:08 pm aurel32

Reformat quiet build

Indent and align the quiet build messages more like Linux - improves
readability of this great feature even more.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Aurelien Jarno <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

93a0dba7 01/21/2009 08:13 pm aliguori

Consolidate library creation (Avi Kivity)

Put archive utility (ar) invocations into a rule, and have it generate
quiet output by default.

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

4f188f88 01/21/2009 08:13 pm aliguori

Make make output quieter (Avi Kivity)

Spew out less noise when compiling. This helps review make output for
information such as compilation warnings, rather than extra long compiler

The full output can be generated by supplying a 'V=1' parameter to make....

3aa892d7 01/21/2009 08:13 pm aliguori

Consolidate linker rules (Avi Kivity)

Use generic rules where posssible, and a LINK macro where not.

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162

17759187 01/21/2009 08:12 pm aliguori

Introduce rules.mak (Avi Kivity)

Add a file for common makefile rules.

Signed-off-by: Avi Kivity <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn:// c046a42c-6fe2-441c-8c8c-71466251a162