From e6a053cac68a3a99b0ff3f842bd6b834a8872095 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sat, 26 Nov 2022 18:00:11 +0100 Subject: [PATCH] makefile first upload WIP --- .gitignore | 3 ++- Makefile | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 5cc187d..78634e5 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ dkms.conf # project specific for c-basic huffman/testfiles/* -huffman/testfiles/ bin */bin +obj +*/obj diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f9402a6 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +# see https://opensource.com/article/18/8/what-how-makefile +# Usage: +# make # compile all binary +# make clean # remove ALL binaries and objects + +.PHONY = all clean + +SRCS := $(wildcard *.c) +BINS := $(SRCS:%.c=%) + +all: ${BINS} + +%: %.o + @echo "Linking..." + gcc $< -o bin/$@ -lm + +%.o: %.c + echo "Creating object..." + gcc -c $< -o obj/ + +clean: + @echo "Cleaning up..." + rm -rvf *.o ${BINS}