I have a makefile:
CFLAGS= -Wall -g
all: ex1.c
cc ex1.c -o ex1
valgrind ./ex1
cc ex2.c -o ex2
valgrind ./ex2
cc ex3.c -o ex3
valgrind ./ex3
clean:
rm -f ex1
rm -f ex2
rm -f ex3
Is there any way of simplifying this so I do not have to add 3 lines per file (I am expecting ~50 files) and instead I can just insert a number and it will run the commands for that number of files? All of the files will have the same naming scheme /^ex\d{1,}\.c/
and are all in the same directory.
Thank you for your help.