Thread: a strange make rule

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    a strange make rule

    Hello everyone,


    Here is a sample make file.

    Code:
    SRC=foo.c
    PROC=$(SRC:%.c=%.o)
    TARGET=$(PROC:%.o=$(TARGET_DIR)/%.o)
    I know the first two lines mean compile *.c defined in SRC to *.o. But what does the 3rd line mean? Convert *.o generated by PROC to *.o? I am confused that why convert *.o to *.o itself?


    thanks in advance,
    George
    Last edited by Ken Fitlike; 08-27-2006 at 04:52 AM. Reason: added code tags

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    This question is not about the c programming language; moved to tech.

    In future, could you please post your non-programming language questions to a non-programming board? Code tags, too, should be regarded as mandatory.

    ******

    Start reading the make manual and it should become clearer when you encounter substitution rules.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Invoke make in verbose mode so you can see what it's doing (perhaps)?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thank you Ken,


    Quote Originally Posted by Ken Fitlike
    This question is not about the c programming language; moved to tech.

    In future, could you please post your non-programming language questions to a non-programming board? Code tags, too, should be regarded as mandatory.

    ******

    Start reading the make manual and it should become clearer when you encounter substitution rules.
    I am always confused when dealing with a question covers several domains -- so I post it to my favorite C Programming board. Next time, I will take care. Thank you man! :-)


    regards,
    George

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thank you Salem,


    Quote Originally Posted by Salem
    Invoke make in verbose mode so you can see what it's doing (perhaps)?
    Verbose mode in make? I have never used it before. Could you show me how to use it please?


    regards,
    George

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    No.
    .
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    Quote Originally Posted by George2
    Verbose mode in make? I have never used it before. Could you show me how to use it please?
    The answer to all your questions!

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    ??

    Quote Originally Posted by joeprogrammer

    regards,
    George

  9. #9
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi Salem,


    Quote Originally Posted by Salem
    No.
    .
    No for what??


    regards,
    George

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    No, I'm not going to read the manual page just to tell you about the --help option.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #11
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    Quote Originally Posted by George2
    ??
    You've obviously never used Google then.

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by George2
    I know the first two lines mean compile *.c defined in SRC to *.o.
    I bow before your superior knowledge.


    No, wait! You're wrong. I don't bow.

    Seriously, type

    info make

    into the Unix console and read.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-03-2008, 03:10 AM
  2. Strange error and impending sanity loss
    By Maer in forum C Programming
    Replies: 21
    Last Post: 11-30-2008, 03:17 AM
  3. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  4. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  5. Replies: 6
    Last Post: 04-20-2002, 06:35 PM