Help with Makefiles

This is a discussion on Help with Makefiles within the Linux Programming forums, part of the Platform Specific Boards category; For an application that I am writing in C, i need to have one Makefile that will access the 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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,556
    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
    Australia
    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, 10: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, 11:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21