• C

Makefile problem (URGENT Please!!)

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******
tookiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

shivsaCommented:
just run
make all
or
make vendor_all

for the original makefile and u will be done.
0
shivsaCommented:
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
shivsaCommented:
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
Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

tookiAuthor Commented:
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
shivsaCommented:
do the
#set -x
and then run the
#make all
0
tookiAuthor Commented:
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
shivsaCommented:
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
tookiAuthor Commented:
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
shivsaCommented:
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
shivsaCommented:
please do edit makefile in vi editor, it looks like somekind of text editing error now.
0
tookiAuthor Commented:
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
shivsaCommented:
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
uniquesCommented:
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
moduloCommented:
PAQed, with points refunded (200)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.