Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Merging My Standard Makefile with a Qmake-generated Makefile?
Forum Updated to NodeBB v4.3 + New Features

Merging My Standard Makefile with a Qmake-generated Makefile?

Scheduled Pinned Locked Moved Mobile and Embedded
qmakemakefile
5 Posts 3 Posters 2.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jesse James
    wrote on last edited by
    #1

    Right now I have two makefiles, one that I have created myself, the other was generated using qmake. However, I need to leave just one (the one I created manually) and adjust it to use qmake for compiling my source code. Does anybody know how can I do this?

    Here's my Makefile:

    include $(TOPDIR)/rules.mk

    PKG_NAME:=cloud
    PKG_RELEASE:=1

    PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

    include $(INCLUDE_DIR)/package.mk

    define Package/cloud
    SECTION:=Cloud
    CATEGORY:=cloud
    TITLE:=Cloud Package
    DEPENDS:=+qt4 +qt4-gui +qt4-network
    endef

    define Package/cloud/description
    Cloud Package
    endef

    define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./src/* $(PKG_BUILD_DIR)/

    endef

    define Build/Configure
    endef

    define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR)
    CC="$(TARGET_CC)"
    CFLAGS="$(TARGET_CFLAGS) -Wall"
    LDFLAGS="$(TARGET_LDFLAGS)"
    endef

    define Package/cloud/install
    $(INSTALL_DIR) $(1)/usr/sbin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/exec$(1)/usr/sbin/

    endef
    $(eval $(call BuildPackage,cloud))

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can use MAKEFILE to force qmake to use another file name for the generated Makefile, like this (in your .pro file):

      MAKEFILE=Makefile_generated
      

      That can help you in working with your Makefile and the generated one without the danger of overwriting them. Alternatively, you can ditch qmake completely and put all UIC, MOC, RCC and C++ call there. This, however, is tedious and will make the maintenance harder.

      (Z(:^

      1 Reply Last reply
      1
      • J Offline
        J Offline
        Jesse James
        wrote on last edited by
        #3

        What about within the Makefile? Is there a way that I could execute "qmake -makefile" from my Makefile? I think it's possible but I don't know how can I do it syntax-wise.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by sierdzio
          #4

          @Jesse-James said:

          What about within the Makefile? Is there a way that I could execute "qmake -makefile" from my Makefile? I think it's possible but I don't know how can I do it syntax-wise.

          Yes, that is also possible.

          I can't check myself right now, but something like that should work:

          # Call qmake from custom makefile
          qmake MAKEFILE=myTempMakeFile myProFile.pro
          # Build the project
          make -j 8
          # Remove the generated file (if you wish)
          rm myTempMakeFile
          

          You may need to enclose MAKEFILE=myTempMakeFile in quotes, please test. Also, with that kind of stuff you need to be careful and test separately for each platform (especially Windows) as the syntax might be different there.

          (Z(:^

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Violet Giraffe
            wrote last edited by
            #5

            Is there a way to specify a custom Makefile file name inside the .pro file itself, so that it doesn't need to be provided externally on the command line?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved