Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a general makefile that selects all files with a specific extension

Tags:

makefile

How does a makefile look like that makes a target for every extension?

My current makefile:

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

all: $(TARGETS)

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

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

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

like image 424
Peter Smit Avatar asked Jan 21 '26 08:01

Peter Smit


1 Answers

SOURCES = $(wildcard *.gnuplot)
like image 106
Beta Avatar answered Jan 23 '26 08:01

Beta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!