]> git.cameronkatri.com Git - ldid.git/blob - Makefile
Add CandidateCDHashFull to -h
[ldid.git] / Makefile
1 ifneq (,$(wildcard .git))
2 VERSION ?= $(shell git describe --tags)
3 else
4 VERSION ?= 2.1.5-procursus3
5 endif
6
7 CC ?= cc
8 CXX ?= c++
9 INSTALL ?= install
10 LN ?= ln
11
12 CXXFLAGS ?= -O2 -pipe
13 LDFLAGS ?=
14
15 PREFIX ?= /usr/local
16
17 BINDIR ?= $(PREFIX)/bin
18 MANDIR ?= $(PREFIX)/share/man
19
20 SRC := ldid.cpp
21 LIBS ?=
22
23 LIBPLIST_INCLUDES ?= $(shell pkg-config --cflags libplist-2.0)
24 LIBPLIST_LIBS ?= $(shell pkg-config --libs libplist-2.0)
25
26 ifeq ($(shell uname -s),FreeBSD)
27 LIBCRYPTO_INCLUDES ?= -I/usr/include
28 LIBCRYPTO_LIBS ?= -L/usr/lib -lcrypto
29 else
30 LIBCRYPTO_INCLUDES ?= $(shell pkg-config --cflags libcrypto)
31 LIBCRYPTO_LIBS ?= $(shell pkg-config --libs libcrypto)
32 endif
33
34 MANPAGE_LANGS := zh_TW zh_CN
35
36 all: ldid
37
38 %.cpp.o: %.cpp
39 $(CXX) -c -std=c++11 $(CXXFLAGS) $(LIBCRYPTO_INCLUDES) $(LIBPLIST_INCLUDES) $(CPPFLAGS) -I. -DLDID_VERSION=\"$(VERSION)\" $< -o $@
40
41 ldid: $(SRC:%=%.o)
42 $(CXX) -o ldid $^ $(LDFLAGS) $(LIBCRYPTO_LIBS) $(LIBPLIST_LIBS) $(LIBS)
43
44 install: all
45 $(INSTALL) -d $(DESTDIR)$(BINDIR)/
46 $(INSTALL) -m755 ldid $(DESTDIR)$(BINDIR)/ldid
47 $(LN) -sf ldid $(DESTDIR)$(BINDIR)/ldid2
48 $(INSTALL) -d $(DESTDIR)$(MANDIR)/man1/
49 $(INSTALL) -m644 docs/ldid.1 $(DESTDIR)$(MANDIR)/man1/ldid.1
50 for lang in $(MANPAGE_LANGS); do \
51 $(INSTALL) -d $(DESTDIR)$(MANDIR)/$$lang/man1/; \
52 $(INSTALL) -m644 docs/ldid.$$lang.1 $(DESTDIR)$(MANDIR)/$$lang/man1/ldid.1; \
53 done
54
55 clean:
56 rm -rf ldid *.o
57
58 .PHONY: all clean install