Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > C makefile
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 10th December 12:44
zhaolin xie
External User
 
Posts: 1
Default C makefile


Hi,
I copied a makefile from a software supply and modified it to biuld my own library file. Some lines of the makefile are:
DEBUGS= -v
CFLAGS= $(DEBUGS) -DMSDOS -DETH_MSS=576 -Id:\borlandc\include \
-Ld:\borlandc\lib
MODELL= -ml
..c.obj:
d:\borlandc\bin\bcc -c $(MODELL)$(CFLAGS) $*.c
d:\borlandc\bin\tlib d:\myplace\mylib -+$*
The compiler (both Borland C++ 3.0 and 4.5) always say:
Error makefile 7: No match found for wildcard '-+$*'
Error makefile 7: Command syntax error
I changed -c to -P-c, the result was the same.
I asked the software supply and they said they didn't have such a problem.
Could you please tell me how to solve this problem and what the correct format of a makefile is to build a library file?
Thank you.
  Reply With Quote


  sponsored links


2 10th December 12:44
ed mulroy [teamb]
External User
 
Posts: 1
Default C makefile


The problem with the -+$* is inconsistent with what I have found. Look
again at the syntax in the make file. Something else is wrong. Perhaps you
have an invalid character in there which doesn't display in your editor when
you look at it. If that is so, then retyping the line and deleting the
original line would fix it.

I do not have BC++ 3.0 from around 1991 or BC++ 4.5 on my machine but here
are builds using make.exe from Turbo C 2.01 in 1989 and from the current
version of make, that which came with C++ Builder 6. They bracket the date
when the make.exe you are using was created and it is unlikely that yours
would fail to honor what they accept.

There is a bug in your tlib line. The option /C should be given to tlib so
that it creates a case-sensitive library, important because C is a case
sensitive language.

Below is a screen capture of what I did. Not shown but also tried was
with -+$* just as you used although only -+$*.obj is used below.

----------------
C:\Projects\mylib\CopyFold\1

mylib.lib : endwslsh.obj shlerr.obj
@echo Done

.cpp.obj :
bcc32 -WCR -c $<
tlib /C mylib.lib -+$*.obj

C:\Projects\mylib\CopyFold\1

MAKE Version 2.0 Copyright (c) 1987, 1988 Borland International

Available memory 552509 bytes

bcc32 -WCR -c endwslsh.cpp
Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
endwslsh.cpp:
tlib /C mylib.lib -+endwslsh.obj
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
Warning: 'endwslsh' not found in library
bcc32 -WCR -c shlerr.cpp
Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
shlerr.cpp:
tlib /C mylib.lib -+shlerr.obj
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
Warning: 'shlerr' not found in library

C:\Projects\mylib\CopyFold\1


C:\Projects\mylib\CopyFold\1


C:\Projects\mylib\CopyFold\1

MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
bcc32 -WCR -c endwslsh.cpp
Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
endwslsh.cpp:
tlib /C mylib.lib -+endwslsh.obj
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
Warning: 'endwslsh' not found in library
bcc32 -WCR -c shlerr.cpp
Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
shlerr.cpp:
tlib /C mylib.lib -+shlerr.obj
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
Warning: 'shlerr' not found in library
Done

C:\Projects\mylib\CopyFold\1

----------------

.. Ed
  Reply With Quote


  sponsored links


3 10th December 12:44
zhaolin xie
External User
 
Posts: 1
Default C makefile


Hi Ed,
Thank you for your advice. I deleted the original line and re-typed it. I added /C and used -+$*.obj. But all the results were still the same. I noticed that the compiler always reported two errors on the same line number such as:
Error makefile 7: No match found for wildcard '-+$*.obj'
Error makefile 7: Command syntax error.
The line number 7 is actually the next line to the command line that carries -+$*.obj.
After I added () as -+$(*.obj), the first complaint disappeared. But I could never get rid of the second one:
Error makefile 7: Command syntax error.
When I moved the command line around, the line number in the error report followed and the reported line number is always the next line to the command line.
I used the exact format as yours. But if the library file name is with extension .lib as tlib /C mylib.lib -+$*.obj, the compiler reports one more error:
Error makefile 7: Redefinition of target 'mylib.lib'.
To avoid this error, I have to omit .lib. I think this is ok. But I really can not get rid of "Command sytax error".
By the way, the version is
MAKE Version 3.6 Copyright (c) 1991 Borland International.
Could you please give me further guidance? Thank you.
  Reply With Quote
