Results 1 to 18 of 18

Thread: How to name makefile in .pro file?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to name makefile in .pro file?

    Quote Originally Posted by miwarre View Post
    This would be sub-optimal; and what is the point of an automated make, if you have to run some (quite important) step manually?
    What is the point of placing intermediate files (such as the Makefile) on a shared remote disk?

    Is there a way to have a REAL out-of-source AND multi-platform build by using .pro settings and without using the Shadow build setting of Qt Creator
    I don't really see a point of doing that in a single directory. But if you insist... Use the -o parameter of qmake and -f parameter of make.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to name makefile in .pro file?

    Quote Originally Posted by wysota View Post
    What is the point of placing intermediate files (such as the Makefile) on a shared remote disk?
    ...
    I don't really see a point of doing that in a single directory. But if you insist... Use the -o parameter of qmake and -f parameter of make.
    Hmmm, am I missing something? It is not me, it is Qt Creator which insists on creating makefile's in the same folder as the .pro's files.

    I tried any combination of .pro settings I could think of and none seems to work:

    Using either MAKEFILE = Makefile_<platform> or QMAKE_MAKEFILE = Makefile_<platform> or both, 6 Makefile's are created in the .pro dir: Makefile, Makefile.Debug, Makefile.Release, Makefile_<platform>, Makefile_<platform>.Debug, Makefile_platform>.Release.

    Using something in the line of [QMAKE_]MAKEFILE = ../build_<platform>/Makefile simply does not work: at some point some of the programmes involved complains about there being no target or no makefile.
    But if you insist... Use the -o parameter of qmake and -f parameter of make.
    Which parameters cannot be places in a .pro file, I assume. They have to be placed in Qt Creator project configuration dialogues (Ctrl-4) whose settings are common across all platforms and we are at square one again...

    Let me re-state my goals once again:

    Thesis: I have one src dir with all the sources and I access this dir from BOTH Windows and Linux Qt;
    Goal 1) I would like no leftover step from the build on one platform to be mistaken for an already performed step by the other platform
    Goal 2) I would like no intermediate file to pollute the src dir
    Goal 3) I would like to work from inside an IDE, Qt Creator being the obvious choice in this case.

    It seems to me a reasonable pretense, isn't it?

    Yours very confused,
    M.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to name makefile in .pro file?

    Quote Originally Posted by miwarre View Post
    Hmmm, am I missing something? It is not me, it is Qt Creator which insists on creating makefile's in the same folder as the .pro's files.
    If you are using a hammer to connect two planks with nails and then you decide to change the nails to screws, why do you keep using the hammer instead of a screwdriver?

    If Qt Creator doesn't work for you then don't use it. Use proper tools for the job.

    Thesis: I have one src dir with all the sources and I access this dir from BOTH Windows and Linux Qt;
    A short and disrupting question: Why?

    Goal 1) I would like no leftover step from the build on one platform to be mistaken for an already performed step by the other platform
    Clean the build directory after switching platforms or use a shadow build.

    Goal 2) I would like no intermediate file to pollute the src dir
    Use shadow build of qmake options for determining where intermediate files should go.

    Goal 3) I would like to work from inside an IDE, Qt Creator being the obvious choice in this case.
    Qt Creator is Open Source. If it doesn't suit your needs, modify it.

    It seems to me a reasonable pretense, isn't it?
    Yeah. I would like Qt Creator to make coffee so that I don't have to go to kitchen in the morning to make one myself (yes - I have a coffee machine and yes - I could bring it to my room. But I love Qt Creator, why didn't the Trolls think of adding coffee making features to it? It's an obvious thing, right?). Isn't it reasonable as well?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to name makefile in .pro file?

    Quote Originally Posted by wysota View Post
    A short and disrupting question: Why?
    Because I want to test and debug the same app (same source code) under BOTH Windows and Linux.
    If you are using a hammer to connect two planks with nails and then you decide to change the nails to screws, why do you keep using the hammer instead of a screwdriver?

    If Qt Creator doesn't work for you then don't use it. Use proper tools for the job.
    And
    Qt Creator is Open Source. If it doesn't suit your needs, modify it.
    You are right and it is definitely possible I will take either (or both) routes. But, if you are at a camp site and your Swiss army knife does 95% of what you need, for the missing 5% would you start by looking better into it to see if there is another blade you didn't notice, maybe asking your friends if they know a trick or two to get the job done with it, or by walking to the nearest town to get a new tool you would have then to learn how to use from scratch?

    Qt Creator does get the great majority of the job done for me and I cannot claim to know everything of it (far from it!), so I started asking for help and suggestions about the few pieces missing (to me). If I sounded rude, this was completely unintentional and I am sorry, but I thought this was the right place where to ask.

    Yeah. I would like Qt Creator to make coffee so that I don't have to go to kitchen in the morning to make one myself (yes - I have a coffee machine and yes - I could bring it to my room. But I love Qt Creator, why didn't the Trolls think of adding coffee making features to it? It's an obvious thing, right?). Isn't it reasonable as well?
    You are right, so you may start coding coffee making features into it, can't you? It is open source after all...

    M.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to name makefile in .pro file?

    Quote Originally Posted by miwarre View Post
    Because I want to test and debug the same app (same source code) under BOTH Windows and Linux.
    But why do you want them to overwrite the same files? Is it that hard to call "make -f Makefile.windows" and "make -f Makefile.linux"? instead of just "make"? You can even make a script that will automatically call the right file...

    You are right and it is definitely possible I will take either (or both) routes. But, if you are at a camp site and your Swiss army knife does 95% of what you need, for the missing 5% would you start by looking better into it to see if there is another blade you didn't notice, maybe asking your friends if they know a trick or two to get the job done with it, or by walking to the nearest town to get a new tool you would have then to learn how to use from scratch?
    If I knew I have other tools I knew were suited better for the job in my other pocket I would ignore the knife and use the other tool.

    Qt Creator does get the great majority of the job done for me and I cannot claim to know everything of it (far from it!), so I started asking for help and suggestions about the few pieces missing (to me). If I sounded rude, this was completely unintentional and I am sorry, but I thought this was the right place where to ask.
    Qt Creator (or any other IDE) is not a panaceum, it's a tool. There is another tool called "make" (which is by the way used by Creator). Just use it properly.

    You are right, so you may start coding coffee making features into it, can't you? It is open source after all...
    That's the whole point: I already have a coffee machine, I don't need Creator to be one.

    And please tell me why do you insist on testing/debugging in the same directory on all platforms. I simply can't understand that, it's completely impractical.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Jul 2009
    Location
    Italy, Pieve Ligure (GE)
    Posts
    55
    Thanks
    7
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to name makefile in .pro file?

    OK, I'm suspecting this topic is starting to stink as the proverbial three-days-old fish. But I'm also suspecting there is something I can learn, as you seem so sure:
    Quote Originally Posted by wysota View Post
    And please tell me why do you insist on testing/debugging in the same directory on all platforms. I simply can't understand that, it's completely impractical.
    Of course it is! And it is not what I want to do. This is what I am (actually was: see below) trying to reach:

    1) a directory with the sources of a project; I can access (for coding and compiling) this directory both through Win and through Linux. Let's call it "src".

    2) a directory with the results (intermediate and final) of compilation under Win, let's call it "build_win".

    3) a directory with the results (intermediate and final) of compilation under Linux, let's call it "build_linux".

    1) is already set up.
    2) is easy to achieve, in itself, using Qt Creator shadow build setting under Win.
    3) is also easy to achieve in itself using the same setting under Linux.

    I do not really care where "build_win" and "build_linux" are as far as they are separate from each other and from "src".

    So, I'm very near to the goal: all the pieces are there. The only problem is that 2) and 3) cannot co-exist!

    If I sets Qt Creator shadow build under Win to, say, "E:\Dev\MyProject\build_win", when I load the project under Linux, the setting is carried over and would point to an illegal directory name. And vice-versa.

    I tried a number of combinations of settings in the .pro itself and none was successful because, as DigiDrag remarked at the beginning of this topic, at least the makefile is still placed in the src directory and it is not cleaned by clean. So that the second platform I build under will find an inappropriate makefile.

    But you were right about looking for other tools: I probably reached (a decent approximation of) my goal by using svn: a local repository (which I already have anyway) accessed by two separate working copies under the two OS'es. Not as elegant, but clean, simple and safe enough.

    Thanks,

    M.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to name makefile in .pro file?

    Eeeeh....
    bash Code:
    1. mkdir src
    2. cd src
    3. svn co ... .
    4. ln -s myproject.pro myproject_lin.pro # -s is optional
    5. cp myproject.pro.user myproject_lin.pro.user
    To copy to clipboard, switch view to plain text mode 
    Now open myproject.pro from Windows and myproject_lin.pro from Linux. And I don't care that FAT/NTFS doesn't support links - use another filesystem.

    Or of course:
    bash Code:
    1. cd build-lin
    2. qmake ../src/myproject.pro
    To copy to clipboard, switch view to plain text mode 

    Or:
    qmake Code:
    1. DEPENDPATH += src
    2. INCLUDEPATH += src
    3. win32 {
    4. DESTDIR = build-win
    5. UI_DIR = build-win/ui
    6. OBJECTS_DIR = build-win/obj
    7. MOC_DIR = build-win/moc
    8. }
    9. unix {
    10. DESTDIR = build-lin
    11. UI_DIR = build-lin/.ui
    12. OBJECTS_DIR = build-lin/.obj
    13. MOC_DIR = build-lin/.moc
    14. }
    To copy to clipboard, switch view to plain text mode 

    But what do I know...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Sep 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to name makefile in .pro file?

    I just found this thread while searching for why QMAKE_MAKEFILE doesn't work in QtCreator. I also asked the same question in the freenode/#qtcreator irc channel, and after a suggestion received there, sent an email to the qtcreator mailing list:
    http://lists.trolltech.com/pipermail...er/004288.html
    Like I said in the email, I plan to modify the behavior of QtCreator so that it will pay attention to QMAKE_MAKEFILE, unless someone says why that would be a bad idea, or a regular developer beats me to the punch.

    Quote Originally Posted by wysota View Post
    But what do I know...
    wysota, I think your suggestions all would work fine for using qmake and make from the command line, the only issue is that it is difficult to get QtCreator to behave the same way. Your 2nd example, cd'ing to a directory and then invoking qmake, is exactly how I do this when I'm building from the command line (and the only way I did it before QtCreator existed). However, if you try to invoke qtcreator from that subdirectory, you run into problems because QtCreator doesn't seem to care where you invoke it from, it drops generated files in the same directory the .pro file resides in. Like others have said, you can override where all generated files will go using OBJECTS_DIR, DESTDIR, etc., but because QtCreator doesn't use the QMAKE_MAKEFILE variable, you cannot get it to build using the makefile you specify, even though it creates them as you specify.

    - Miles

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to name makefile in .pro file?

    You have strange problems people... Seems that Qt tools like me more than you because I don't have problems with placing all the files wherever I want them to be.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 28th June 2009, 12:39
  2. pass code from .pro file through to Makefile in qmake?
    By rholsen in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2008, 18:51
  3. Replies: 3
    Last Post: 6th February 2008, 12:53
  4. Replies: 2
    Last Post: 8th November 2007, 20:15
  5. Can I use the Sql Module without chanage .pro file?
    By fengtian.we in forum Qt Programming
    Replies: 9
    Last Post: 21st May 2007, 10:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.