Issue with make, no rule to make target etc.


 
Thread Tools Search this Thread
Top Forums Programming Issue with make, no rule to make target etc.
# 1  
Old 06-27-2011
Issue with make, no rule to make target etc.

I have been trying to split up my src directory to clear out files that are not re-compiled very often. Now I have the following setup in my trunk,

trunk/bld
trunk/src/
trunk/src/src_server
trunk/makefile.linux

In the make file, I have compile rules
Code:
SOURCELOC = src

# compile src c++ objects
$(BDIR)/%.o: ${SOURCELOC}/%.cpp
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

# compile src c objects
$(BDIR)/%.o: ${SOURCELOC}/%.c
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

I just added,
Code:
# compile src server c++ objects
$(BDIR)/%.o: ${SOURCELOC}/src_server/%.cpp
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

# compile src c objects
$(BDIR)/%.o: ${SOURCELOC}/src_server/%.c
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

but I am getting a make error, *** No rule to make target `bldprinting2.o`

The file printing2.cpp is in src/src_server, but it won't seem to compile it from there. Under cygwin, adding these two compile lines to the exact same trunk works just fine, so I don't get what the difference is. I can post the entire make file if that would help.

The OS is Cent5.5 if anyone cares.

LMHmedchem
# 2  
Old 06-28-2011
Well, either you did not make it, buy it, or place it where it can be seen by make. Often a missing or misplaced *.cpp/c or whatever means no *.o generated. Did you pray for a magic rename to some name inside a file? Smilie
# 3  
Old 06-28-2011
I will go through it carefully again. What I can't under stand is the exact same file set and directory structure under windows cygwin compiles and builds just fine with the addition of the compile rules for the src subdirectory. The linux make file is a bit different because it has to deal with multiple versions of gcc, but the compile and build rules are the same. It fails on the first file it tries to make an object from, and the src file is definitely where it is supposed to be in /src/src_server. Make is make, so I don't see why it works under cygwin, but not under Cent.

I will check permissions and hard-code simplify the make file to make sure there is nothing set wrong.

Below is the entire make file if that helps. The error occurs while trying to create the first object, printing2.o.

LMHmedchem

Code:
SOURCELOC = src

# create build directory name
DATESTR := $(shell date "+0.%y.%m.%d")
DATESTR2 = \"$(DATESTR)\"

# Detects which OS and if it is Linux then it will detect which Linux Distribution.
# cross-compiling is useful between kernel versions

## manually add linux distro to OS ##
OS=CentOS-5.5

ARCH := $(shell uname -m)
ifeq "$(KERN)" ""
  KERN := $(shell uname -r | cut -d. -f 1,2)
endif
cmp=g34

# if no compiler was passed as an arg
ifeq "$(cmp)" "g34"
   # find c++ compiler, 3.4 prefered
   HAVEgcc3 := $(shell which g++34)
   ifeq "$(HAVEgcc3)" ""
      HAVEgcc3 := $(shell which g++-3.4)
   endif

   ifeq "$(HAVEgcc3)" "/usr/bin/g++34"
      CC++ = g++34
      cmp=g34
   else
      ifeq "$(HAVEgcc3)" "/usr/bin/g++-3.4"
         CC++ = g++-3.4
         CMP=g34
      else
         CC++=g++
         cmp=g44
         endif
   endif

   # find fortran compiler, g77 prefered
   HAVEg77 := $(shell which g77)

   ifeq "$(HAVEg77)" "/usr/bin/g77"
      FCOMP = g77
   else
      HAVEgfortran := $(shell which gfortran)
      ifeq "$(HAVEgfortran)" "/usr/bin/gfortran"
         FCOMP = gfortran
      else
         ifeq "$(HAVEgfortran)" "/usr/local/bin/gfortran"
            FCOMP = gfortran
         endif
      endif
   endif
else
   ifeq "$(cmp)" "g44"
      CC++ = g++
      FCOMP = gfortran
   else
      @echo "can't find compiler"
      exit
   endif
endif

# create bld directory name
BDIR := bld_$(OS)_$(cmp)_$(KERN).$(ARCH)

ifeq "$(DEBUG)" "1"
  OPTIMIZE = -O0 -g
  DEFRELS =
endif
ifeq "$(DEBUG)" "2"
  # RTRACE turns on license debugging
  OPTIMIZE = -O0 -g
  DEBUGSETTINGS = -DRTRACE -DDEBUG
else
  OPTIMIZE = -O2
  DEFRELS = -DRELEASEVERSION
endif

ifeq "$(SPECIALDEBUG)" "1"
  OPTIMIZE += -DSPECIALDEBUG
endif

FCFLAGS = $(OPTIMIZE)
VFLAGS = -DVERNUM=$(VERNUM)

ifeq "$(CMP)" "g34"
   CFLAGS =  $(OPTIMIZE)  -DLINVGCC3 -DDATESTR=$(DATESTR2) $(DEFRELS) -I src -Wall
else
   CFLAGS =  $(OPTIMIZE)  -DLINVGCC4 -DDATESTR=$(DATESTR2) $(DEFRELS) -I src -Wall
