How can I create a generic makefile that selects all files with a specific extension

What does a makefile look like that makes a target for each extension?

My current makefile is:

SOURCES=*.gnuplot   
TARGETS=$(SOURCES:.gnuplot=.pdf)

all: $(TARGETS)

%.pdf: %.gnuplot
        cp $< $@

The problem is that there is only 1 goal: * .pdf, not test.pdf as I wanted.

How can I let this file make a pdf file for every gnuplot file?

+3
source share
1 answer
SOURCES = $(wildcard *.gnuplot)
+5
source

Source: https://habr.com/ru/post/1772831/


All Articles