From 31c10caf807eef1a5317d3ac895666b32dd5a0e9 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Mon, 26 Jun 2023 12:58:56 +0200 Subject: [PATCH] Add basic makefiles. --- c/Makefile | 33 +++++++++++++++++++++++++++++++++ c/Makefile.distort | 4 ++++ 2 files changed, 37 insertions(+) create mode 100644 c/Makefile create mode 100644 c/Makefile.distort diff --git a/c/Makefile b/c/Makefile new file mode 100644 index 0000000..3a0de70 --- /dev/null +++ b/c/Makefile @@ -0,0 +1,33 @@ +#SOURCE= vlc +#CFLAGS=$(shell pkg-config --libs vlc) +# +#all: compilationvlc +# +#compilationvlc: +# $(CC) $(SOURCE).c -o $(SOURCE) $(CFLAGS) + +CC=clang +CFLAGS=-c -Wall -g +LDFLAGS= +CFILES=$(wildcard *.c) # CFILES => recompiles everything on a C file change +EXEC=$(basename $(wildcard *.c)) +#SOURCES=$(wildcard *.c) +TESTS=$(addsuffix .test, $(EXEC)) + +all: $(SOURCES) $(EXEC) + +$(EXEC): $(CFILES) + $(CC) $(LDFLAGS) $@.c -o $@ + +.c.o: + $(CC) $(CFLAGS) $< -o $@ + +clean: + @-rm $(EXEC) + +# to test a binary "prog" : make prog.test + +$(TESTS): + valgrind --leak-check=full -v --track-origins=yes ./$(basename $@) + +test: all $(TESTS) diff --git a/c/Makefile.distort b/c/Makefile.distort new file mode 100644 index 0000000..edb9c3e --- /dev/null +++ b/c/Makefile.distort @@ -0,0 +1,4 @@ +all: compilation + +compilation: + clang -o distortion $$(pkg-config --libs --cflags sndfile) -lm distort.c