-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile
64 lines (48 loc) · 1.49 KB
/
Makefile
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
ifneq (,$(wildcard .git))
VERSION ?= $(shell git describe --tags)
else
VERSION ?= 2.1.5-procursus7
endif
CC ?= cc
CXX ?= c++
INSTALL ?= install
LN ?= ln
CXXFLAGS ?= -O2 -pipe
LDFLAGS ?=
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
SRC := ldid.cpp
LIBS ?=
LIBPLIST_INCLUDES ?= $(shell pkg-config --cflags libplist-2.0)
LIBPLIST_LIBS ?= $(shell pkg-config --libs libplist-2.0)
ifeq ($(shell uname -s),FreeBSD)
LIBCRYPTO_INCLUDES ?= -I/usr/include
LIBCRYPTO_LIBS ?= -L/usr/lib -lcrypto
else
LIBCRYPTO_INCLUDES ?= $(shell pkg-config --cflags libcrypto)
LIBCRYPTO_LIBS ?= $(shell pkg-config --libs libcrypto)
endif
ifeq ($(SMARTCARD),1)
CPPFLAGS += -DSMARTCARD
endif
MANPAGE_LANGS := zh_TW zh_CN
EXT ?=
all: ldid$(EXT)
%.cpp.o: %.cpp
$(CXX) -c -std=c++11 $(CXXFLAGS) $(LIBCRYPTO_INCLUDES) $(LIBPLIST_INCLUDES) $(CPPFLAGS) -I. -DLDID_VERSION=\"$(VERSION)\" $< -o $@
ldid$(EXT): $(SRC:%=%.o)
$(CXX) -o $@ $^ $(LDFLAGS) $(LIBCRYPTO_LIBS) $(LIBPLIST_LIBS) $(LIBS)
install: all
$(INSTALL) -d $(DESTDIR)$(BINDIR)/
$(INSTALL) -m755 ldid $(DESTDIR)$(BINDIR)/ldid
$(LN) -sf ldid $(DESTDIR)$(BINDIR)/ldid2
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man1/
$(INSTALL) -m644 docs/ldid.1 $(DESTDIR)$(MANDIR)/man1/ldid.1
for lang in $(MANPAGE_LANGS); do \
$(INSTALL) -d $(DESTDIR)$(MANDIR)/$$lang/man1/; \
$(INSTALL) -m644 docs/ldid.$$lang.1 $(DESTDIR)$(MANDIR)/$$lang/man1/ldid.1; \
done
clean:
rm -rf ldid$(EXT) *.o
.PHONY: all clean install