emulator: enhance Makefile for standalone executables 21/25321/3
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Sun, 3 Aug 2014 07:51:09 +0000 (16:51 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 7 Aug 2014 05:42:45 +0000 (22:42 -0700)
Build targets only if source files are modified.
Clean-up CFLAGS, LDFLAGS for standalone executalbes.

Change-Id: I139e3b8b0f9f6983d1a2f3388ad0ec00be63cb00
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
(cherry picked from commit 8f727ce7ce6dbc22e3fabf181495d692bdb7e3ea)

.gitignore
Makefile.target
configure
tizen/emulator_configure.sh
tizen/src/Makefile
tizen/src/hw/pci/Makefile.objs
tizen/src/tethering/Makefile.objs

index a39c2e0..b256258 100644 (file)
@@ -129,6 +129,10 @@ tizen/src/skin/client/native_src/*.dynlib
 fsdev/virtfs-proxy-helper
 .cproject
 .project
-tizen/src/util/check-hax
-tizen/src/util/check-cam
+check-hax
+check-hax.exe
+check-cam
+check-cam.exe
+check-gl
+check-gl.exe
 
index 5d3bb3f..ce58578 100644 (file)
@@ -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)$@")
 
index 04aa43f..fc5ec5e 100755 (executable)
--- a/configure
+++ b/configure
@@ -320,11 +320,11 @@ coroutine=""
 coroutine_pool=""
 seccomp=""
 
-# for TIZEN-maru 
+# for TIZEN-maru
 maru="no"
 shm="no"
 libav="no"
-png="no"
+libpng="no"
 #
 glusterfs=""
 glusterfs_discard="no"
@@ -1101,7 +1101,7 @@ for opt do
   ;;
   --enable-libav) libav="yes"
   ;;
-  --enable-png) png="yes"
+  --enable-libpng) libpng="yes"
   ;;
 #
   --disable-glusterfs) glusterfs="no"
@@ -1417,7 +1417,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
@@ -3990,7 +3990,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
@@ -4035,22 +4034,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
 
@@ -4352,7 +4350,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
@@ -4841,9 +4839,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?
index 44e80f3..e8730a3 100755 (executable)
@@ -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
index f0a4cd5..bbe74cf 100644 (file)
@@ -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
index 7d142a3..615bb1d 100644 (file)
@@ -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)
index e18d263..9aa4799 100644 (file)
@@ -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)