Problem with make


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with make
# 1  
Old 07-12-2012
Problem with make

I have the following makefile to create my programs, and getting the following error. Somehow it it trying to get to ./programs/rdt/raytrac.cc rather than ./programs/raytrac.cc

It seems to be picking the last path to rdt

Code:
g++ -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG -Ibaselib ./programs/rdt/raytrac.cc -o raytrac
g++: error: ./programs/rdt/raytrac.cc: No such file or directory
g++: fatal error: no input files
compilation terminated.
make: *** [raytrac] Error 4


Code:
C++ = g++
OPT = -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG
B = ./baselib
IDIR = -Ibaselib

# --Directories-----------------------------------------------------------------

#B = ./baselib
#T = ./prgms
#O = ./others
#IDIR = -Ibaselib -Iprgms -Iothers

all : raytrac tdarwin tsimplex getvel tracepdf getveltest getpdf getmisf rdt

# TOMMY files

T = ./programs/raytrac
raytrac : $(T)/raytrac.cc $(T)/raytracPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/raytrac.cc -o raytrac
	-mv raytrac ../bin

#raytrac : $(T)/raytrac.cc baselib prgms $(T)/raytracPrintHelp.hh
#	$(C++) $(OPT) $(IDIR) $(T)/raytrac.cc -o raytrac
#	-mv raytrac ../bin/prgms

S = ./programs/tdarwin
tdarwin : $(S)/tdarwin.cc $(S)/tdarwinPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(S)/tdarwin.cc -o tdarwin
	-mv tdarwin ../bin

T = ./programs/tsimplex
tsimplex : $(T)/tsimplex.cc $(T)/tsimplexPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/tsimplex.cc -o tsimplex
	-mv tsimplex ../bin

T = ./programs/getvel
getvel : $(T)/getvel.cc $(T)/getvelPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/getvel.cc -o getvel
	-mv getvel ../bin

T = ./programs/tracepdf
tracepdf : $(T)/tracepdf.cc  $(T)/tracepdfPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/tracepdf.cc -o tracepdf
	-mv tracepdf ../bin

T = ./programs/getveltest
getveltest : $(T)/getveltest.cc $(T)/getveltestPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/getveltest.cc -o getveltest
	-mv getveltest ../bin

ansiclor.o : $(B)/ansiclor.cc
	$(C++) $(OPT) $(IDIR) -c $< -o $@

#getveltest : $(T)/getveltest.cc baselib prgms ansiclor.o
#	$(C++) $(OPT) $(IDIR) $(T)/getveltest.cc -o getveltest ansiclor.o
#	-mv getveltest ../bin/prgms

T = ./programs/getmisfit
getmisf : $(T)/getmisfit.cc  $(T)/getmisfitPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/getmisfit.cc -o getmisf
	-mv getmisf ../bin

T = ./programs/getpdf
getpdf : $(T)/getpdf.cc  $(T)/getpdfPrintHelp.hh baselib
	$(C++) $(OPT) $(IDIR) $(T)/getpdf.cc -o getpdf
	-mv getpdf ../bin

T = ./programs/rdt
rdt : $(T)/rdt.cc
	$(C++) $(OPT) $(IDIR) $(T)/rdt.cc -o rdt
	-mv rdt ../bin

# --Libraries-------------------------------------------------------------------

baselib : $(B)/common.hh      \
	$(B)/clorfncs.hh      \
	$(B)/vect2.hh         \
	$(B)/vector.hh        \
	$(B)/matrix.hh        \
	$(B)/dynbaseobj.hh    \
	$(B)/list.hh          \
	$(B)/stack.hh         \
	$(B)/tree.hh          \
	$(B)/string.hh        \
	$(B)/layer.hh         \
	$(B)/linlay.hh        \
	$(B)/velmod.hh

# prgms : $(T)/layer.hh $(T)/linlay.hh $(T)/velmod.hh

################################################################################


Last edited by kristinu; 07-12-2012 at 07:03 PM..
# 2  
Old 07-13-2012
Think make will pass through whole file before applying any rules so T will have last assignment by the time it comes round to do the action parts.

If you must have a variable for the path use a different one each time:

Code:
C++ = g++
OPT = -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG
B = ./baselib
IDIR = -Ibaselib
 
# --Directories-----------------------------------------------------------------
 
#B = ./baselib
#T = ./prgms
#O = ./others
#IDIR = -Ibaselib -Iprgms -Iothers
 
all : raytrac tdarwin tsimplex getvel tracepdf getveltest getpdf getmisf rdt
 
# TOMMY files
 
T = ./programs/raytrac
raytrac : $(T)/raytrac.cc $(T)/raytracPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(T)/raytrac.cc -o raytrac
    -mv raytrac ../bin
 
