-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (59 loc) · 1.74 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
65
66
67
68
69
70
71
72
73
74
75
76
77
DISTNAME = sp-fetchmail
DISTDIR = dist
VERSION := $(shell git rev-parse --short HEAD 2>/dev/null)
ifndef VERSION
VERSION = $(shell head -n 1 VERSION)
endif
RM = rm -vf
RM_R = rm -vrf
MKDIR = mkdir -p
TAR = $(shell which tar)
DESTDIR =
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
CFLAGS ?= -Os -g -W -Wall
BUILDDIR = .
INSTALL ?= install
LIBS = -lspcommon-util -lspcommon-mime -lspcommon-mailstorage -lspcommon-mailid -lspcommon-web -letpan -lresolv
OBJ = $(BUILDDIR)/helper_functions.o
OBJ += $(BUILDDIR)/syncmode.o
OBJ += $(BUILDDIR)/main.o
OBJ += $(BUILDDIR)/configfile.o
OBJ += $(BUILDDIR)/exchange_helpers.o
OBJ += $(BUILDDIR)/parse_helper.o
BIN = $(BUILDDIR)/sp_fetchmail
CFLAGS += -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE -I ../common
all: $(BUILDDIR) $(BIN)
debug: CFLAGS += $(DFLAGS)
debug: all
$(BUILDDIR):
$(VERBOSE)mkdir -p $(BUILDDIR)
$(BIN): $(OBJ)
$(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LIBS) $(LDFLAGS)
install: all
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(BIN) $(DESTDIR)$(BINDIR)
uninstall:
$(VERBOSE)rm -f $(DESTDIR)$(BINDIR)/$(BIN)
clean:
$(VERBOSE)rm -f $(OBJ) $(BIN)
$(VERBOSE)rm -rf $(DISTDIR)
dist: clean
$(MKDIR) $(DISTDIR)
$(TAR) --exclude-vcs \
--exclude=dist \
--exclude=*.swp \
--exclude=*~ \
--owner=root \
--group=root \
--transform="s,^\.,$(DISTNAME)-$(VERSION)," \
--show-transformed-names \
-cjf $(DISTDIR)/$(DISTNAME)-$(VERSION).tar.bz2 .
distclean:
$(VERBOSE)rm -rf $(BUILDDIR)
INDENT = indent -nbad -nbap -nbbb -nbc -bl -c33 -ncdb -ce -cli1 -d0 -di0 -ndj -nfc1 -i2 -l78 -nlp -npcs -npsl -sc -sob -nut -saf -sai -saw -br
INDENTSRC = $(wildcard *.[ch])
indent: $(INDENTSRC)
for each in $(INDENTSRC); do $(INDENT) $$each; rm *~; done
$(BUILDDIR)/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<