Find the answer to your Linux question:
Results 1 to 3 of 3
How do I get a suffix rule to recognize a dependancy? I have a bunch of .h and .cpp files in a directory, two of which are node.h and node.cpp. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942

    Makefile suffix rules


    How do I get a suffix rule to recognize a dependancy? I have a bunch of .h and .cpp files in a directory, two of which are node.h and node.cpp. This is my current makefile:
    Code:
    .SUFFIXES: .o .cpp .h
    
    all: node.o (more here)
    
    .cpp.o:
       $(CXX) $(CXXFLAGS) -c $<
    How would I adjust the last part to depend on a .h file?

    Thanks for your help!
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Which .h file is it depending on? node.h?

  3. #3
    Linux Engineer Javasnob's Avatar
    Join Date
    Jul 2005
    Location
    Wisconsin
    Posts
    942
    Thanks for the reply, but I unfortunately neglected to mention earlier that I had solved this problem with a pattern rule. I'll post the solution later, once I get to my own computer.
    Flies of a particular kind, i.e. time-flies, are fond of an arrow.

    Registered Linux User #408794

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •