]> git.cameronkatri.com Git - ldid.git/blob - Makefile
ci: Set CXXFLAGS
[ldid.git] / Makefile
1 VERSION ?= 2.1.5
2
3 CC ?= cc
4 CXX ?= c++
5 INSTALL ?= install
6 LN ?= ln
7
8 CFLAGS ?= -O2 -pipe
9 CXXFLAGS ?= $(CFLAGS) -std=c++11
10 LDFLAGS ?=
11
12 PREFIX ?= /usr/local
13
14 BINDIR ?= $(PREFIX)/bin
15 MANDIR ?= $(PREFIX)/share/man
16
17 SRC := $(wildcard *.c) $(wildcard *.cpp)
18 LIBS ?= -lcrypto -lplist-2.0
19
20 all: ldid
21
22 %.c.o: %.c
23 $(CC) -c $(CFLAGS) $(CPPFLAGS) -I. $< -o $@
24
25 %.cpp.o: %.cpp
26 $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -I. -DLDID_VERSION=\"$(VERSION)\" $< -o $@
27
28 ldid: $(SRC:%=%.o)
29 $(CXX) $(CXXFLAGS) -o ldid $^ $(LDFLAGS) $(LIBS)
30
31 install: all
32 $(INSTALL) -D -m755 ldid $(DESTDIR)$(BINDIR)/ldid
33 $(LN) -sf ldid $(DESTDIR)$(BINDIR)/ldid2
34 $(INSTALL) -D -m644 docs/ldid.1 $(DESTDIR)$(MANDIR)/man1/ldid.1
35 $(INSTALL) -D -m644 docs/ldid.1.zh_TW $(DESTDIR)$(MANDIR)/zh_TW/man1/ldid.1
36
37 clean:
38 rm -rf ldid *.o
39
40 .PHONY: all clean install