Makefile (2085B)
1 .POSIX: 2 .SUFFIXES: 3 OUTDIR=.build 4 VERSION=0.0.0 5 include $(OUTDIR)/config.mk 6 include $(OUTDIR)/cppcache 7 8 gmni: $(gmni_objects) 9 @printf 'CCLD\t$@\n' 10 @$(CC) $(LDFLAGS) -o $@ $(gmni_objects) $(LIBS) 11 12 cgmnlm: $(cgmnlm_objects) 13 @printf 'CCLD\t$@\n' 14 @$(CC) $(LDFLAGS) -o $@ $(cgmnlm_objects) $(LIBS) 15 16 libgmni.a: $(libgmni.a_objects) 17 @printf 'AR\t$@\n' 18 @$(AR) -rcs $@ $(libgmni.a_objects) 19 20 doc/gmni.1: doc/gmni.scd 21 doc/cgmnlm.1: doc/cgmnlm.scd 22 23 libgmni.pc: 24 @printf 'GEN\t$@\n' 25 @printf 'prefix=%s\n' "$(PREFIX)" > $@ 26 @printf 'exec_prefix=$${prefix}\n' >> $@ 27 @printf 'includedir=$${prefix}/include\n' >> $@ 28 @printf 'libdir=$${prefix}/lib\n' >> $@ 29 @printf 'Name: libgmni\n' >> $@ 30 @printf 'Version: %s\n' "$(VERSION)" >> $@ 31 @printf 'Description: The gmni client library\n' >> $@ 32 @printf 'Requires: libbearssl\n' >> $@ 33 @printf 'Cflags: -I$${includedir}/gmni\n' >> $@ 34 @printf 'Libs: -L$${libdir} -lgmni\n' >> $@ 35 36 .SUFFIXES: .c .o .scd .1 37 38 .c.o: 39 @printf 'CC\t$@\n' 40 @touch $(OUTDIR)/cppcache 41 @grep $< $(OUTDIR)/cppcache >/dev/null || \ 42 $(CPP) $(CFLAGS) -MM -MT $@ $< >> $(OUTDIR)/cppcache 43 @$(CC) -c $(CFLAGS) -o $@ $< 44 45 .scd.1: 46 @printf 'SCDOC\t$@\n' 47 @$(SCDOC) < $< > $@ 48 49 docs: doc/gmni.1 doc/cgmnlm.1 50 51 clean: 52 @rm -f gmni cgmnlm libgmni.a libgmni.pc doc/gmni.1 doc/cgmnlm.1 $(cgmnlm_objects) $(gmni_objects) 53 54 distclean: clean 55 @rm -rf "$(OUTDIR)" 56 57 install: all install_docs 58 mkdir -p $(BINDIR) 59 mkdir -p $(LIBDIR) 60 mkdir -p $(INCLUDEDIR)/gmni 61 mkdir -p $(LIBDIR)/pkgconfig 62 install -m755 gmni $(BINDIR)/gmni 63 install -m755 cgmnlm $(BINDIR)/cgmnlm 64 install -m755 libgmni.a $(LIBDIR)/libgmni.a 65 install -m644 include/gmni/gmni.h $(INCLUDEDIR)/gmni/gmni.h 66 install -m644 include/gmni/tofu.h $(INCLUDEDIR)/gmni/tofu.h 67 install -m644 include/gmni/url.h $(INCLUDEDIR)/gmni/url.h 68 install -m644 libgmni.pc $(LIBDIR)/pkgconfig/libgmni.pc 69 70 uninstall: 71 rm -f $(BINDIR)/gmni 72 rm -f $(BINDIR)/cgmnlm 73 rm -f $(LIBDIR)/libgmni.a 74 rm -rf $(INCLUDEDIR)/gmni 75 rm -f $(LIBDIR)/pkgconfig/libgmni.pc 76 rm -f $(MANDIR)/man1/gmni.1 77 rm -f $(MANDIR)/man1/cgmnlm.1 78 79 .PHONY: clean distclean docs install