Discussion:
makefile
(too old to reply)
Jean Pierre Daviau
2007-08-06 21:59:47 UTC
Permalink
Hello everybody,


Is there a make newsgroup?

MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Error makefile 9: Command syntax error
*** 1 errors during make ***
-----
#Genmake v1.03 pl2 11/12/91 Copyright(c) 1990, 1991 by Kyle
Saunders
CC= C:/Borland/BCC55/Bin/bcc32.exe
CFLAGS= -WCR
OFILES= \
$(FILE).o
#
$(FILE) : $(OFILES) :
$(CC) $(CFLAGS) -o $(FILE) $(OFILES)

$(FILE).o : $(FILE).c :
$(CC) $(CFLAGS) -c $(FILE).c
--
Thanks for your attention.

Jean Pierre Daviau
--
Borland® C++Builder® for Microsoft® WindowsT
bcc32
delphie
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
Processor Radeon7000 0x5159 agp
Bob Gonder
2007-08-07 00:28:53 UTC
Permalink
Post by Jean Pierre Daviau
Is there a make newsgroup?
Yes.
This is it.
Post by Jean Pierre Daviau
CC= C:/Borland/BCC55/Bin/bcc32.exe
Forward slash is a flag delimiter.
CC= C:\Borland\BCC55\Bin\bcc32.exe
Post by Jean Pierre Daviau
CFLAGS= -WCR
OFILES= \
$(FILE).o
Compiler produces .obj files, not .o files
OFILES= $(FILE).obj
Post by Jean Pierre Daviau
#
$(CC) $(CFLAGS) -o $(FILE) $(OFILES)
Incorrect use of -o

Perhaps better method:
Generic translate .cpp file into .obj file
.cpp.obj:
$(CC) $(CFLAGS) -c $&.cpp

.c.obj:
$(CC) $(CFLAGS) -c $&.c
Post by Jean Pierre Daviau
$(CC) $(CFLAGS) -c $(FILE).c
--
So let's put it all together:

CC= C:\Borland\BCC55\Bin\bcc32.exe
LINK= C:\Borland\BCC55\Bin\ilink32.exe
CFLAGS= -WCR
LINKPARAMS= /aa

#translate cpp to obj $& becomes $(FILE)
.cpp.obj:
$(CC) $(CFLAGS) -c $&.cpp

#translate c to obj
.c.obj:
$(CC) $(CFLAGS) -c $&.c

# File.exe depends on File.obj
$(FILE).exe: $(FILE).obj
$(LINK) $(LINKPARAMS) $(FILE),$(FILE),$(FILE),import32+cw32

If your goal is to have object files, and do nothing with them, you can do this instead
This uses the .c.obj rule above.
$(FILE).obj: $(FILE).c

If, for some reason, you really want .o files, you could rename the .obj files, or
.c.o:
$(CC) $(CFLAGS) -c -o$(FILE).o $(FILE).c
# ren $(FILE).obj $(FILE).o

$(FILE).o: $(FILE).c
Jean Pierre Daviau
2007-08-07 15:39:03 UTC
Permalink
G:\learn_C>make FILE= pause
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Error makefile 14: Command syntax error
Error makefile 19: Command syntax error
Error makefile 23: Command syntax error
Error makefile 31: Command syntax error
*** 4 errors during make ***
----------------------------


1 #make FILE= filename sans ext
2 #Forward slash is a flag delimiter.
3
4 CC= C:\Borland\BCC55\Bin\bcc32.exe
5 LINK= C:\Borland\BCC55\Bin\ilink32.exe
6 CFLAGS= -WCR
7 LINKPARAMS= /aa
8
9 #Perhaps better method:
10 #Generic translate .cpp file into .obj file
11 #translate cpp to obj $& becomes $(FILE)
12 .cpp.obj:
13 $(CC) $(CFLAGS) -c $&.cpp
14
15
16 #translate c to obj
17 .c.obj:
18 $(CC) $(CFLAGS) -c $&.c
19
20 # File.exe depends on File.obj
21 $(FILE).exe: $(FILE).obj
22 $(LINK) $(LINKPARAMS) $(FILE),$(FILE),$(FILE),import32+cw32
23
24 #If your goal is to have object files, and do nothing with
them, you can do this instead
25 #This uses the .c.obj rule above.
26 $(FILE).obj: $(FILE).c
27
28 #Compiler produces .obj files, not .o files
29 #If, for some reason, you really want .o files, you could
rename the .obj files, or .c.o:
30 $(CC) $(CFLAGS) -c -o$(FILE).o $(FILE).c
31 # ren $(FILE).obj $(FILE).o
32
33 $(FILE).o: $(FILE).c
Bob Gonder
2007-08-08 17:05:58 UTC
Permalink
Post by Jean Pierre Daviau
Error makefile 14: Command syntax error
13 $(CC) $(CFLAGS) -c $&.cpp
14
You stripped out the leading space (required)
.cpp.obj:
$(CC) $(CFLAGS) -c $&.cpp
Post by Jean Pierre Daviau
Error makefile 19: Command syntax error
Same
Post by Jean Pierre Daviau
Error makefile 23: Command syntax error
Same
Post by Jean Pierre Daviau
Error makefile 31: Command syntax error
Same
Michel Leunen
2007-08-07 18:52:48 UTC
Permalink
Post by Jean Pierre Daviau
#Genmake v1.03 pl2 11/12/91 Copyright(c) 1990, 1991 by Kyle
Saunders
Genmake is not meant to be used with Borland. I generates a make file
compatible with the GNU make instead.
For very simple projects involving only a few files, you can try a tool
I wrote some years ago for BCC5.5.1:

http://www.leunen.com/App/mfgen.html

Michel
--
----------------------------------------
Michel Leunen
http://www.leunen.com/

----------------------------------------
Jean Pierre Daviau
2007-08-07 19:32:25 UTC
Permalink
Wow! :-))
Post by Michel Leunen
Post by Jean Pierre Daviau
#Genmake v1.03 pl2 11/12/91 Copyright(c) 1990, 1991 by Kyle
Saunders
Genmake is not meant to be used with Borland. I generates a
make file compatible with the GNU make instead.
For very simple projects involving only a few files, you can
http://www.leunen.com/App/mfgen.html
Michel
--
----------------------------------------
Michel Leunen
http://www.leunen.com/
----------------------------------------
Jean Pierre Daviau
2007-08-07 21:18:14 UTC
Permalink
Post by Jean Pierre Daviau
#Genmake v1.03 pl2 11/12/91 Copyright(c) 1990, 1991 by Kyle
Saunders
This is only a file. I could not find Genmake.
I have cygwin on my machine.
So, if you know where it is, it would be fine to give me a link.
Michel Leunen
2007-08-08 18:15:45 UTC
Permalink
Post by Jean Pierre Daviau
Post by Jean Pierre Daviau
#Genmake v1.03 pl2 11/12/91 Copyright(c) 1990, 1991 by Kyle
Saunders
This is only a file. I could not find Genmake.
I have cygwin on my machine.
So, if you know where it is, it would be fine to give me a link.
Google is your friend ;-)

Michel
--
----------------------------------------
Michel Leunen
http://www.leunen.com/

----------------------------------------
Loading...