Thread: Makefile

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    17

    Makefile

    I have 2 makefile
    one for my client:

    Code:
    Client: Client.o	# generate executable from objects
    	gcc Client.o -o Client
    
    Client.o:	Client.c
    	gcc -c Client.c
    and one for my server:
    Code:
    Server: Server_functions.o Server.o Server_main.o	# generate executable from objects
    	gcc Server_functions.o Server.o Server_main.o -o Server 
    
    Server_functions.o:    Server_functions.c
    	gcc -c Server_functions.c
    
    Server.o:   Server.c
    	gcc -c Server.c
    
    Server_main.o:   Server_main.c
    	gcc -c Server_main.c
    How do you do to put them together in the same file?

  2. #2
    root
    Join Date
    Sep 2003
    Posts
    232
    >How do you do to put them together in the same file?
    Makefiles allow an arbitrary number of tags and the first tag is the default, so copy one makefile into the other and add an all tag at the beginning that calls Client and Server.
    The information given in this message is known to work on FreeBSD 4.8 STABLE.
    *The above statement is false if I was too lazy to test it.*
    Please take note that I am not a technical writer, nor do I care to become one.
    If someone finds a mistake, gleaming error or typo, do me a favor...bite me.
    Don't assume that I'm ever entirely serious or entirely joking.

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    17
    all right, it works
    thx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  2. Building a project using a Makefile
    By starcatcher in forum Windows Programming
    Replies: 2
    Last Post: 11-23-2008, 11:50 PM
  3. unix makefile won't work but works in Dev C++
    By jk1998 in forum C++ Programming
    Replies: 1
    Last Post: 06-09-2007, 03:54 PM
  4. makefile blues....
    By WaterNut in forum C Programming
    Replies: 6
    Last Post: 05-30-2005, 08:22 PM
  5. Need help with Makefile
    By xshapirox in forum C++ Programming
    Replies: 14
    Last Post: 09-28-2004, 03:32 PM