#raytrac : $(T)/raytrac.cc baselib prgms $(T)/raytracPrintHelp.hh
#   $(C++) $(OPT) $(IDIR) $(T)/raytrac.cc -o raytrac
#   -mv raytrac ../bin/prgms
 
S = ./programs/tdarwin
tdarwin : $(S)/tdarwin.cc $(S)/tdarwinPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(S)/tdarwin.cc -o tdarwin
    -mv tdarwin ../bin
 
M = ./programs/tsimplex
tsimplex : $(M)/tsimplex.cc $(M)/tsimplexPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(M)/tsimplex.cc -o tsimplex
    -mv tsimplex ../bin
 
G = ./programs/getvel
getvel : $(G)/getvel.cc $(G)/getvelPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(G)/getvel.cc -o getvel
    -mv getvel ../bin
 
R = ./programs/tracepdf
tracepdf : $(R)/tracepdf.cc  $(R)/tracepdfPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(R)/tracepdf.cc -o tracepdf
    -mv tracepdf ../bin
 
V = ./programs/getveltest
getveltest : $(V)/getveltest.cc $(V)/getveltestPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(V)/getveltest.cc -o getveltest
    -mv getveltest ../bin
 
ansiclor.o : $(B)/ansiclor.cc
    $(C++) $(OPT) $(IDIR) -c $< -o $@
 
#getveltest : $(T)/getveltest.cc baselib prgms ansiclor.o
#   $(C++) $(OPT) $(IDIR) $(T)/getveltest.cc -o getveltest ansiclor.o
#   -mv getveltest ../bin/prgms
 
M = ./programs/getmisfit
getmisf : $(M)/getmisfit.cc  $(M)/getmisfitPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(M)/getmisfit.cc -o getmisf
    -mv getmisf ../bin
 
P = ./programs/getpdf
getpdf : $(P)/getpdf.cc  $(P)/getpdfPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(P)/getpdf.cc -o getpdf
    -mv getpdf ../bin
 
D = ./programs/rdt
rdt : $(D)/rdt.cc
    $(C++) $(OPT) $(IDIR) $(D)/rdt.cc -o rdt
    -mv rdt ../bin
 
# --Libraries-------------------------------------------------------------------
 
baselib : $(B)/common.hh      \
    $(B)/clorfncs.hh      \
    $(B)/vect2.hh         \
    $(B)/vector.hh        \
    $(B)/matrix.hh        \
    $(B)/dynbaseobj.hh    \
    $(B)/list.hh          \
    $(B)/stack.hh         \
    $(B)/tree.hh          \
    $(B)/string.hh        \
    $(B)/layer.hh         \
    $(B)/linlay.hh        \
    $(B)/velmod.hh
 
# prgms : $(T)/layer.hh $(T)/linlay.hh $(T)/velmod.hh
 
################################################################################

This User Gave Thanks to Chubler_XL For This Post:
# 3  
Old 07-13-2012
Suggestion worked great

Quote:
Originally Posted by Chubler_XL
Think make will pass through whole file before applying any rules so T will have last assignment by the time it comes round to do the action parts.

If you must have a variable for the path use a different one each time:

Code:
C++ = g++
OPT = -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG
B = ./baselib
IDIR = -Ibaselib
 
# --Directories-----------------------------------------------------------------
 
#B = ./baselib
#T = ./prgms
#O = ./others
#IDIR = -Ibaselib -Iprgms -Iothers
 
all : raytrac tdarwin tsimplex getvel tracepdf getveltest getpdf getmisf rdt
 
# TOMMY files
 
T = ./programs/raytrac
raytrac : $(T)/raytrac.cc $(T)/raytracPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(T)/raytrac.cc -o raytrac
    -mv raytrac ../bin
 
#raytrac : $(T)/raytrac.cc baselib prgms $(T)/raytracPrintHelp.hh
#   $(C++) $(OPT) $(IDIR) $(T)/raytrac.cc -o raytrac
#   -mv raytrac ../bin/prgms
 
S = ./programs/tdarwin
tdarwin : $(S)/tdarwin.cc $(S)/tdarwinPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(S)/tdarwin.cc -o tdarwin
    -mv tdarwin ../bin
 
M = ./programs/tsimplex
tsimplex : $(M)/tsimplex.cc $(M)/tsimplexPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(M)/tsimplex.cc -o tsimplex
    -mv tsimplex ../bin
 
G = ./programs/getvel
getvel : $(G)/getvel.cc $(G)/getvelPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(G)/getvel.cc -o getvel
    -mv getvel ../bin
 
R = ./programs/tracepdf
tracepdf : $(R)/tracepdf.cc  $(R)/tracepdfPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(R)/tracepdf.cc -o tracepdf
    -mv tracepdf ../bin
 
V = ./programs/getveltest
getveltest : $(V)/getveltest.cc $(V)/getveltestPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(V)/getveltest.cc -o getveltest
    -mv getveltest ../bin
 
