Makefile

This is a discussion on Makefile within the C Programming forums, part of the General Programming Boards category; I have 2 makefile one for my client: Code: Client: Client.o # generate executable from objects gcc Client.o -o Client ...

  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
    twm
    twm is offline
    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, 10: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

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