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}