endif


# create build directory if it doesn't exist
archdir: ${BDIR}
${BDIR}:
    @mkdir -p ${BDIR}

# force recreation of version.cpp each time make is run.
# Use global char so we only have to relink whatever uses this., not recompile
#.SILENT: version.h
.SILENT: version.cpp
version.cpp: FORCE
    @echo "char VERSION[] = \"$(DATESTR)\";" > $@
    @echo "int dummyfuctionXYZ() {;}" >> $@


FORCE:

# VERNUM is evaluated in the src to direct preprocessor for types of outout

# default version is debug
LICNUM = 0

# debug version, all output
VERNUM = 0
CFLAGS := $(CFLAGS) -DLICNUM=0
OBJSC = $(OBJS2) $(OBJSCLSH)
OBJSS = $(OBJS1) $(BDIR)/molMUPar.o
all: archdir $(BDIR)/molMUPar $(BDIR)/molMUChild.2.0
server: $(BDIR)/molMUPar
client: $(BDIR)/molMUChild.2.0


# src server
OBJS1 = \
         $(BDIR)/printing2.o \
         $(BDIR)/printing_classic.o \
         $(BDIR)/Remapper.o \
         $(BDIR)/molAuxFuncs.o \
         $(BDIR)/marshall.o \
         $(BDIR)/molErrDecoder.o \
         $(BDIR)/scramble.o \
         $(BDIR)/wrs_signal.o \
         $(BDIR)/version.o \
         $(BDIR)/printBlurb.o

# src client shell
OBJSCLSH = \
         $(BDIR)/molMUChild.o \
         $(BDIR)/molAuxFuncs.o \
         $(BDIR)/marshall.o \
         $(BDIR)/molthread.o \
         $(BDIR)/Remapper.o \
         $(BDIR)/scramble.o \
         $(BDIR)/wrs_signal.o \
         $(BDIR)/version.o

# src client main function
OBJS2 = \
         $(BDIR)/MolconnA.o \
         $(BDIR)/VERSIONFOR.o \
         $(BDIR)/INITIALIZE_ARRAYS.o \
         $(BDIR)/CSUBS.o \
         $(BDIR)/CSUBS_MOLFILE.o \
         $(BDIR)/csubs_findMolecule.o \
         $(BDIR)/CSUBS_SMIFILE.o \
         $(BDIR)/CSUBS_PROCESS_MOL.o \
         $(BDIR)/AROMATICITY.o \
         $(BDIR)/ESTATE1.o \
         $(BDIR)/ESTATE2.o \
         $(BDIR)/estate2_atoms.o \
         $(BDIR)/estate2_etype.o \
         $(BDIR)/Internal_HBond.o \
         $(BDIR)/MARKS.o \
         $(BDIR)/OPTIONS.o \
         $(BDIR)/Xsubs.o \
         $(BDIR)/DISTMATM.o \
         $(BDIR)/DESCRIPTORS.o \
         $(BDIR)/DES_OUTSET.o \
         $(BDIR)/BLOCK_DATA1.o \
         $(BDIR)/SUMS.o \
         $(BDIR)/UNOTIFY3.o \
         $(BDIR)/MODELS_CALC.o \
         $(BDIR)/DEVEL.o



# fortan include files, I think this insures that changes to these get re-compiled
FDEPEND = \
         $(SOURCELOC)/COMMON.BLK \
         $(SOURCELOC)/PARAM.DAT \
         $(SOURCELOC)/ATSYMB.DAT \
         $(SOURCELOC)/CONTROLPARAMS.DAT \
         $(SOURCELOC)/MOLERRORS.DAT \
         $(SOURCELOC)/MOLPARAM.DAT \
         $(SOURCELOC)/SMILES_IF_STATEMENT.DAT \
         $(SOURCELOC)/UNOTIFYPARAMS.DAT \
         $(SOURCELOC)/UTILPARAMS.DAT


###  make build rules  ###

## server build ##
# build molMUPar version
$(BDIR)/molMUPar: $(OBJSS)
    $(CC++) $(OPTIMIZE) -o $@ $(FCFLAGS) $(OBJSS)

## client build ##
$(BDIR)/molMUChild.2.0: $(OBJSC)
    $(FCOMP) $(OPTIMIZE) -o $@ $(FCFLAGS) $(OBJSC) -lstdc++ -lpthread


# client main compile rules
# compile src gfortran objects with cpp preprocessor
$(BDIR)/%.o: $(SOURCELOC)/%.FPP  $(FDEPEND)
    $(FCOMP) $(FCFLAGS) $(VFLAGS) -c -o $@ $<

# compile src gfortran objects with fortran preprocessor
$(BDIR)/%.o: ${SOURCELOC}/%.FOR  $(FDEPEND)
    $(FCOMP) $(FCFLAGS) $(VFLAGS) -c -o $@ $<

# compile src c++ objects
$(BDIR)/%.o: ${SOURCELOC}/%.cpp
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

# compile src c objects
$(BDIR)/%.o: ${SOURCELOC}/%.c
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<


