forked from otrtool/otrtool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (49 loc) · 1.75 KB
/
Makefile
File metadata and controls
65 lines (49 loc) · 1.75 KB
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
# (adapted from http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html)
#
# 'make depend' uses makedepend to automatically generate dependencies
# (dependencies are added to end of Makefile)
# 'make' alias for 'make otrtool && make doc'
# 'make doc' gzips manpage
# 'make otrtool' build executable file 'otrtool'
# 'make clean' removes all .o and executable files
#
SHELL = /bin/sh
.SUFFIXES:
.SUFFIXES: .c .o
PREFIX ?= /usr/local
DVERSION = v1.2.0
VERSION ?= $(shell git describe --tags --long --dirty 2>/dev/null || echo "$(DVERSION)")
CFLAGS += -O3 -Wall -Wextra -g -DVERSION='"$(VERSION)"'
LDFLAGS += -lmcrypt -lcurl
# large file support
CFLAGS += $(shell getconf LFS_CFLAGS)
LDFLAGS += $(shell getconf LFS_LDFLAGS)
SRCS = src/md5.c src/main.c
MAIN = otrtool
OBJS = $(SRCS:.c=.o)
.PHONY: depend clean install
all: $(MAIN) otrtool.1.gz
@echo Done.
otrtool.1.gz:
gzip -c doc/otrtool.1 > otrtool.1.gz
$(MAIN): $(OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) -o $(MAIN) $(OBJS) $(LDFLAGS)
@echo Build successful
# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
# (see the gnu make manual section about automatic variables)
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
clean:
$(RM) $(OBJS) $(MAIN) $(MAIN).1.gz
install: $(MAIN) $(MAIN).1.gz
install -m 0755 -d $(DESTDIR)$(PREFIX)/bin
install -m 0755 $(MAIN) $(DESTDIR)$(PREFIX)/bin/
install -m 0755 -d $(DESTDIR)$(PREFIX)/man/man1
install -m 0644 $(MAIN).1.gz $(DESTDIR)$(PREFIX)/man/man1/
depend: $(SRCS)
makedepend -w70 -Y $^
# DO NOT DELETE THIS LINE -- make depend needs it
src/md5.o: src/md5.h
src/main.o: src/md5.h