bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Paths above current/working directory don't work with suffix rules


From: Paul Smith
Subject: Re: Paths above current/working directory don't work with suffix rules
Date: Mon, 24 Jan 2022 15:44:52 -0500
User-agent: Evolution 3.36.5-0ubuntu1

On Mon, 2022-01-24 at 21:27 +0100, Adam Tuja wrote:
> SRCS = a.c b.c ../c-1up.c
> OBJS = $(SRCS:.c=.o)
> 
> .c.o:
>         $(CC) $(CFLAGS) -c -o $@ $<
> 
> $(PROG): $(OBJS)
> 
> Now, when I understand it, it works. It's not the same thing as
> objects are placed beside source files but step forward nevertheless.

Did you mean to write something different in your last sentence?  It 
IS the same thing as objects placed beside source files, unless I
misunderstand what you mean by "beside".

This makefile will always write the object files into the same
directory as the source files.  As long as you want to do that, then
you can use suffix rules or pattern rules very easily.

It's when you want object files to go into a different directory from
source files that suffix rules won't work well (you can use VPATH to
help somewhat).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]