diff options
| author | Mistivia <i@mistivia.com> | 2024-03-24 09:36:51 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2024-03-24 09:36:51 +0800 |
| commit | 1208bdd0fccc5f1e380053d8e0a7f4df6fe8f805 (patch) | |
| tree | a4fddb7211a2782b3934cf02d80ef6d1734ec1c2 /Makefile | |
git init
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 |
