1
0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-11-22 20:32:03 +01:00
gmni/Makefile

80 lines
2.0 KiB
Makefile
Raw Permalink Normal View History

2020-09-20 16:17:39 +02:00
.POSIX:
.SUFFIXES:
OUTDIR=.build
2020-10-24 19:40:39 +02:00
VERSION=0.0.0
2020-09-20 16:17:39 +02:00
include $(OUTDIR)/config.mk
include $(OUTDIR)/cppcache
2020-09-20 20:51:25 +02:00
gmni: $(gmni_objects)
2020-09-20 16:17:39 +02:00
@printf 'CCLD\t$@\n'
2020-09-22 01:17:01 +02:00
@$(CC) $(LDFLAGS) -o $@ $(gmni_objects) $(LIBS)
2020-09-20 16:17:39 +02:00
2020-09-21 00:31:33 +02:00
gmnlm: $(gmnlm_objects)
@printf 'CCLD\t$@\n'
2020-09-21 15:17:47 +02:00
@$(CC) $(LDFLAGS) -o $@ $(gmnlm_objects) $(LIBS)
2020-09-21 00:31:33 +02:00
2020-10-24 19:40:39 +02:00
libgmni.a: $(libgmni.a_objects)
@printf 'AR\t$@\n'
@$(AR) -rcs $@ $(libgmni.a_objects)
2020-09-20 20:51:25 +02:00
doc/gmni.1: doc/gmni.scd
2020-09-21 04:37:44 +02:00
doc/gmnlm.1: doc/gmnlm.scd
2020-09-20 20:44:30 +02:00
2020-10-24 19:40:39 +02:00
libgmni.pc:
@printf 'GEN\t$@\n'
@printf 'prefix=%s\n' "$(PREFIX)" > $@
@printf 'exec_prefix=$${prefix}\n' >> $@
@printf 'includedir=$${prefix}/include\n' >> $@
@printf 'libdir=$${prefix}/lib\n' >> $@
@printf 'Name: libgmni\n' >> $@
@printf 'Version: %s\n' "$(VERSION)" >> $@
@printf 'Description: The gmni client library\n' >> $@
@printf 'Requires: libbearssl\n' >> $@
2020-10-24 19:40:39 +02:00
@printf 'Cflags: -I$${includedir}/gmni\n' >> $@
@printf 'Libs: -L$${libdir} -lgmni\n' >> $@
2020-09-20 20:44:30 +02:00
.SUFFIXES: .c .o .scd .1
2020-09-20 16:17:39 +02:00
.c.o:
@printf 'CC\t$@\n'
@touch $(OUTDIR)/cppcache
@grep $< $(OUTDIR)/cppcache >/dev/null || \
$(CPP) $(CFLAGS) -MM -MT $@ $< >> $(OUTDIR)/cppcache
@$(CC) -c $(CFLAGS) -o $@ $<
2020-09-20 16:17:39 +02:00
2020-09-20 20:44:30 +02:00
.scd.1:
@printf 'SCDOC\t$@\n'
@$(SCDOC) < $< > $@
2020-09-21 04:37:44 +02:00
docs: doc/gmni.1 doc/gmnlm.1
2020-09-20 20:44:30 +02:00
2020-09-20 16:17:39 +02:00
clean:
2020-10-24 19:40:39 +02:00
@rm -f gmni gmnlm libgmni.a libgmni.pc doc/gmni.1 doc/gmnlm.1 $(gmnlm_objects) $(gmni_objects)
2020-09-20 16:17:39 +02:00
distclean: clean
@rm -rf "$(OUTDIR)"
install: all install_docs
2020-09-20 20:55:33 +02:00
mkdir -p $(BINDIR)
mkdir -p $(LIBDIR)
mkdir -p $(INCLUDEDIR)/gmni
mkdir -p $(LIBDIR)/pkgconfig
install -m755 gmni $(BINDIR)/gmni
install -m755 gmnlm $(BINDIR)/gmnlm
install -m644 libgmni.a $(LIBDIR)/libgmni.a
install -m644 include/gmni/gmni.h $(INCLUDEDIR)/gmni/gmni.h
install -m644 include/gmni/tofu.h $(INCLUDEDIR)/gmni/tofu.h
install -m644 include/gmni/url.h $(INCLUDEDIR)/gmni/url.h
install -m644 libgmni.pc $(LIBDIR)/pkgconfig/libgmni.pc
2020-09-20 20:55:33 +02:00
2020-10-29 05:03:01 +01:00
uninstall:
rm -f $(BINDIR)/gmni
rm -f $(BINDIR)/gmnlm
rm -f $(LIBDIR)/libgmni.a
rm -rf $(INCLUDEDIR)/gmni
rm -f $(LIBDIR)/pkgconfig/libgmni.pc
rm -f $(MANDIR)/man1/gmni.1
rm -f $(MANDIR)/man1/gmnlm.1
2020-09-20 20:55:33 +02:00
.PHONY: clean distclean docs install