aboutsummaryrefslogtreecommitdiff
path: root/rules.mak
AgeCommit message (Collapse)Author
2012-11-18build: replace weak symbols with a static libraryPaolo Bonzini
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 broken. This patch uses a surprisingly low-tech approach: a static library. Symbols in a static library are always overridden by symbols in an object file. Furthermore, if you place each function in a separate source file, object files for unused functions will not be taken in. This means that each function can use all the dependencies that it needs (especially QAPI stuff such as error_setg). Thus, all stubs are placed in separate object files and put together in a static library. The library then is linked to all programs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-08-16Support using a different compiler for Objective-C filesPeter Maydell
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 gcc doesn't support that. Since we only need to use a true gcc for the parts of QEMU that use the fixed-register env variable, we can simply use clang to build the ObjC file: it will link to the gcc-built objects with no problems. Add the necessary support for an OBJCC variable in the makefile and configure machinery; we default to clang if we have it, otherwise whatever CC is (since gcc might be the Apple gcc which does support Blocks). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-07-28build: get dependency file directories from object file namesPaolo Bonzini
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. So, pick them from directories that have an object file in them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-19make: automatically include dependencies in recursive subdir rules (v2)Anthony Liguori
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 <aliguori@us.ibm.com>
2012-06-07build: do not create directories at configure timePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07build: add rules for nestingPaolo Bonzini
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 configuration. The magic rules descend into subdirectory makefiles and gather the evaluated values of those variables. The values from all subdirectories are joined together, each prefixed with the subdirectory name, and used by the "real" makefiles. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-04-25Beautify makefile commands for generation of files with tracetoolLluís Vilanova
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-30test makefile overhaulPaolo Bonzini
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 <aliguori@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-01build: sort objects to remove duplicates for linkStefan Hajnoczi
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. Use GNU make's $(sort) function to remove duplicate object files from the link command-line. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22Improvements to libtool support.Brad
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 script. Reviewed-by: Andreas F=E4rber <andreas.faerber@web.de> Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-12build: Move QEMU_INCLUDES before QEMU_CFLAGSJiri 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. Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-14libcacard: add libcacard.la targetAlon Levy
No flag to configure is required. Instead, added a libcacard.la target that is not built by default, only when requested explicitly via: mkdir build cd build ../configure make libcacard.la make install-libcacard Uses libtool to do actual linking of object files and shared library, and installing. Tested only under linux, but supposed to work on other systems as well. If libtool isn't found you get a message complaining about that, only at build time (since it is not a default target I did not add a message at configure time). New build artifacts: .libs subdirectories (at <buildroot> and <buildroot>/libcacard) *.lo files (at same locations as the respective o files) Added %.lo : %.c rule that uses libtool. Updated clean rule to clean up those artifacts. Added specific rule to call dtrace with libtool wrapper (note that because of a current upstream dtrace bug fixed by systemtap b1568fd85 commit the -fPIC flag isn't actually passed on. still current dtrace+libtool produced object links fine). If libtool is missing any of the following targets will complain and exit 1: any subdir: *.lo root and libcacard: libcacard.la, libcacard-instsall Tested to link and load with all tracing backends.
2011-01-20Add scripts directoryBlue Swirl
Move build and user scripts into scripts directory. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-14do not pass bogus $(SRC_PATH) include paths to cc during configurePaolo Bonzini
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 at make time (when they're properly expanded). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-23rewrite i386 tests MakefilePaolo Bonzini
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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-22Put dependency files in proper subdirJan Kiszka
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. libhw*/ide/macio.o. And this often left a segfaulting build result behind when changing the "wrong" data structures". Fix it by generating proper 'dir/foo.d'. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-03fix whitespace bogon in some versions of makeNathan Froyd
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 `set-vpath' be an empty string, rather than a bit of whitespace), but I don't understand why this hasn't been a problem for other folks before. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-08finish VPATH -> vpath translationPaolo Bonzini
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 <pbonzini@redhat.com> Cc: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-08Use vpath directivePaolo Bonzini
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 macro to append one or more directories to the vpath. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-07Drop --whole-archive and static librariesAndreas Färber
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. Replace HWLIB by HWDIR, specifying only the directory. Drop --whole-archive and ARLIBS in Makefiles and configure. Drop GENERATED_HEADERS dependency in rules.mak, since this rebuilds all common objects after generating a target-specific header; add dependency rules to Makefile and Makefile.target instead. v2: - Don't try to include /config.mak for user emulators - Changes to user object paths ("Quickfix for libuser.a drop") were obsoleted by "user_only: compile everything with -fpie" (Kirill A. Shutemov) v3: - Fix dependency modelling for tools - Remove comment on GENERATED_HEADERS obsoleted by this patch Signed-off-by: Andreas Färber <afaerber@opensolaris.org> Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Palle Lyckegaard <palle@lyckegaard.dk> Cc: Ben Taylor <bentaylor.solx86@gmail.com> Cc: Juan Quintela <quintela@trasno.org> Cc: Kirill A. Shutemov <kirill@shutemov.name> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-12-07qemu: delete rule target on errorMichael S. Tsirkin
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 <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03Fix build for mingw32 on windows ($@ in macro)Stefan Weil
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 which use SDL: $@ will expand to nothing, -MT no longer has the correct argument (it will take the next one from the command line) and the build will fail or run with a wrong command line. The problem is fixed by using a new macro QEMU_DGFLAGS which is not modified by a target rule. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-14Do not execute shell scripts directlymalc
Signed-off-by: malc <av1474@comtv.ru>
2009-11-12fix type in CFLAGS nameJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-12fix parallel buildJuan Quintela
Based on a ideas of Daniel Jacobowitz + Stefan Weil Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30Add *CFLAGS to LINK in rules.makPeter Hjalmarsson
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: http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Link-Options.html Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-11Move dependency generation falgs out of configuremalc
Signed-off-by: malc <av1474@comtv.ru>
2009-10-08Move generation of config-host.h to Makefile from configureJuan Quintela
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 <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-06Don't use implicit rules for MakefileJuan Quintela
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. We run make -j3 in a fully compiled tree, and results are: Before: $ time make -j3 real 0m1.225s user 0m1.660s sys 0m0.253s After: $ time make -j3 real 0m0.422s user 0m0.393s sys 0m0.248s Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05restore CFLAGS check for conflict and fix recursive CFLAGS issueThomas Monjalon
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 http://www.gnu.org/software/make/manual/html_node/Appending.html Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-09Remove CFLAGS parameter in cc-optionJuan Quintela
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 <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-08-10Rename CPPFLAGS to QEMU_CFLAGSJuan 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 <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
2009-07-27move cc-option definition to rules.makJuan Quintela
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-30Remove bogus -WerrorPaul Brook
Revert rules.mak changes from aba800a. These should not have been here to start with. Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-24qemu/virtio: MSI-X support in virtio PCIMichael S. Tsirkin
This enables actual support for MSI-X in virtio PCI. First user will be virtio-net. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-14Fix build on Solaris and WIN32Anthony Liguori
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-14Constructor supportAnthony Liguori
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 <paul@codesourcery.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-01-26build system: Further improve quiet mode (Jan Kiszka)aliguori
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 parallelized builds. Furthermore, suppress make command echoing when entering subdirs and replace $(subst subdir-,,$@) with $* in the related rule. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6447 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-24Reformat quiet buildaurel32
Indent and align the quiet build messages more like Linux - improves readability of this great feature even more. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6426 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-21Consolidate library creation (Avi Kivity)aliguori
Put archive utility (ar) invocations into a rule, and have it generate quiet output by default. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6381 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-21Make make output quieter (Avi Kivity)aliguori
Spew out less noise when compiling. This helps review make output for information such as compilation warnings, rather than extra long compiler invocations. The full output can be generated by supplying a 'V=1' parameter to make. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6380 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-21Consolidate linker rules (Avi Kivity)aliguori
Use generic rules where posssible, and a LINK macro where not. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6379 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-21Introduce rules.mak (Avi Kivity)aliguori
Add a file for common makefile rules. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6378 c046a42c-6fe2-441c-8c8c-71466251a162