Makefile (894B)
1PREFIX ?= /usr/local 2LIBDIR ?= /lib 3 4CFLAGS = -I include 5 6ifeq "$(DEBUG)" "1" 7CFLAGS += -g 8endif 9 10all: build/libstl.a build/libstl.so build/bench 11 12clean: 13 rm -rf build 14 15build: 16 mkdir build 17 18build/libstl.a: src/stl.c include/stl.h libstl.api | build 19 $(CC) -c -o build/tmp.o $< $(CFLAGS) $(LDLIBS) 20 objcopy --keep-global-symbols=libstl.api build/tmp.o build/fixed.o 21 ar rcs $@ build/fixed.o 22 23build/libstl.so: src/stl.c include/stl.h libstl.lds | build 24 $(CC) -o $@ $< -fPIC $(CFLAGS) \ 25 -shared -Wl,-version-script libstl.lds 26 27build/bench: src/bench.c build/libstl.a | build 28 $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) 29 30install: 31 install -m755 build/libstl.a -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" 32 install -m755 build/libstl.so -t "$(DESTDIR)$(PREFIX)$(LIBDIR)" 33 34uninstall: 35 rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/libstl.a" 36 rm -f "$(DESTDIR)$(PREFIX)$(LIBDIR)/libstl.so" 37 38.PHONY: all clean install uninstall