Groups > Borland > Borland C plus plus builder command line tools > Re: makefile




Re: makefile

Re: makefile
Mon, 06 Aug 2007 17:28:53 -070
Jean Pierre Daviau wrote:

>Is there a make newsgroup?

Yes.
This is it.

>CC= C:/Borland/BCC55/Bin/bcc32.exe

Forward slash is a flag delimiter.
CC= C:\Borland\BCC55\Bin\bcc32.exe

>CFLAGS= -WCR
>OFILES= \
> $(FILE).o

Compiler produces .obj files, not .o files
OFILES= $(FILE).obj

>#
>$(FILE) : $(OFILES) :
>  $(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

>$(FILE).o : $(FILE).c :
>  $(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


Post Reply
makefile
Mon, 6 Aug 2007 17:59:47 -0400
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 

Post Reply
Re: makefile
Tue, 7 Aug 2007 11:39:03 -0400
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 

Post Reply
Re: makefile
Tue, 7 Aug 2007 15:32:25 -0400
Wow!  :-))
"Michel Leunen" <nospam@noreply.be> a écrit dans le message de 
news: 46b8bf7f$1@newsgroups.borland.com...
> Jean Pierre Daviau wrote:
>
>> #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/
>
> ---------------------------------------- 

Post Reply
Re: makefile
Tue, 7 Aug 2007 17:18:14 -0400
>> #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. 

Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact