Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make Makefile generate all objects in a specific dir
Forum Updated to NodeBB v4.3 + New Features

How to make Makefile generate all objects in a specific dir

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.2k Views 2 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.
  • A Offline
    A Offline
    Absurd
    wrote on 26 Jan 2019, 17:50 last edited by
    #1

    Hi.
    My project became quite big now, and I am trying to to re-organize all the source files in folders, and to keep the directory clean and organized.
    So, I went from this kind of hier:

    project/file0.cpp
    project/file0.h
    project/file1.cpp
    project/file1.h
    project/file2.cpp
    project/file2.h
    project/Makefile
    

    To this:

    project/folder0/file0.cpp
    project/folder0/file0.h
    project/folder1/file1.cpp
    project/folder1/file1.h
    project/folder1/file2.cpp
    project/folder1/file2.h
    project/Makefile
    

    So I had to re-generate the Makefile using:

    $ qmake-qt4 -project
    $ qmake-qt4 project.pro
    

    Now everything compiles fine, however, all the objects files are automatically generated by Makefile into my main project folder:

    project/folder0/file0.cpp
    project/folder0/file0.h
    project/folder1/file1.cpp
    project/folder1/file1.h
    project/folder1/file2.cpp
    project/folder1/file2.h
    project/Makefile
    file0.o
    file1.o
    file2.o
    project
    

    but I want the objects file to be automatically generated into a designated bin/ directory.
    How do I force qmake-qt4 to generate a Makefile that will put all objects file in a designated directory?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrdebug
      wrote on 26 Jan 2019, 17:57 last edited by
      #2
      • Go to you preferred output folder
      • execute "qmake souce folder"
        the makefile will be created in the folder were you are. After that make -j 4
        or if you have a Ferrari try make -f 1000 :)

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 26 Jan 2019, 17:58 last edited by
        #3

        Hi,

        Rather than forcing the output, you should rather consider out of source builds. This leaves your source tree completely clean and you can simply nuke the build folder in case of trouble.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • A Offline
          A Offline
          Absurd
          wrote on 26 Jan 2019, 18:14 last edited by
          #4

          @mrdebug but then the Makefile will be located at bin/... I want one Makefile at project/ that will put the output in bin/

          @SGaist not sure I understand... what do you mean by "consider out the source builds"?

          M 1 Reply Last reply 26 Jan 2019, 20:40
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 26 Jan 2019, 19:41 last edited by
            #5

            That's build that don't happen in your source folder.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • A Absurd
              26 Jan 2019, 18:14

              @mrdebug but then the Makefile will be located at bin/... I want one Makefile at project/ that will put the output in bin/

              @SGaist not sure I understand... what do you mean by "consider out the source builds"?

              M Offline
              M Offline
              mrdebug
              wrote on 26 Jan 2019, 20:40 last edited by
              #6

              @Absurd said in How to make Makefile generate all objects in a specific dir:

              but then the Makefile will be located at bin/... I want one Makefile at project/ that will put the output in bin/

              Consider that you could have a output folder for amd64 binaries with them makefile, another folder for armhf with another makefile, Android, iOS ... everyone with a specific makefile.

              Need programmers to hire?
              www.labcsp.com
              www.denisgottardello.it
              GMT+1
              Skype: mrdebug

              1 Reply Last reply
              2
              • A Offline
                A Offline
                Absurd
                wrote on 27 Jan 2019, 09:04 last edited by
                #7

                @mrdebug, @SGaist ok, that makes sense...
                Thanks!

                1 Reply Last reply
                0

                1/7

                26 Jan 2019, 17:50

                • Login

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