From 0e8c9214ba1d4128cf92442cd343bc3733478261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 6 Jan 2010 20:24:05 +0100 Subject: Drop --whole-archive and static libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: Blue Swirl Cc: Palle Lyckegaard Cc: Ben Taylor Cc: Juan Quintela Cc: Kirill A. Shutemov Cc: Paolo Bonzini Signed-off-by: Blue Swirl --- Makefile.target | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'Makefile.target') diff --git a/Makefile.target b/Makefile.target index 7c1f30c..543e8cd 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)) -- cgit v1.1