diff options
author | Andreas Färber <afaerber@opensolaris.org> | 2010-01-06 20:24:05 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-01-07 18:08:53 +0000 |
commit | 0e8c9214ba1d4128cf92442cd343bc3733478261 (patch) | |
tree | 8995d2c08ca05c52b7c128c8f397330a52ca6584 /Makefile.target | |
parent | 18cb1d85578e03b16570d9380309cca673f9fff8 (diff) |
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.
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>
Diffstat (limited to 'Makefile.target')
-rw-r--r-- | Makefile.target | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/Makefile.target b/Makefile.target index 7c1f30c1ad..543e8cd28b 100644 --- a/Makefile.target +++ b/Makefile.target @@ -1,17 +1,21 @@ # -*- Mode: makefile -*- -# This needs to be defined before rules.mak GENERATED_HEADERS = config-target.h include ../config-host.mak include config-devices.mak include config-target.mak include $(SRC_PATH)/rules.mak +ifneq ($(HWDIR),) +include $(HWDIR)/config.mak +endif TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H +include $(SRC_PATH)/Makefile.objs + ifdef CONFIG_USER_ONLY # user emulator name QEMU_PROG=qemu-$(TARGET_ARCH2) @@ -64,9 +68,9 @@ libobj-$(CONFIG_S390_DIS) += s390-dis.o libobj-$(CONFIG_SH4_DIS) += sh4-dis.o libobj-$(CONFIG_SPARC_DIS) += sparc-dis.o -# libqemu +$(libobj-y): $(GENERATED_HEADERS) -libqemu.a: $(libobj-y) +# libqemu translate.o: translate.c cpu.h @@ -106,7 +110,10 @@ obj-arm-y += arm-semi.o obj-m68k-y += m68k-sim.o m68k-semi.o -ARLIBS=../libuser/libuser.a libqemu.a +$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) + +obj-y += $(addprefix ../libuser/, $(user-obj-y)) +obj-y += $(libobj-y) endif #CONFIG_LINUX_USER @@ -128,7 +135,10 @@ obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \ obj-i386-y += ioport-user.o -ARLIBS=../libuser/libuser.a libqemu.a +$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) + +obj-y += $(addprefix ../libuser/, $(user-obj-y)) +obj-y += $(libobj-y) endif #CONFIG_DARWIN_USER @@ -145,7 +155,10 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ obj-i386-y += ioport-user.o -ARLIBS=../libuser/libuser.a libqemu.a +$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) + +obj-y += $(addprefix ../libuser/, $(user-obj-y)) +obj-y += $(libobj-y) endif #CONFIG_BSD_USER @@ -303,13 +316,17 @@ vl.o: qemu-options.h monitor.o: qemu-monitor.h -ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) +$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) + +obj-y += $(addprefix ../, $(common-obj-y)) +obj-y += $(libobj-y) +obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) endif # CONFIG_SOFTMMU obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o -$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS) +$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) |