Thread: Help with Makefiles

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    110

    Help with Makefiles

    For an application that I am writing in C, i need to have one Makefile that will access the Makefiles in all of the directories that have stuff to be compiled.

    My question is simple (and I hope the answer is too), how would I go about doing this.

    Thanks,
    WebmasterMattD
    WebmasterMattD.NET

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I imagine your top-level makefile will contain the following

    - a target, which is dependent on the products of your sub-makes
    - calls to all the sub-makes

    Like so
    make -f dir1/makefile
    make -f dir2/makefile

    etc

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    110
    Thanks for that

    Later,
    WebmasterMattD
    WebmasterMattD.NET

  4. #4
    Registered User
    Join Date
    Sep 2001
    Location
    Fiji
    Posts
    212
    or a line like this in the main makefile

    #libobjects defined earlier in file
    $(libobjects) : lib.h ;cd lib && $(MAKE) MAKEFLAGS=

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefiles, GCC's -ggdb option, and Valgrind
    By Jesdisciple in forum C Programming
    Replies: 5
    Last Post: 03-14-2009, 04:25 PM
  2. Makefiles
    By TriKri in forum Windows Programming
    Replies: 3
    Last Post: 03-30-2008, 06:57 AM
  3. how to create VC++ 2005 makefiles
    By Ancient Dragon in forum C++ Programming
    Replies: 4
    Last Post: 03-13-2006, 11:29 AM
  4. Benefits of makefiles
    By Ganoosh in forum C++ Programming
    Replies: 2
    Last Post: 06-27-2005, 09:42 PM
  5. programming linux with gcc, emacs, and makefiles
    By Captain Penguin in forum Linux Programming
    Replies: 1
    Last Post: 11-02-2002, 12:04 PM