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