diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-03-16 01:09:07 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-03-16 01:09:07 +0100 |
| commit | 2522effc2444a6cb4eb9f3b6168d344983d72170 (patch) | |
| tree | f6801aa6e8c7571581f264e64b1da2cd62dd61be /Makefile | |
| download | libstl-c-2522effc2444a6cb4eb9f3b6168d344983d72170.tar.gz libstl-c-2522effc2444a6cb4eb9f3b6168d344983d72170.zip | |
Initial version
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..250f6b9 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +PREFIX ?= /usr/local +LIBDIR ?= /lib + +CFLAGS = -I include + +ifeq "$(DEBUG)" "1" +CFLAGS += -g +endif + +all: build/libstl.a build/libstl.so build/bench + +clean: + rm -rf build + +build: + mkdir build + +build/libstl.a: src/stl.c include/stl.h libstl.api | build + $(CC) -c -o build/tmp.o $< $(CFLAGS) $(LDLIBS) + objcopy --keep-global-symbols=libstl.api build/tmp.o build/fixed.o + ar rcs $@ build/fixed.o + +build/libstl.so: src/stl.c include/stl.h libstl.lds | build + $(CC) -o $@ $< -fPIC $(CFLAGS) \ + -shared -Wl,-version-script libstl.lds + +build/bench: src/bench.c build/libstl.a | build + $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) + +install: + install -m755 build/libstl.a -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" + install -m755 build/libstl.so -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" + +uninstall: + rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/libstl.a" + rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/libstl.so" + +.PHONY: all clean install uninstall |
