From fa1ca570b0a850789cb2479d80311636d0c06971 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Sun, 3 Aug 2014 16:51:09 +0900 Subject: emulator: enhance Makefile for standalone executables Build targets only if source files are modified. Clean-up CFLAGS, LDFLAGS for standalone executalbes. Change-Id: I139e3b8b0f9f6983d1a2f3388ad0ec00be63cb00 Signed-off-by: SeokYeon Hwang Signed-off-by: Kitae Kim --- .gitignore | 7 ++- Makefile.target | 36 +----------- configure | 36 ++++++------ tizen/emulator_configure.sh | 2 +- tizen/src/Makefile | 116 ++++++++++++++++++++++++-------------- tizen/src/hw/pci/Makefile.objs | 3 + tizen/src/tethering/Makefile.objs | 2 + 7 files changed, 105 insertions(+), 97 deletions(-) diff --git a/.gitignore b/.gitignore index 58f6ce0ab9..4d90dad41a 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,11 @@ fsdev/virtfs-proxy-helper .cproject .project check-hax -check-cam moc_*.cpp qrc_*.cpp +check-hax.exe +check-cam +check-cam.exe +check-gl +check-gl.exe + diff --git a/Makefile.target b/Makefile.target index 5d3bb3fb56..ce58578384 100644 --- a/Makefile.target +++ b/Makefile.target @@ -65,7 +65,7 @@ else stap: endif -all: $(PROGS) stap check-gl +all: $(PROGS) stap # Dummy command so that make thinks it has done something @true @@ -190,40 +190,6 @@ $(QEMU_PROG): $(all-obj-y) ../libqemuutil.a ../libqemustub.a $(call LINK,$^) endif -CHECK_GL_OBJS = check_gl.o check_gl_core.o -CHECK_GL_LDFLAGS = -CHECK_GL_TARGET = -ifdef CONFIG_LINUX -CHECK_GL_OBJS += check_gl_glx.o -#CHECK_GL_LDFLAGS += -lGL -lXcomposite -lXext -lglib-2.0 -# Fix linking error on Ubuntu 13.04 -CHECK_GL_LDFLAGS += -lX11 -lXext -lglib-2.0 -ldl -CHECK_GL_TARGET = check-gl -endif -ifdef CONFIG_WIN32 -CHECK_GL_OBJS += check_gl_wgl.o -CHECK_GL_LDFLAGS += -fstack-protector `pkg-config --libs glib-2.0` -lgdi32 -CHECK_GL_TARGET = check-gl.exe -endif -ifdef CONFIG_DARWIN -CHECK_GL_OBJS += check_gl_cgl.o -CHECK_GL_LDFLAGS += -mmacosx-version-min=10.4 `pkg-config --cflags --libs glib-2.0` -framework OpenGL -CHECK_GL_TARGET = check-gl -endif - -check-gl: $(CHECK_GL_OBJS) - gcc -o $(CHECK_GL_TARGET) $(CHECK_GL_OBJS) $(CHECK_GL_LDFLAGS) -check_gl.o: - gcc -c $(SRC_PATH)/tizen/src/util/check_gl.c -I$(SRC_PATH)/hw/yagl/yagl_inc -check_gl_core.o: - gcc -c $(SRC_PATH)/tizen/src/util/check_gl_core.c -I$(SRC_PATH)/hw/yagl/yagl_inc -check_gl_glx.o: - gcc -c $(SRC_PATH)/tizen/src/util/check_gl_glx.c -I$(SRC_PATH)/hw/yagl/yagl_inc -check_gl_wgl.o: - gcc -c $(SRC_PATH)/tizen/src/util/check_gl_wgl.c -I$(SRC_PATH)/hw/yagl/yagl_inc -check_gl_cgl.o: - gcc -c $(SRC_PATH)/tizen/src/util/check_gl_cgl.c -I$(SRC_PATH)/hw/yagl/yagl_inc - gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@") diff --git a/configure b/configure index 2a6413dd86..2bda3f4e32 100755 --- a/configure +++ b/configure @@ -324,6 +324,7 @@ seccomp="" maru="no" shm="no" libav="no" +libpng="no" # qt="" qtabi="5.0" @@ -1106,8 +1107,7 @@ for opt do ;; --enable-libav) libav="yes" ;; -# - --enable-png) png="yes" + --enable-libpng) libpng="yes" ;; --disable-qt) qt="no" ;; @@ -1428,7 +1428,7 @@ TIZEN-maru options: --enable-maru enable maru board --enable-shm enable shared memory for framebuffer --enable-libav enable libav library - --enable-png enable png library + --enable-libpng enable png library NOTE: The object files are built at the place where configure is launched EOF @@ -4028,7 +4028,6 @@ if test "$libav" != "no"; then libav_cflags=`$pkg_config --cflags $libavcodec_package` libav_libs=`$pkg_config --libs $libavcodec_package` libs_softmmu="$libav_libs $libs_softmmu" - QEMU_CFLAGS="$QEMU_CFLAGS $libav_cflags" libav="yes" else if test "$libav" = "yes" ; then @@ -4073,22 +4072,21 @@ if test "$libav" != "no"; then fi ########################################## -# png probe +# libpng probe -if test "$png" != "no"; then - png_package="libpng" +if test "$libpng" != "no"; then + libpng_package="libpng" - if $pkg_config --exists "$png_package" ; then - png_cflags=`$pkg_config --cflags $png_package` - png_libs=`$pkg_config --libs $png_package` - libs_softmmu="$png_libs $libs_softmmu" - QEMU_CFLAGS="$QEMU_CFLAGS $png_cflags" - png="yes" + if $pkg_config --exists "$libpng_package" ; then + libpng_cflags=`$pkg_config --cflags $libpng_package` + libpng_libs=`$pkg_config --libs $libpng_package` + libs_softmmu="$libpng_libs $libs_softmmu" + libpng="yes" else - if test "$png" = "yes" ; then - feature_not_found "png" + if test "$libpng" = "yes" ; then + feature_not_found "libpng" fi - png="no" + libpng="no" fi fi @@ -4391,7 +4389,7 @@ echo "VIGS support $vigs" echo "TIZEN-maru support $maru" echo "TIZEN-maru shared framebuffer support $shm" echo "TIZEN-maru libav support $libav" -echo "TIZEN-maru png support $png" +echo "TIZEN-maru libpng support $libpng" # if test "$sdl_too_old" = "yes"; then @@ -4884,9 +4882,11 @@ if test "$shm" = "yes" ; then fi if test "$libav" = "yes" ; then echo "CONFIG_LIBAV=y" >> $config_host_mak + echo "LIBAV_CFLAGS=$libav_cflags" >> $config_host_mak fi -if test "$png" = "yes" ; then +if test "$libpng" = "yes" ; then echo "CONFIG_PNG=y" >> $config_host_mak + echo "LIBPNG_CFLAGS=$libpng_cflags" >> $config_host_mak fi # TPM passthrough support? diff --git a/tizen/emulator_configure.sh b/tizen/emulator_configure.sh index 5e416cccd5..fcd6c9bcf6 100755 --- a/tizen/emulator_configure.sh +++ b/tizen/emulator_configure.sh @@ -183,7 +183,7 @@ else fi # append common flags -CONFIGURE_APPEND="--enable-maru --enable-libav --enable-curl --enable-png --disable-gtk $CONFIGURE_APPEND" +CONFIGURE_APPEND="--enable-maru --enable-libav --enable-curl --enable-libpng --disable-gtk $CONFIGURE_APPEND" if [ -z ${PKG_CONFIG_PATH} ] ; then # avoid pkg-config bug on Windows export PKG_CONFIG_PATH=${TIZEN_SDK_DEV_PATH}/distrib/lib/pkgconfig diff --git a/tizen/src/Makefile b/tizen/src/Makefile index f0a4cd57a6..bbe74cf9d8 100644 --- a/tizen/src/Makefile +++ b/tizen/src/Makefile @@ -10,48 +10,78 @@ endif ifneq ($(wildcard ../../config-host.mak),) include ../../config-host.mak -else -config-host.mak: - @echo "Please call configure before running make!" - @exit 1 -endif -ifdef CONFIG_WIN32 -EXECUTABLE_EXTENSION=.exe -else -EXECUTABLE_EXTENSION= +TARGET_EXE += util/check-cam$(EXESUF) +ifdef CONFIG_YAGL +TARGET_EXE += util/check-gl$(EXESUF) +endif +ifndef CONFIG_LINUX +TARGET_EXE += util/check-hax$(EXESUF) endif -all: qemu skin_client -qemu: build_info check_hax check_cam +all: qemu skin_client $(TARGET_EXE) +qemu: $(TARGET_EXE) build_info cd ../../ && $(MAKE) qemu_clean: cd ../../ && $(MAKE) clean - qemu_distclean: cd ../../ && $(MAKE) distclean -check_hax: - @echo "build check hax" +# Building check-gl +CHECK_GL_OBJS = util/check_gl.o util/check_gl_core.o +CHECK_GL_CFLAGS = -c -I$(SRC_PATH)/hw/yagl/yagl_inc +CHECK_GL_LDFLAGS = +CHECK_GL_TARGET = util/check-gl$(EXESUF) +ifdef CONFIG_LINUX +CHECK_GL_OBJS += util/check_gl_glx.o +CHECK_GL_LDFLAGS += -lX11 -lXext -lglib-2.0 -ldl +endif +ifdef CONFIG_WIN32 +CHECK_GL_OBJS += util/check_gl_wgl.o +CHECK_GL_LDFLAGS += -fstack-protector `pkg-config --libs glib-2.0` -lgdi32 +endif +ifdef CONFIG_DARWIN +CHECK_GL_OBJS += util/check_gl_cgl.o +CHECK_GL_LDFLAGS += -mmacosx-version-min=10.4 `pkg-config --cflags --libs glib-2.0` -framework OpenGL +endif + +util/check-gl$(EXESUF): $(CHECK_GL_OBJS) + gcc $(CHECK_GL_OBJS) $(CHECK_GL_LDFLAGS) -o $@ +$(CHECK_GL_OBJS): %.o: %.c + gcc $< $(CHECK_GL_CFLAGS) -o $@ + +# Building check-cam +CHECK_CAM_CFLAGS = -c +ifdef CONFIG_LINUX +CHECK_CAM_LDFLAGS = -lv4l2 -lv4lconvert +endif ifdef CONFIG_WIN32 - $(CC) -o util/check-hax.exe util/check_hax.c +CHECK_CAM_CFLAGS += -I. +CHECK_CAM_LDFLAGS = -lole32 -loleaut32 -luuid -lstrmiids endif ifdef CONFIG_DARWIN - $(CC) -mmacosx-version-min=10.4 -o util/check-hax util/check_hax.c endif -check_cam: - @echo "build check cam" +util/check-cam$(EXESUF): util/check_cam.o + $(CC) $< -o $@ $(CHECK_CAM_LDFLAGS) +util/check_cam.o: %.o: %.c + $(CC) $< -o $@ $(CHECK_CAM_CFLAGS) + +# Building check-hax +CHECK_HAX_CFLAGS = -c ifdef CONFIG_LINUX - $(CC) -o util/check-cam util/check_cam.c -lv4l2 -lv4lconvert endif ifdef CONFIG_WIN32 - $(CC) -o util/check-cam.exe util/check_cam.c -I. -lole32 -loleaut32 -luuid -lstrmiids endif ifdef CONFIG_DARWIN - $(CC) -o util/check-cam util/check_cam.c +CHECK_HAX_CFLAGS += -mmacosx-version-min=10.4 endif +util/check-hax$(EXESUF): util/check_hax.o + $(CC) $< -o $@ +util/check_hax.o: %.o: %.c + $(CC) $< $(CHECK_HAX_CFLAGS) -o $@ +# Building java skin skin_client: ifdef CONFIG_USE_SHM TIZEN_SDK_DEV_PATH=${TIZEN_SDK_DEV_PATH} ant -DdoNotUseSHM=false -buildfile skin/client/build.xml make-jar @@ -73,11 +103,7 @@ build_info: clean: qemu_clean -ifndef CONFIG_LINUX - rm -f util/check-hax$(EXECUTABLE_EXTENSION) util/check-cam$(EXECUTABLE_EXTENSION) -else - rm -f util/check-cam -endif + rm -f util/check-hax$(EXESUF) util/check-cam$(EXESUF) util/check-gl$(EXESUF) distclean: clean qemu_distclean install: all @@ -90,8 +116,8 @@ install: all case "$$target" in \ i386-softmmu) \ mkdir -p $(EMUL_DIR)/data/bios ;\ - echo "Copying i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) to $(EMUL_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION)" ;\ - cp -pP ../../i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION) ;\ + echo "Copying i386-softmmu/qemu-system-i386$(EXESUF) to $(EMUL_DIR)/bin/emulator-x86$(EXESUF)" ;\ + cp -pP ../../i386-softmmu/qemu-system-i386$(EXESUF) $(EMUL_DIR)/bin/emulator-x86$(EXESUF) ;\ echo "Copying bioses to $(EMUL_DIR)/data/bios" ;\ cp -pP ../../pc-bios/bios-256k.bin $(EMUL_DIR)/data/bios ;\ cp -pP ../../pc-bios/linuxboot.bin $(EMUL_DIR)/data/bios ;\ @@ -99,13 +125,13 @@ install: all cp -pP ../../pc-bios/acpi-dsdt.aml $(EMUL_DIR)/data/bios ;\ ;; \ arm-softmmu) \ - echo "Copying arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) to $(EMUL_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION)" ;\ - cp -pP ../../arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION) ;\ + echo "Copying arm-softmmu/qemu-system-arm$(EXESUF) to $(EMUL_DIR)/bin/emulator-arm$(EXESUF)" ;\ + cp -pP ../../arm-softmmu/qemu-system-arm$(EXESUF) $(EMUL_DIR)/bin/emulator-arm$(EXESUF) ;\ ;; \ esac; \ done - cp -pP ../../qemu-img$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin + cp -pP ../../qemu-img$(EXESUF) $(EMUL_DIR)/bin ifndef CONFIG_WIN32 cp -pP scripts/emulator.sh $(EMUL_DIR)/bin @@ -126,8 +152,8 @@ endif endif # check capabilities of OpenGL and Webcam - cp -pP ../../i386-softmmu/check-gl$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin - cp -pP util/check-cam$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin + cp -pP util/check-gl$(EXESUF) $(EMUL_DIR)/bin + cp -pP util/check-cam$(EXESUF) $(EMUL_DIR)/bin # Enable HW Virtualization on Linux ifdef CONFIG_LINUX @@ -137,7 +163,7 @@ endif # check HW Virtualization on Windows and MAC OS X. ifndef CONFIG_LINUX - cp -pP util/check-hax$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin + cp -pP util/check-hax$(EXESUF) $(EMUL_DIR)/bin endif # give a title name for sdb terminal. @@ -214,8 +240,8 @@ install_dibs: all_dibs case "$$target" in \ i386-softmmu) \ mkdir -p $(DIBS_X86_DIR)/data/bios ;\ - echo "Copying i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) to $(DIBS_X86__DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION)" ;\ - cp ../../i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) $(DIBS_X86_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION) ;\ + echo "Copying i386-softmmu/qemu-system-i386$(EXESUF) to $(DIBS_X86__DIR)/bin/emulator-x86$(EXESUF)" ;\ + cp ../../i386-softmmu/qemu-system-i386$(EXESUF) $(DIBS_X86_DIR)/bin/emulator-x86$(EXESUF) ;\ echo "Copying bioses to $(DIBS_X86_DIR)/data/bios" ;\ cp -pP ../../pc-bios/bios-256k.bin $(DIBS_X86_DIR)/data/bios ;\ cp -pP ../../pc-bios/linuxboot.bin $(DIBS_X86_DIR)/data/bios ;\ @@ -223,13 +249,13 @@ install_dibs: all_dibs cp -pP ../../pc-bios/acpi-dsdt.aml $(DIBS_X86_DIR)/data/bios ;\ ;; \ arm-softmmu) \ - echo "Copying arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) to $(DIBS_ARM_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION)" ;\ - cp -pP ../../arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) $(DIBS_ARM_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION) ;\ + echo "Copying arm-softmmu/qemu-system-arm$(EXESUF) to $(DIBS_ARM_DIR)/bin/emulator-arm$(EXESUF)" ;\ + cp -pP ../../arm-softmmu/qemu-system-arm$(EXESUF) $(DIBS_ARM_DIR)/bin/emulator-arm$(EXESUF) ;\ ;; \ esac; \ done - cp -pP ../../qemu-img$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin + cp -pP ../../qemu-img$(EXESUF) $(DIBS_COMMON_DIR)/bin ifndef CONFIG_WIN32 cp -pP scripts/emulator.sh $(DIBS_COMMON_DIR)/bin @@ -248,8 +274,8 @@ endif endif # check capabilities of OpenGL and Webcam - cp -pP ../../i386-softmmu/check-gl$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin - cp -pP util/check-cam$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin + cp -pP util/check-gl$(EXESUF) $(DIBS_COMMON_DIR)/bin + cp -pP util/check-cam$(EXESUF) $(DIBS_COMMON_DIR)/bin # Enable HW Virtualization on Linux @@ -261,7 +287,7 @@ endif # check HW Virtualization on Windows and MAC OS X. ifndef CONFIG_LINUX - cp -pP util/check-hax$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin + cp -pP util/check-hax$(EXESUF) $(DIBS_COMMON_DIR)/bin endif # give a title name for sdb terminal. @@ -313,3 +339,9 @@ ifdef CONFIG_DARWIN esac; \ done endif + +else +all: + @echo "Please call configure before running make!" + @exit 1 +endif diff --git a/tizen/src/hw/pci/Makefile.objs b/tizen/src/hw/pci/Makefile.objs index 7d142a3b8a..615bb1d2a0 100644 --- a/tizen/src/hw/pci/Makefile.objs +++ b/tizen/src/hw/pci/Makefile.objs @@ -17,3 +17,6 @@ LIBS += -framework Foundation -framework SystemConfiguration LIBS += -framework Cocoa -framework QTKit -framework CoreVideo LIBS += -framework AppKit endif + +maru_brill_codec.o-cflags := $(LIBAV_CFLAGS) +#$(obj)/maru_brillcodec.o $(obj)/maru_brillcodec_device.o: QEMU_CFLAGS += $(LIBAV_CFLAGS) diff --git a/tizen/src/tethering/Makefile.objs b/tizen/src/tethering/Makefile.objs index e18d26301e..9aa4799ed4 100644 --- a/tizen/src/tethering/Makefile.objs +++ b/tizen/src/tethering/Makefile.objs @@ -3,3 +3,5 @@ obj-y += common.o obj-y += sensor.o obj-y += touch.o obj-y += encode_fb.o + +encode_fb.o-cflags := $(LIBPNG_CFLAGS) -- cgit v1.2.3