New to "make". Help, please!

J

jmborr

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
 
R

Rolf Magnus

Note that this newsgroup is about the C++ programming language, and not
about any build tools, so you're clearly off-topic here.
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.
 
V

Victor Bazarov

jmborr said:
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
 
J

jmborr

Sorry ! I thought the posting was appropriate to the topic.
Thank you for the tips, anyway.

jose,
 
R

Robbie Hatley

jmborr said:
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
(e-mail address removed)
http://home.pacbell.net/earnur/
 
J

jmborr

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
######
 
J

jmborr

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
######
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,086
Latest member
ChelseaAmi

Latest Threads

Top