## src_server compile rules
# compile src c++ objects
$(BDIR)/%.o: ${SOURCELOC}/src_server/%.cpp
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

# compile src c objects
$(BDIR)/%.o: ${SOURCELOC}/src_server/%.c
    $(CC++) $(CFLAGS) $(VFLAGS) -c -o $@ $<

# 4  
Old 06-28-2011
Maybe there is a reason most make setups have a make file in each dir? Often, .c and .cpp in different dirs? You have a lot of ways to make *.o there!

Try adding a specific make group for the first file.

Make can be very chatty if asked.
# 5  
Old 06-28-2011
I am trying to juggle this with several other things. Is there a good link for make? Most of what I have read is pretty simple stuff and doesn't get into much for how to do more advanced things. I have thought about switching to a configure script that would call make, but this file works just fine under cygwin and it was allot of work to get it set up to do make all the different versions I have, with different versions of gcc, different OSs, etc, and I would hate to have to do all of that again.

LMHmedchem
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Makefile No rule to make target

I am trying to create a makefile to build a program and am getting the following error: make -f tsimplex.mk make: *** No rule to make target `/main/tsimplex_main.cpp', needed by `tsimplex_main.o'. Stop. OPSYS = $(shell uname -s ) TARGET = tsimplex ROOTDIR = ../../.. GTSDIR =... (1 Reply)
Discussion started by: kristinu
1 Replies

2. UNIX for Dummies Questions & Answers

make - two wildcards in the target

Suppose I have a Makefile like this: x/Ax: x/Bx touch x/Ax y/Ay: y/By touch y/Ay z/Az: z/Bz touch z/Az It does not look like a proper style for make. I would like to write something like %/A%: %/B% touch %/A% but make does not accept it. What is a right way to shorten such a... (1 Reply)
Discussion started by: ybelenky
1 Replies

3. UNIX for Dummies Questions & Answers

Make - two target produced by one recipe

Suppose executable X produces files A and B from nothing, Y produces C from A, Z produces D from B, and my final goal is to produce C and D. I wrote the following makefile: .PHONY: all all: C D C: A Y A D: B Z B A B: X This makefile seems to reflect all dependencies, as it should... (2 Replies)
Discussion started by: ybelenky
2 Replies

4. Programming

compile fails in linux ... "No rule to make target" ... HELP

hello all, attached you can find a tool (written in C) that i really need to make it compile under linux i am able to compile and run it successfully in mac os x, but in linux the compilation fails the only thing that i did so far is to change the following #include <sys/malloc.h> to... (13 Replies)
Discussion started by: OneDreamCloser
13 Replies

5. Shell Programming and Scripting

make Fatal error: Command failed for target 'exp_inter.o'

I am trying to install Expect 5.43 on my Solaris 10 x86 PC. When I run the make file I get - Command failed for target 'exp_inter.o'. I tried to find the file (find / -name exp_inter.o -print 2>/dev/null) but could not. Where can I get this file from? (2 Replies)
Discussion started by: pazzy
2 Replies

6. Shell Programming and Scripting

To make sure I don't violate rule #7

I am hoping to find out if it is possible to use some sort of UNIX programming/scripting tools to solve a problem I have with reformatting email messages that are sent out of my IBM UNIX (AIX) system. I'm thinking some advanced awk/sed may work I do not have the time or the ability to do this... (6 Replies)
Discussion started by: toddk
6 Replies

7. UNIX for Dummies Questions & Answers

make command failed for target 'obj/gp_unix.o'

hi, i am trying to run make command in solaris 9. its giving the error: make:Fatal error:Command failed for target 'obj/gp_unix.o' i came to know X11 should be inastalled for gp_unix.o.But it is already installed.still the same error. ./configure worked fine. can anybody please suggest... (3 Replies)
Discussion started by: rosalina
3 Replies

8. Linux

make file_Configuration lookup disabled for target.

hello everyone, while i am compiling a c++ module.at the compilation end i am getting the following error. ======================= Configuration lookup disabled for target"/swtemp/usbs/cc/unix-ce/root/subsys/cb/cdbc/obj_0001/HP-UX//rdr_types.h" what does it mean.can somebody clarify the... (0 Replies)
Discussion started by: mannam srinivas
0 Replies

9. UNIX for Dummies Questions & Answers

Solaris 9: make: Fatal error:Command failed for target

Hi everyone first of all you should know that I've been working with solaris for a few days only. :) I need to install some programs and I have had the following troubles: 1. When I used /.configure it showed the following message: "no acceptable C compiler found in $PATH" I included... (2 Replies)
Discussion started by: eldiego
2 Replies

10. UNIX for Dummies Questions & Answers

make and clean in a single rule in the makefile.

Hi, This stems from the following thread https://www.unix.com/showthread.php?t=18299 I have a makefile which makes either executables or a shared library. i.e. make -f unix.mak will create the executables and make -f unix.mak libolsv will create the shared library. Since these have to be... (4 Replies)
Discussion started by: vino
4 Replies
Login or Register to Ask a Question