libstr-c

C string library
git clone https://git.sinitax.com/sinitax/libstr-c
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

Makefile (1267B)


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