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
    Sep 2008
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to name makefile in .pro file?

    Hi

    I want to cross-compile a QT project.
    And I am accessing the same project folder from different OS over the network.
    And this leads to a problem:
    All OS are using the same makefile name 'Makefile' and this leads to problems as QT does not re-create that file on the next OS.


    Does anyone know how I can specify the makefile name in the .pro file?


    I want to get something like this:
    mac {
    make_name = Makefile_Mac
    } else:unix {
    make_name = Makefile_Linux
    } else {
    make_name = Makefile_Win
    }


    thanks,
    dd

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

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

    You can set the QMAKE_MAKEFILE variable!

    Qt Code:
    1. mac {
    2. QMAKE_MAKEFILE = Makefile_Mac
    3. } else:unix {
    4. QMAKE_MAKEFILE = Makefile_Linux
    5. } else {
    6. QMAKE_MAKEFILE = Makefile_Win
    7. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by mcosta; 24th July 2009 at 15:21. Reason: Added example
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Sep 2008
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

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

    Hi

    Thanks so far, got half the solution.

    It does not seem to work with the QT Creator.
    It now generates the makefile with a different name, but QT Creator does not start make with the new filename...

    And I cannot define make arguments in the .pro file.
    And the arguments in the QtCreator file are not platform-dependants.
    And I am also not able to use and system-wide variable as make argument in QtCreator as it is not resolved...
    Last edited by DigiDrag; 25th July 2009 at 16:57.

  4. #4
    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?

    Wouldn't it be easier to do shadow builds so that makefiles for each platform end up in different directories? Your problem would vanish instantly.
    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.


  5. #5
    Join Date
    Sep 2008
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

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

    Quote Originally Posted by wysota View Post
    Wouldn't it be easier to do shadow builds so that makefiles for each platform end up in different directories? Your problem would vanish instantly.
    I found the option to enable and change a shadow build directory in the QT Creator.
    But again, this setting is the same on all platforms...

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

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

    Does something like this fly for you?
    Qt Code:
    1. macx {
    2. MOC_DIR = build_mac
    3. OBJECTS_DIR = build_mac
    4. RCC_DIR = build_mac
    5. UI_DIR = build_mac
    6. } else:win32 {
    7. MOC_DIR = build_win32
    8. OBJECTS_DIR = build_win32
    9. RCC_DIR = build_win32
    10. UI_DIR = build_win32
    11. } else {
    12. MOC_DIR = build_unix
    13. OBJECTS_DIR = build_unix
    14. RCC_DIR = build_unix
    15. UI_DIR = build_unix
    16. }
    To copy to clipboard, switch view to plain text mode 
    You leave Qt Creator's shadow build feature off in this case.

  7. #7
    Join Date
    Sep 2008
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

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

    Hi

    Thanks, but I am already using these parameters.
    This works fine, it is just the makefile itself.

    If I compile on Mac and then try to compile on Linux, then the makefile is not re-generated.
    And therefore the MOC_DIR, OBJECTS_DIR, RCC_DIR, UI_DIR are not updated in the makefile...

  8. #8
    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?

    Honestly I would just rerun qmake and forget about the problem.
    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.


  9. #9
    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?

    I have the same problem.
    Quote Originally Posted by wysota View Post
    Honestly I would just rerun qmake and forget about the problem.
    This would be sub-optimal; and what is the point of an automated make, if you have to run some (quite important) step manually?

    Anyway, I tried the above solution and it is not an out-of-source (or shadow) build: all makefile's are in the same directory of each .pro as well as the debug and release sub-dirs with the executable(s).

    So, I would re-formulate the question in this way:

    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 (which IS out-of-source but IS NOT multi-platform) ?

    The best of any possible world would be to be able to launch the build from within Qt Creator itself, with just a click on the the 'hammer' button...

    Thanks!!

    M.

  10. #10
    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.


  11. #11
    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.

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.