~sircmpwn/gmni

ref: 41e5188b6e217a4bfd6d1802b73f49cc49472c17 gmni/Makefile -rw-r--r-- 2.0 KiB
41e5188bDrew DeVault Makefile: update dependencies in pkgconfig 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
.POSIX:
.SUFFIXES:
OUTDIR=.build
VERSION=0.0.0
include $(OUTDIR)/config.mk
include $(OUTDIR)/cppcache

gmni: $(gmni_objects)
	@printf 'CCLD\t$@\n'
	@$(CC) $(LDFLAGS) -o $@ $(gmni_objects) $(LIBS)

gmnlm: $(gmnlm_objects)
	@printf 'CCLD\t$@\n'
	@$(CC) $(LDFLAGS) -o $@ $(gmnlm_objects) $(LIBS)

libgmni.a: $(libgmni.a_objects)
	@printf 'AR\t$@\n'
	@$(AR) -rcs $@ $(libgmni.a_objects)

doc/gmni.1: doc/gmni.scd
doc/gmnlm.1: doc/gmnlm.scd

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' >> $@
	@printf 'Cflags: -I$${includedir}/gmni\n' >> $@
	@printf 'Libs: -L$${libdir} -lgmni\n' >> $@

.SUFFIXES: .c .o .scd .1

.c.o:
	@printf 'CC\t$@\n'
	@touch $(OUTDIR)/cppcache
	@grep $< $(OUTDIR)/cppcache >/dev/null || \
		$(CPP) $(CFLAGS) -MM -MT $@ $< >> $(OUTDIR)/cppcache
	@$(CC) -c $(CFLAGS) -o $@ $<

.scd.1:
	@printf 'SCDOC\t$@\n'
	@$(SCDOC) < $< > $@

docs: doc/gmni.1 doc/gmnlm.1

clean:
	@rm -f gmni gmnlm libgmni.a libgmni.pc doc/gmni.1 doc/gmnlm.1 $(gmnlm_objects) $(gmni_objects)

distclean: clean
	@rm -rf "$(OUTDIR)"

install: all install_docs
	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

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

.PHONY: clean distclean docs install