ansiclor.o : $(B)/ansiclor.cc
    $(C++) $(OPT) $(IDIR) -c $< -o $@
 
#getveltest : $(T)/getveltest.cc baselib prgms ansiclor.o
#   $(C++) $(OPT) $(IDIR) $(T)/getveltest.cc -o getveltest ansiclor.o
#   -mv getveltest ../bin/prgms
 
M = ./programs/getmisfit
getmisf : $(M)/getmisfit.cc  $(M)/getmisfitPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(M)/getmisfit.cc -o getmisf
    -mv getmisf ../bin
 
P = ./programs/getpdf
getpdf : $(P)/getpdf.cc  $(P)/getpdfPrintHelp.hh baselib
    $(C++) $(OPT) $(IDIR) $(P)/getpdf.cc -o getpdf
    -mv getpdf ../bin
 
D = ./programs/rdt
rdt : $(D)/rdt.cc
    $(C++) $(OPT) $(IDIR) $(D)/rdt.cc -o rdt
    -mv rdt ../bin
 
# --Libraries-------------------------------------------------------------------
 
baselib : $(B)/common.hh      \
    $(B)/clorfncs.hh      \
    $(B)/vect2.hh         \
    $(B)/vector.hh        \
    $(B)/matrix.hh        \
    $(B)/dynbaseobj.hh    \
    $(B)/list.hh          \
    $(B)/stack.hh         \
    $(B)/tree.hh          \
    $(B)/string.hh        \
    $(B)/layer.hh         \
    $(B)/linlay.hh        \
    $(B)/velmod.hh
 
# prgms : $(T)/layer.hh $(T)/linlay.hh $(T)/velmod.hh
 
################################################################################

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Problem in Make file

Dear all, we are facing a problem solarais 10.5 we are trying to install zip23 when i run this command make -f unix/Makefile system i got this error make: fatal error: Don't know how to make target 'system' please help Thanks (2 Replies)
Discussion started by: Emad Nabil
2 Replies

2. HP-UX

HP-unix make file Problem

Dear Unixians, I have try to link my libraries with tuxedo that showing following errors, ] My make file few lines: .... actual linking regards, kkl (1 Reply)
Discussion started by: kkl
1 Replies

3. Solaris

make command problem

hi, I'was trying to compile a simple game , just for testing the system, but the make command gave me problems, so I read that it was best to have a gnu make package installed so I made pkgrm SUNWgmake and installed the gnu make from sunfreesoftware, the problem is that now when I run make... (9 Replies)
Discussion started by: freeware
9 Replies

4. Linux

make command problem with MySql install

Hi, hopefully someone can help me. I am trying to set up LAMP on Fedora 11 starting with MySql. I downloaded the mysql-5.1.40.tar.gz tarball and unpacked it all. This created the mysql-5.1.40 directory. Next I ran the ./configure command. Following this I ran the make command to compile but... (2 Replies)
Discussion started by: patcom
2 Replies

5. UNIX for Advanced & Expert Users

problem with make command

hi guys would u clarify me how to use make command , how to write rules of make command and to execute . (1 Reply)
Discussion started by: chinakampalli p
1 Replies

6. UNIX for Dummies Questions & Answers

Problem with make command

hi guys/gals would u help me out on using make command , how to write rules and execute of make command , am using mandriva linux (1 Reply)
Discussion started by: chinakampalli p
1 Replies

7. HP-UX

Built for hppa2.0n-hp-hpux11.00..problem with make

make --version in parent server ( server in france) gives me the below information GNU Make version 3.78.1, by Richard Stallman and Roland McGrath. Built for hppa2.0n-hp-hpux11.00 Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc. This is... (0 Replies)
Discussion started by: vasanthan
0 Replies

8. Solaris

problem to make a crontab -l

Hello everyone, this is the first i write in the forum, hope i can help , but now i have a problem There must be something wrong in my machine. I installed ( years ago ) an application (NEP) and when I try to show the backup scheduled in crontab the systems says i have no privilegies to do... (4 Replies)
Discussion started by: javierg
4 Replies

9. AIX

Problem MAKE cc: not found on AIX 5.3 please help me...

Hi guys, I am trying to install Big Brother monitoring on my box p570 AIX5.3ML2. But the after the installation you must run a make and it is failed see below the message: /home/bb/bb1.9h-btf/src/ # make Making aix makefile BBOS="aix" CC="cc" CFLAGS=" -Daix -DTIMEH -DREGEXEC... (1 Reply)
Discussion started by: touny
1 Replies

10. UNIX for Advanced & Expert Users

solaris 9 openssl make problem with ld

i've seen a few posts regarding this issue, and i've tried the resolutions, but i keep running into the same problem. i'm trying to compile OpenSSL with the use of rsaref-2.0 (i'm running through this tutorial... (1 Reply)
Discussion started by: xyyz
1 Replies
Login or Register to Ask a Question