[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Manual: Multiple outputs
From: |
Dmitry Goncharov |
Subject: |
Re: Manual: Multiple outputs |
Date: |
Mon, 3 May 2021 09:42:20 -0400 |
On Mon, May 3, 2021 at 8:57 AM Paul Smith <psmith@gnu.org> wrote:
> data.h: data.c ;
>
> (note the extra semicolon). Now it will work.
Ofcourse, when data.c is present and data.h is missing, then make will
not recreate data.h. It'll run the empty rule.
Your original makefile
data.h data.c: data.foo
touch data.h data.c
data.h: data.c
is the same as
data.h: data.foo
touch data.h data.c
data.c: data.foo
touch data.h data.c
data.h: data.c
See what this makefile tells make to do.
This makefile tells make that when data.c is missing make needs to
touch data.h data.c. Sure this creates both files.
Same for data.h.
You'll need to either rewrite the makefile to use grouped targets as
Paul suggested, or use pattern rules, as you figured out.
i'd look if it was possible to rewrite like
all: data.h data.c
data.h: data.foo
touch $@
data.c: data.foo
touch $@
data.c: data.h
regards, Dmitry