diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3a2cc42 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +CXXFLAGS = -DTHPOOL_DEBUG -pthread + +./bin/example : ./obj/example.o ./obj/thpool.o + gcc -o $@ $^ $(CXXFLAGS) $(LIBS) + +./obj/thpool.o : thpool.c + gcc -c -o $@ $< $(CXXFLAGS) + +./obj/example.o : example.c + gcc -c -o $@ $< $(CXXFLAGS) + +.PHONY : clean + +clean: + rm -f ./bin/* ./obj/*.o diff --git a/README.md b/README.md index 694a56a..5b5a639 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,12 @@ If this project reduced your development time feel free to buy me a coffee. The library is not precompiled so you have to compile it with your project. The thread pool uses POSIX threads so if you compile with gcc on Linux you have to use the flag `-pthread` like this: - gcc example.c thpool.c -D THPOOL_DEBUG -pthread -o example + make Then run the executable like this: - ./example + ./bin/example ## Basic usage