diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3f409e9 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +cc = gcc +src = $(shell ls src/*.c) +obj = $(src:.c=.o) + +tests=$(shell ls tests/*.c) +tests_bin=$(tests:.c=.bin) + +all: libalgds.a + -rm -rf build/ + -@mkdir -p build/include/algds/ + -@mkdir -p build/lib + mv libalgds.a build/lib/ + cp src/*.h build/include/algds + +libalgds.a: $(obj) + ar cr $@ $^ + +test: $(tests_bin) + @echo + @echo "Run tests:" + @scripts/runall.sh $^ + +$(obj):%.o:%.c + $(cc) -c -g $< -MD -MF $@.d -o $@ + +$(tests_bin):%.bin:%.c libalgds.a + $(cc) -g -Isrc/ $< libalgds.a -MD -MF $@.d -o $@ + +clean: + -rm $(shell find tests/ -name '*.bin') + -rm $(shell find . -name '*.o' -or -name '*.a' -or -name '*.d') + -rm -rf build + +DEPS := $(shell find . -name *.d) +ifneq ($(DEPS),) +include $(DEPS) +endif |
