469,913 Members | 2,107 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

New to "make". Help, please!

While running make, I obtain the following error:

make: *** No rule to make target `amino_acid_param.h', needed by
`pdb2txt_relax.o'. Stop.

I'm confused, since header files (*.h) shouldn't need rules because
they're not compiled. What can I do?

Below is the makefile. Note that this makefile calls another makefile, and
it seems the error comes from this fact.

# file makefile_pdb2txt_relax
HOME = /users/seldon/jmborr
CODE = $(HOME)/Code
VPATH = $(CODE)/Heavy_atom_code:$(CODE)/PDBClasses

pdb2txt_relax.x: pdb2txt_relax.o amino_acid_param.o \
atom_param.o miscellanea.o \
bibliography.o pdbClasses2.o
g++ -o pdb2txt_relax.x pdb2txt_relax.o \
amino_acid_param.o atom_param.o \
miscellanea.o bibliography.o pdbClasses2.o

pdb2txt_relax.o: pdb2txt_relax.cpp amino_acid_param.h \
atom_param.h miscellanea.h random.h
g++ -Wno-deprecated -c pdb2txt_relax.cpp

include $(CODE)/Heavy_atom_code/makefile_Heavy_atom_code

PHONY : clean

clean :
rm -rf *.o core
#
Here below is the referred makefile

#file makefile_Heavy_atom_code
HOME = /users/seldon/jmborr
CODE = $(HOME)/Code
VPATH = $(CODE)/PDBClasses

amino_acid_param.o: amino_acid_param.cpp amino_acid_param.h miscellanea.h
g++ -Wno-deprecated -c amino_acid_param.cpp

atom_param.o: atom_param.cpp atom_param.h miscellanea.h bibliography.h
g++ -Wno-deprecated -c atom_param.cpp

miscellanea.o: miscellanea.cpp miscellanea.h bibliography.h pdbClasses2.h
g++ -Wno-deprecated -c miscellanea.cpp

bibliography.o: bibliography.cpp bibliography.h
g++ -Wno-deprecated -c bibliography.cpp

include $(CODE)/makefile_PDBClasses
Jul 22 '05 #1
6 2053
Note that this newsgroup is about the C++ programming language, and not
about any build tools, so you're clearly off-topic here.

jmborr wrote:
While running make, I obtain the following error:

make: *** No rule to make target `amino_acid_param.h', needed by
`pdb2txt_relax.o'. Stop.

I'm confused, since header files (*.h) shouldn't need rules because
they're not compiled. What can I do?


make doesn't know what a header file is. You just give it rules that
tell it which target files depend on which source files and how to
generate those targets from the sources. If a source file doesn't
exist, make in turn tries to find another rule that tells it how to
generate it from other sources.
You're specifying a file amino_acid_param.h as source in some rules, but
that file doesn't seem to exist, so make tries to find a rule to build
that file, which you didn't provide.

Jul 22 '05 #2
"jmborr" <jm****@bu.edu> wrote...
While running make, I obtain the following error:

make: *** No rule to make target `amino_acid_param.h', needed by
`pdb2txt_relax.o'. Stop.

I'm confused, since header files (*.h) shouldn't need rules because
they're not compiled. What can I do?
[...]


Post to a newsgroup where this is on topic. comp.lang.c++ is about
C++ _language_, not about build tools. Those are usually platform-
specific. Try a UNIX newsgroup, a Linux newsgroup, or gnu.utils[.help]

V
Jul 22 '05 #3
Sorry ! I thought the posting was appropriate to the topic.
Thank you for the tips, anyway.

jose,

Jul 22 '05 #4
"jmborr" <jm****@bu.edu> wrote:
make: *** No rule to make target `amino_acid_param.h', needed by
`pdb2txt_relax.o'. Stop.
...
pdb2txt_relax.o: pdb2txt_relax.cpp amino_acid_param.h \
atom_param.h miscellanea.h random.h
g++ -Wno-deprecated -c pdb2txt_relax.cpp


(This is slightly off-topic for this group, but I just
happen to know the cause and cure for your problem, so
here goes....)

Your make file says "compile amino_acid_param.h as a
source file". Obviously not what you want.

What you need are separate lines to express header
dependencies, withOUT action lines immediately
below them:

pdb2txt_relax.o: amino_acid_param.h atom_param.h
pdb2txt_relax.o: miscellanea.h random.h
pdb2txt_relax.o: pdb2txt_relax.cpp
(TAB) g++ -Wno-deprecated -c pdb2txt_relax.cpp
(TAB) echo pdb2txt_relax has been compiled.

Pay careful attention to the "(TAB)". "Action"
lines must always begin with an actual Tab character
(use your "Tab" key). Dependency lines must NOT
start with a Tab.

Note that you can have many dependency lines for one
target, but only one of these may have "action" lines
immediately under it. The dependency line with the
actions associated should list your source files,
and the dependency lines with NO actions associated
should list your headers. That way, you don't end up
trying to compile headers.

--
Cheers,
Robbie Hatley
Tustin, CA, USA
lo**********@pacbell.net
http://home.pacbell.net/earnur/




Jul 22 '05 #5
Hi Robbie,
I split the dependencies into header ans source files as you
described, but with no success !
It seems the problem comes from the fact that I have the
header files in a different directories than the makefile.
I specified these directories in variable VPATH, but it seems this doesn't
work.
In the GNU-Make manual (pag 21), it says that "make" will search files
located in all directories specified in VPATH , but this is obviously not
working !
Anybody used VPATH before ?

jose,
###### makefile_pdb2txt_relax #####
HOME = /users/seldon/jmborr
CODE = $(HOME)/Code
#VPATH = $(CODE)/Heavy_atom_code:$(CODE)/PDBClasses
VPATH = /users/seldon/jmborr/Code/Heavy_atom_code:$(CODE)/PDBClasses

pdb2txt_relax.x: pdb2txt_relax.o amino_acid_param.o \
atom_param.o miscellanea.o \
bibliography.o pdbClasses2.o
g++ -o pdb2txt_relax.x pdb2txt_relax.o \
amino_acid_param.o atom_param.o \
miscellanea.o bibliography.o pdbClasses2.o

pdb2txt_relax.o: amino_acid_param.h atom_param.h pdb2txt_relax.o:
miscellanea.h random.h
pdb2txt_relax.o: pdb2txt_relax.cpp
g++ -Wno-deprecated -c pdb2txt_relax.cpp
echo pdb2txt_relax has been compiled

include $(CODE)/Heavy_atom_code/makefile_Heavy_atom_code

PHONY : clean

clean :
rm -rf *.o core
######

Jul 22 '05 #6
Hi Robbie,
I split the dependencies into header ans source files as you
described, but with no success !
It seems the problem comes from the fact that I have the
header files in a different directories than the makefile.
I specified these directories in variable VPATH, but it seems this doesn't
work.
In the GNU-Make manual (pag 21), it says that "make" will search files
located in all directories specified in VPATH , but this is obviously not
working !
Anybody used VPATH before ?

jose,
###### makefile_pdb2txt_relax #####
HOME = /users/seldon/jmborr
CODE = $(HOME)/Code
#VPATH = $(CODE)/Heavy_atom_code:$(CODE)/PDBClasses
VPATH = /users/seldon/jmborr/Code/Heavy_atom_code:$(CODE)/PDBClasses

pdb2txt_relax.x: pdb2txt_relax.o amino_acid_param.o \
atom_param.o miscellanea.o \
bibliography.o pdbClasses2.o
g++ -o pdb2txt_relax.x pdb2txt_relax.o \
amino_acid_param.o atom_param.o \
miscellanea.o bibliography.o pdbClasses2.o

pdb2txt_relax.o: amino_acid_param.h atom_param.h pdb2txt_relax.o:
miscellanea.h random.h
pdb2txt_relax.o: pdb2txt_relax.cpp
g++ -Wno-deprecated -c pdb2txt_relax.cpp
echo pdb2txt_relax has been compiled

include $(CODE)/Heavy_atom_code/makefile_Heavy_atom_code

PHONY : clean

clean :
rm -rf *.o core
######

Jul 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Huey | last post: by
4 posts views Thread by The Colonel | last post: by
28 posts views Thread by Steven Bethard | last post: by
reply views Thread by Steven Bethard | last post: by
4 posts views Thread by Eric West | last post: by
4 posts views Thread by inetquestion | last post: by
2 posts views Thread by somyav | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.