Results 1 to 2 of 2

Thread: Qmake for subdirs w/ custom makefile name

  1. #1
    Join Date
    Sep 2008
    Posts
    9
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Qmake for subdirs w/ custom makefile name

    I'm working on a Qt project which uses the qmake subdirs template to create one makefile for building everything. Recently, the merger of two projects has resulted in some non-Qt code being added to our Qt subdirectories, and with this code came makefiles. Needless to say, I'm not happy with this situation, but we're required to live with this. Among other problems, we now have a name conflict from trying to create a Makefile in each of our subdirectories, since we now have a file with that name in Configuration Management.

    One way to deal with this situation is to have a custom name for the Makefile that would be used for our Qt development project, e.g. "makefile_myproj". I know how to modify the qmake app and lib project files to produce a makefile with a given name. What I'm not sure how to do is how to produce a qmake subdirs project file that will use a given alternative makefile name in each of the subdirectories, .i.e. I want each "make" in the subdirectories to use the make file with our custom name, instead of Makefile. What's the best way to go about this?

  2. #2
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qmake for subdirs w/ custom makefile name

    Hi
    I was in the same situation as you. Maybe there is an easier way, however it worked out for me
    In each directory you need a .pro file, so say for example my main (root, project) directory is called projectdir. You would 'make' from this directory, and all subdirectory folders will be made. Just remember to use a subdir template in the directory without source code, and an app template in the directory with your sources. The result would be a makefile in each directory and the projectdir pointing to the directories to be made.
    Example:
    /projectdir
    ../source1dir
    ../source2dir
    ../librarydir
    (put this pro in the projectdir)
    TEMPLATE = subdirs
    SUBDIRS = source1dir source2dir librarydir

    source1dir,source2dir,librarydir each contains a pro file with my cpp/h files and whatever else.
    Edit: After reading your post again you said custom makefile name. I don't see the need for using a custom makefile. Put your build requirements in the pro file. (sources/headers, build, link commands) and then qmake will 'build' the makefile for you. I had a custom makefile, then I decided not to use it, and just put my sources in the pro file. Its much cleaner.
    Last edited by QbelcorT; 10th June 2009 at 01:06.

Similar Threads

  1. makefile without using QMake
    By Rayven in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2010, 22:04
  2. Replies: 12
    Last Post: 7th July 2009, 17:32
  3. 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
  4. Replies: 3
    Last Post: 6th February 2008, 12:53
  5. Replies: 5
    Last Post: 13th March 2006, 20:22

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.