diff options
| author | Louis Burda <quent.burda@gmail.com> | 2024-05-10 02:06:31 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2024-05-10 02:06:31 +0200 |
| commit | dc35e35d0ba1bce4cd1ee5f4b1b94c8263b15b43 (patch) | |
| tree | 0cb58c0a87a7f744a61fd1f648bb9761205bbc1b /lib/liballoc/Makefile | |
| parent | c3c03a382eb7dc9a32850da6615316faf4677a23 (diff) | |
| download | libidx-c-master.tar.gz libidx-c-master.zip | |
Diffstat (limited to 'lib/liballoc/Makefile')
| -rw-r--r-- | lib/liballoc/Makefile | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/liballoc/Makefile b/lib/liballoc/Makefile new file mode 100644 index 0000000..dab8818 --- /dev/null +++ b/lib/liballoc/Makefile @@ -0,0 +1,45 @@ +PREFIX ?= /usr/local +LIBDIR ?= /lib +INCLDIR ?= /include + +CFLAGS = -I include + +ifeq "$(DEBUG)" "1" +CFLAGS += -Og -g +else +CFLAGS += -O2 +endif + +all: build/liballoc.so build/liballoc.a build/test + +clean: + rm -rf build + +cleanall: clean + +build: + mkdir build + +build/liballoc.a: src/allocator.c | build + $(CC) -o build/tmp.o src/allocator.c $(CFLAGS) -r + objcopy --keep-global-symbols=liballoc.api build/tmp.o build/fixed.o + ar rcs $@ build/fixed.o + +build/liballoc.so: src/allocator.c include/allocator.h | build + $(CC) -o $@ src/allocator.c $(CFLAGS) \ + -shared -Wl,-version-script liballoc.lds + +build/test: src/test.c build/liballoc.a | build + $(CC) -o $@ $^ -I include + +install: + install -m755 include/allocator.h -t "$(DESTDIR)$(PREFIX)$(INCLDIR)" + install -m755 build/liballoc.a -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" + install -m755 build/liballoc.so -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" + +uninstall: + rm -f "$(DESTDIR)$(PREFIX)$(INCLDIR)/allocator.h" + rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/liballoc.a" + rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/liballoc.so" + +.PHONY: all clean cleanall install uninstall |
