Solved

Makefile problem (URGENT Please!!)

Posted on 2003-12-07
15
321 Views
Last Modified: 2010-04-15
I need to change a c file (vendor_send.c) and after the change, I need to get the executible file "vendor_send". But I have difficulty to compile the file:

I only need to get the new executable file "vendor_send".Which are the lines in the following Makefile that I need to execute to get the above file?

When I tried with the following Makefile, I get the error:
#make
make: No rule to make target '$@.c' , needed by vendor_send'.   Stop.

Whare am I making the mistake?Pls help.
-tooki

***my Makefile***
CC = /usr/vendor/SUNWspro7/SUNWspro/bin/cc

CFLAGS = -DUNIX -O -c
FLAGS = -DUNIX -O
I_DIRS = -I/usr/include -I/usr/local/include -I/usr2/rgdat/include
L_DIRS = -L/usr/lib -L/usr/local/lib -L/usr2/rgdat/lib
LIBS =  -Bstatic -lbsafe -lsocket -lgen -Bdynamic -lnsl -lm
SLIBS = -lposix4 -lthread -lldap10 -lsmt -lsocket -lgen -lnsl -lm -lC

# copy binaries to this directory
CGI_DIR = /usr/apache1.3./cgi-bin

vendor_all : vendor_send vendor_retrieve

tstdlib.o : tstdlib.c
      ${CC} ${CFLAGS} tstdlib.c ${I_DIRS}

http_tools.o : http_tools.c http_tools.h
      ${CC} ${CFLAGS} http_tools.c ${I_DIRS}

random.o : random.c random.h http_tools.h
      ${CC} ${CFLAGS} random.c ${I_DIRS}

vendor_retrieve vendor_send vendor_retrieve_iv vendor_send_iv: $$@.c tstdlib.o http_tools.o random.o
      ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}
*****

The original Makefile is:

**Original Makefile****
CC = /usr/vendor/SUNWspro7/SUNWspro/bin/cc

CFLAGS = -DUNIX -O -c
FLAGS = -DUNIX -O
I_DIRS = -I/usr/include -I/usr/local/include -I/usr2/rgdat/include
L_DIRS = -L/usr/lib -L/usr/local/lib -L/usr2/rgdat/lib
LIBS =  -Bstatic -lbsafe -lsocket -lgen -Bdynamic -lnsl -lm
SLIBS = -lposix4 -lthread -lldap10 -lsmt -lsocket -lgen -lnsl -lm -lC

# copy binaries to this directory
CGI_DIR = /usr/apache1.3./cgi-bin

#
# psuedo targets
#
all : user_all vendor_all EDE smime PKCS

all_cgi : user_cgi vendor_cgi

user_all : user_send user_send_moto user_send_sla user_retrieve_moto user_send_modelshop user_send_dep

user_cgi : user_send_cgi user_send_moto_cgi user_send_sla_cgi user_retrieve_moto_cgi user_send_modelshop_cgi

vendor_all : vendor_send vendor_retrieve

vendor_cgi : vendor_send_cgi vendor_retrieve_cgi

vendor_iv : vendor_send_iv vendor_retrieve_iv

EDE : EDE_encrypt EDE_decrypt

EDE_iv : EDE_encrypt_iv EDE_decrypt_iv

smime : rgdatsmime

PKCS : PKCS_pri_decrypt

# The following line is to make sure dmake runs the _cgi targets locally so that
# the binaries are not copied on build machines.  See dmake man page.
.LOCAL : user_send_cgi user_send_moto_cgi user_retrieve_moto_cgi rgdatsmime_move vendor_send_cgi vendor_retrieve_cgi user_send_modelshop_cgi

#
# object targets
#

smthelper.o : smthelper.c smthelper.h
      ${CC} ${CFLAGS} smthelper.c

decryptverify.o : decryptverify.c smthelper.h
      ${CC} ${CFLAGS} decryptverify.c

encryptsign.o : encryptsign.c smthelper.h
      ${CC} ${CFLAGS} encryptsign.c

rgdatsmime.o : rgdatsmime.c smthelper.h
      ${CC} ${CFLAGS} rgdatsmime.c

sendrgdat_util.o : sendrgdat_util.c sendrgdat.h
      ${CC} ${CFLAGS} sendrgdat_util.c ${I_DIRS}

#
# EDE & PKCS targets
#
EDE_encrypt EDE_decrypt EDE_encrypt_iv EDE_decrypt_iv PKCS_pri_decrypt : $$@.c tstdlib.o random.o
      ${CC} ${FLAGS} -o $@ $@.c tstdlib.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}

#
# vendor targets
#
vendor_retrieve vendor_send vendor_retrieve_iv vendor_send_iv: $$@.c tstdlib.o http_tools.o random.o
      ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}

#
# user targets
#
user_retrieve user_retrieve_iv user_retrieve_moto user_send combined_user_send user_send_moto user_send_sla user_send_modelshop user_send_dep http_encode\
dump: $$@.c tstdlib.o http_tools.o random.o
      ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}

#
# smime targets
#
rgdatsmime : rgdatsmime.o smthelper.o decryptverify.o encryptsign.o http_tools.o random.o
      ${CC} ${FLAGS} -o $@ rgdatsmime.o smthelper.o decryptverify.o encryptsign.o \
      http_tools.o random.o ${L_DIRS} ${LIBS} ${SLIBS} ${I_DIRS}

#
# API targets
#
sendrgdat get_udn : $$@.c sendrgdat_util.o tstdlib.o http_tools.o random.o
      ${CC} ${FLAGS} -o $@ $@.c sendrgdat_util.o tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}
*****Makefile******
0
Comment
Question by:tooki
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9893650
just run
make all
or
make vendor_all

for the original makefile and u will be done.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9893657
there is no definition for vendor_send but this file is complied under the rule for vendor_all

vendor_all : vendor_send vendor_retrieve

thats why it is giving u this error.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9893664
in this example vendor_all is the target and vendor_send is file required to build that target. and that is why giving error "vendor_send is not a target".
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tooki
ID: 9893709
Thanks for the help.
But I run "make vendor_all" (on the original Makefile) and still I get the error at the output:
#make vendor_all
make: No rule to make target '$@.c' , needed by vendor_send'.   Stop.

-tooki
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9893755
do the
#set -x
and then run the
#make all
0
 

Author Comment

by:tooki
ID: 9893818
Thanks again.
But this time I get the error "No rule to make target `$@.c'" !!

# set -x
+ set -x
# make all
+ make all
make: *** No rule to make target `$@.c', needed by `user_send'.  Stop.


-tooki
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9893830
the problem looks like that u have to all the source file in the directory where u are running the make.
because seems like some of the files needed to compile other and then build the object together.
it is called dependency issues.

put all the *.c files to this directory and then do
make all.
0
 

Author Comment

by:tooki
ID: 9894011
I checked and all .c files are in the folder:
# ls *.c
EDE_decrypt.c           http_encode.c           smthelper.c
EDE_encrypt.c           http_tools.c            tstdlib.c
PKCS_pri_decrypt.c      nofax_keyskey.c         use_delete_fax.c
cedatsmime.c            nofax_rand.c            user_send_sla.c
combined_user_send.c    nofax_vendret.c         vendor_retrieve.c
decryptverify.c         random.c                vendor_send.c
encryptsign.c           sendcedat.c             web_check_fax_status.c
get_udn.c               sendcedat_util.c

How can I change the line in the Makefile to only compile the file "vendor_send.c":

vendor_retrieve vendor_send vendor_retrieve_iv vendor_send_iv: $$@.c tstdlib.o http_tools.o random.o
     ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}


I updated the above line by:
vendor_send: $$@.c tstdlib.o http_tools.o random.o
     ${CC} ${FLAGS} -o $@ vendor_send.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}

But with the above, I get the same error:

# make vendor_send
+ make all
make: *** No rule to make target `$@.c', needed by `vendor_send'.  Stop.

Any other way to troubleshoot which are the needed files to have vendor_send compiled?

-tooki
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9894095
CC = /usr/vendor/SUNWspro7/SUNWspro/bin/cc

CFLAGS = -DUNIX -O -c
FLAGS = -DUNIX -O
I_DIRS = -I/usr/include -I/usr/local/include -I/usr2/rgdat/include
L_DIRS = -L/usr/lib -L/usr/local/lib -L/usr2/rgdat/lib
LIBS =  -Bstatic -lbsafe -lsocket -lgen -Bdynamic -lnsl -lm
SLIBS = -lposix4 -lthread -lldap10 -lsmt -lsocket -lgen -lnsl -lm -lC

# copy binaries to this directory
CGI_DIR = /usr/apache1.3./cgi-bin
all : vendor_all
vendor_all : vendor_send
vendor_send : $$@.c tstdlib.o http_tools.o random.o ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}
------------------------------------

last 2 lines should be in one line.
copy this to a makefile, backup your original makefile.
and then run make vendor_all

0
 
LVL 24

Expert Comment

by:shivsa
ID: 9894113
please do edit makefile in vi editor, it looks like somekind of text editing error now.
0
 

Author Comment

by:tooki
ID: 9894598
Thanks for the help.But i'm sorry that I get the same error:
# make all
+ make all
make: *** No rule to make target `$@.c', needed by `vendor_send'.  Stop.

I checked the file "vendor_send.c" in the directory. (Also each of tstdlib.o http_tools.o random.o are in the same directory of the Makefile).

This is the first few lines (that includes .h files) of vendor_send.c:
#include <aglobal.h>
#include <bsafe.h>
#include "http_tools.h"
#include "random.h"

I can see http_tools.h and random.h are in the same directory of Makefile. But the files aglobal.h and random.h are in the folder "/bsafe40/library/include/" under the directory where the Makefile is.

When I run "make", wouldn't it complain explicitly that it's missing a .h file or so?

-tooki
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9894638
may be. i am not sure at this point since u are adding some objects file and we are building a object file and then linking it to make a executable.

anyway it will be good if u copy these 2 files to the same directory and see what happens.

also as i said before when editing makefile please check for spaces and tab charecter, and edit these files all the time in vi editor, since if u use dos editor or something it may put ^M charector at the end of each line and produce these kind of warning.

0
 
LVL 4

Expert Comment

by:uniques
ID: 9894774
In the target

vendor_send : $$@.c tstdlib.o http_tools.o random.o ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}

your target vendor_send has a dependency on vendor_send.c file. Should it not be dependent on vendor_send.o, the object file?

Try changing this dependency to

vendor_send : $$@.o tstdlib.o http_tools.o random.o ${CC} ${FLAGS} -o $@ $@.c tstdlib.o http_tools.o random.o ${L_DIRS} ${LIBS} ${I_DIRS}


Also add a target for creating vendor_send.o

vendor_send.o : vendor_send.c
     ${CC} ${CFLAGS} vendor_send.c


- Uniques
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10908458
PAQed, with points refunded (200)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question