4 10th December 12:44
ed mulroy [teamb]
External User
 
Posts: 1
Default C makefile


I assume that you run the make with a command something like this:

make -f filename.mak


Please run the make with the command line options -B -n and redirect it to
a file

They mean:
-B build all, ignore what's already made and do everything
-n no real build, just write the commands that would be done to the screen.

So the command would look something like this:

make -B -n -f filename.mak >logfile.txt

and that would cause its output to go into a new file named Logfile.txt

Please post a message in which you have placed the contents of the make file
and the contents of that log file. I am hoping that when I see those two I
will be able to figure out what the problem is.

It's about 9:10PM here right now (I'm on the East coast of the US) and I'll
be checking in from time to time for about another 2 hours so if you can get
it posted quickly I could play with it tonight. If that is not convenient,
then post it tomorrow and I'll get it then.

Note that my comment concering adding the /C to the tlib command line was
not related to the problem you are having. That was a separate item.

.. Ed
  Reply With Quote
5 10th December 12:44
zhaolin xie
External User
 
Posts: 1
Default C makefile


Hi Ed,
Thank you very much for your help.
Last Friday after I failed so many times, I decided to re-copy the original make file and modify it as little as possible.
I was surprised that it worked. I didn't look for the reason
why it worked because I hurried to go to next step: linking the
generated lib file to my project.
This morning I saw your message and another email message. The contents of that email is:

Does you make file actually have a space (or tab) in front of both
commands? It should look more like this:

..c.obj:
d:\borlandc\bin\bcc -c $(MODELL)$(CFLAGS) $*.c
d:\borlandc\bin\tlib d:\myplace\mylib -+$*

Both messages made me go back to check my make file. I found that a space or tab is the key to this issue. I intenionally
deleted and added space(or a tab). The test results are as follows:

As long as the second line is without a space(or a tab), even though I added a space (or a tab) in fornt of the first line, I got two error messages:
Error makefile 7: No match found for wildcard '-+$*.obj'
Error makefile 7: Command syntax error.

When I added a space (or a tab) in front of the second line and
deleted space or tab from the first line, I got only one error
message:
Error makefile 7: Command syntax error.

When I added a space (or a tab) in front of both lines, there was no error message and the desired lib file was generated.

I added -B -n in my batch file. The key is still the space or tab.

Ed, now I need your help for another issue:
My project is in MS-C. The reason I need that borland C lib file is that the lib provids DOS ethernet funcions which we need
for our project. When I got the lib file from the software supply, I tried to link it to my project which is compiled in MS_C. MS_C reported many errors. A typical error is:
error L2029: '_movmem': unresolved external.
I know that movmem() is a borland C function. MS_C does not use the same name. I thought that if I added -Ld:\borlandc\lib in my borland C make file to re-compile the lib, the destination code of all the functions would be in the lib and when my project calls those funcions (such as movmem()), it would be
executed. But after I linked the new-generated lib to my projct,
MS_C cimpiler still reported those errors.
One way to solve this issue is to scan every line in the source files and replace borland C function name with MS-C function anme (for example, replace movmem() with memmove()). This is a huge job and time consuming.
Could you please recommend a good way to allow MS_C based software to call borland C library functions? Thank you.

Zhaolin Xie
  Reply With Quote
6 10th December 12:44
ed mulroy [teamb]
External User
 
Posts: 1
Default C makefile


You cannot use the runtime library from one compiler with another.

This is a macro used in the current C++ Builder compiler's header file for
movmem

#define movmem(src,dest,length) (void)memmove(dest,src,length)

However these are Borland's newsgroups and I do not want to use up their
bandwidth covering MS' ancient C compiler. Look in the Microsoft newsgroups
for that or download Borland's Turbo C compiler and use it.

.. Ed
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666