Board index » cppbuilder » Problem with Borland make 5.2

Problem with Borland make 5.2

Hi everyone !
I was reflexing about the best way to compile a modular program, so I
have to
write a proper makefile by hand. And I was very surprised to discover
that
Borland make 5.2 did not respect the GNU make standard ! I'm going to
explain
what I want to do. I have 2 directories main and graph, containing
respectively
main.c, main.h and graph.c, graph.h. How classical you may think...
Well, it's
not so easy to compile these files in a clean way... Here is my makefile
:

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

CFLAGS = -tW-
NAME = A.exe

VPATH = main;graph
SRCS = main.c graph.c
OBJS  = $(SRCS:.c=.o)

all:  $(NAME)

$(NAME): $(OBJS)
 bcc32 $(CFLAGS) $(OBJS) -o $(NAME)

%.o: %.c
 bcc32 -c $(CFLAGS) %.c

main.o : main.h
graph.o : graph.h
------------------------------------------------------------------------

The first problem is that Borland make 5.2 doesn't know the VPATH
variable, so I must explicitely write main/main.* and graph/graph.*.
This version of make doesn't recognize the function "patsubst" either...

So, my first question is : how can I make it work ? The second
question is : how can I generalize the last rules which are exactly
the same. I want make to enter each directory and compile the
files one after the other. My third question is : where is the Borland
make 5.2 documentation ??? I haven't been able to lay hands on it !
Thanks in advance,
Mark

 

Re:Problem with Borland make 5.2


Quote
Mark <NO_SPAMma...@voila.fr> writes:
> Hi everyone !  I was reflexing about the best way to compile a
> modular program, so I have to write a proper makefile by hand. And I
> was very surprised to discover that Borland make 5.2 did not respect
> the GNU make standard !

That shouldn't be a big surprise.  GNU make is a huge superset of
"traditional make."

I prefer GNU make to every other version I've seen.  You might be
interested in this project:

http://unxutils.sourceforge.net/

It's several GNU tools ported to windows, including gmake.

--
Chris(TeamB);

Re:Problem with Borland make 5.2


"GNU make standard"

What standard is that?  Which standards body administers this standard?

.  Ed

Re:Problem with Borland make 5.2


[this question belongs to .commanlinetools ng]

Quote
Mark <NO_SPAMma...@voila.fr> writes:
> Hi everyone !
> I was reflexing about the best way to compile a modular program, so I
> have to
> write a proper makefile by hand. And I was very surprised to discover
> that
> Borland make 5.2 did not respect the GNU make standard !

Should it?

Quote
> I'm going to
> explain
> what I want to do. I have 2 directories main and graph, containing
> respectively
> main.c, main.h and graph.c, graph.h. How classical you may think...
> Well, it's
> not so easy to compile these files in a clean way... Here is my makefile
> :

> ------------------------------------------------------------------------

> CFLAGS = -tW-

If you want a console app use -tWC (or nothing at all. bcc32 defaults
to console app)

Quote
> NAME = A.exe

> VPATH = main;graph
> SRCS = main.c graph.c
> OBJS  = $(SRCS:.c=.o)

> all:  $(NAME)

> $(NAME): $(OBJS)
>  bcc32 $(CFLAGS) $(OBJS) -o $(NAME)

> %.o: %.c
>  bcc32 -c $(CFLAGS) %.c

> main.o : main.h
> graph.o : graph.h
> ------------------------------------------------------------------------

> The first problem is that Borland make 5.2 doesn't know the VPATH
> variable, so I must explicitely write main/main.* and graph/graph.*.
> This version of make doesn't recognize the function "patsubst" either...

.path.c = directory1;directory2;directory3
.path.cpp = anotherdirectory;yetanother

Or, in general:
.path.ext = directories where the files with extension 'ext' are

Quote
> So, my first question is : how can I make it work ? The second
> question is : how can I generalize the last rules which are exactly
> the same.

Borland's MAKE handles autodependencies automagically. Simply put

.autodepend

somewhere in your makefile.

Quote
> I want make to enter each directory and compile the
> files one after the other. My third question is : where is the Borland
> make 5.2 documentation ??? I haven't been able to lay hands on it !

Open help file and type MAKE in the Index tab, press Enter and then
choose 'Using Make'. You will see a tutorial on using Borland's make.

--
Oscar.

Re:Problem with Borland make 5.2


Thanks for your GREAT help, though my question still remains without
response...
Oscar told me to use .path, look at my makefile :

CFLAGS = -tW-
NAME = A.exe

.suffixes : .c .obj
.path.c = d:\bcc55\y\main;d:\bcc55\y\graph

SRCS = main.c graph.c
OBJS = $(SRCS:.c=.obj)

all:  $(NAME)

.c.obj:
    bcc32 $(CFLAGS) -c $&.c

$(NAME): $(OBJS)
    bcc32 $(CFLAGS) -e$(NAME) $(OBJS)

Now, when I type :

D:\bcc55\y>make
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
        bcc32 -tW- -c main.c
Borland C++ 5.5 for Win32 Copyright (c) 1993, 2000 Borland
Error E2194: Could not find file 'main.c'

** error 1 ** deleting d:\bcc55\y\main\main.obj

So, it proves that make doesn't look for C files in the directories
specified by .path ! Please, if you can't answer, warn Borland
about these problems.
Thank you
Mark

Other Threads