On Mon, May 3, 2021 at 8:57 AM Paul Smith <psm...@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