diff options
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 |
