-
-
Notifications
You must be signed in to change notification settings - Fork 872
/
Copy pathMakefile.in
172 lines (158 loc) · 5.65 KB
/
Makefile.in
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package = @PACKAGE_NAME@
version = @PACKAGE_VERSION@
prefix = @prefix@
# we don't use @exec_prefix@ because it usually contains '${prefix}' literally
# but we use @prefix@/bin/onedrive in the systemd unit files which are generated
# from the configure script.
# Thus, set exec_prefix unconditionally to prefix
# Alternative approach would be add dep on sed, and do manual generation in the Makefile.
# exec_prefix = @exec_prefix@
exec_prefix = @prefix@
datarootdir = @datarootdir@
datadir = @datadir@
srcdir = @srcdir@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
docdir = $(datadir)/doc/$(package)
VPATH = @srcdir@
INSTALL = @INSTALL@
NOTIFICATIONS = @NOTIFICATIONS@
HAVE_SYSTEMD = @HAVE_SYSTEMD@
systemduserunitdir = @systemduserunitdir@
systemdsystemunitdir = @systemdsystemunitdir@
curl_LIBS = @curl_LIBS@
sqlite_LIBS = @sqlite_LIBS@
notify_LIBS = @notify_LIBS@
bsd_inotify_LIBS = @bsd_inotify_LIBS@
dynamic_linker_LIBS = @dynamic_linker_LIBS@
COMPLETIONS = @COMPLETIONS@
BASH_COMPLETION_DIR = @BASH_COMPLETION_DIR@
ZSH_COMPLETION_DIR = @ZSH_COMPLETION_DIR@
FISH_COMPLETION_DIR = @FISH_COMPLETION_DIR@
DEBUG = @DEBUG@
DC = @DC@
DC_TYPE = @DC_TYPE@
DCFLAGS = @DCFLAGS@
DCFLAGS += -w -J.
ifeq ($(DEBUG),yes)
ifeq ($(DC_TYPE),dmd)
# Add DMD Debugging Flags
DCFLAGS += -g -debug -gs
else
# Add LDC Debugging Flags
DCFLAGS += -g -d-debug -gc
endif
else
# Only add optimisation flags if debugging is not enabled
DCFLAGS += -O
endif
ifeq ($(NOTIFICATIONS),yes)
NOTIF_VERSIONS=-version=NoPragma -version=NoGdk -version=Notifications
# support ldc2 which needs -d prefix for version specification
ifeq ($(DC_TYPE),ldc)
NOTIF_VERSIONS := $(addprefix -d,$(NOTIF_VERSIONS))
endif
DCFLAGS += $(NOTIF_VERSIONS)
endif
system_unit_files = contrib/systemd/[email protected]
user_unit_files = contrib/systemd/onedrive.service
DOCFILES = readme.md config LICENSE changelog.md docs/advanced-usage.md docs/application-config-options.md docs/application-security.md docs/business-shared-items.md docs/client-architecture.md docs/contributing.md docs/docker.md docs/install.md docs/national-cloud-deployments.md docs/podman.md docs/privacy-policy.md docs/sharepoint-libraries.md docs/terms-of-service.md docs/ubuntu-package-install.md docs/usage.md docs/known-issues.md docs/webhooks.md
ifneq ("$(wildcard /etc/redhat-release)","")
RHEL = $(shell cat /etc/redhat-release | grep -E "(Red Hat Enterprise Linux|CentOS)" | wc -l)
RHEL_VERSION = $(shell rpm --eval "%{rhel}")
else
RHEL = 0
RHEL_VERSION = 0
endif
SOURCES = \
src/main.d \
src/config.d \
src/log.d \
src/util.d \
src/qxor.d \
src/curlEngine.d \
src/onedrive.d \
src/webhook.d \
src/sync.d \
src/itemdb.d \
src/sqlite.d \
src/clientSideFiltering.d \
src/monitor.d \
src/arsd/cgi.d
ifeq ($(NOTIFICATIONS),yes)
SOURCES += src/notifications/notify.d src/notifications/dnotify.d
endif
all: onedrive
clean:
rm -f onedrive onedrive.o version
rm -rf autom4te.cache
rm -f config.log config.status
# Remove files generated via ./configure
distclean: clean
rm -f Makefile contrib/pacman/PKGBUILD contrib/spec/onedrive.spec onedrive.1 $(system_unit_files) $(user_unit_files)
onedrive: $(SOURCES)
if [ -f .git/HEAD ] ; then \
git describe --tags > version ; \
else \
echo $(version) > version ; \
fi
$(DC) $(DCFLAGS) $(addprefix -L,$(curl_LIBS)) $(addprefix -L,$(sqlite_LIBS)) $(addprefix -L,$(notify_LIBS)) $(addprefix -L,$(bsd_inotify_LIBS)) $(addprefix -L,$(dynamic_linker_LIBS)) $(SOURCES) -of$@
install: all
mkdir -p $(DESTDIR)$(bindir)
$(INSTALL) onedrive $(DESTDIR)$(bindir)/onedrive
mkdir -p $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 0644 onedrive.1 $(DESTDIR)$(mandir)/man1/onedrive.1
mkdir -p $(DESTDIR)$(sysconfdir)/logrotate.d
$(INSTALL) -m 0644 contrib/logrotate/onedrive.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/onedrive
mkdir -p $(DESTDIR)$(docdir)
for file in $(DOCFILES); do \
$(INSTALL) -m 0644 $$file $(DESTDIR)$(docdir); \
done
ifeq ($(HAVE_SYSTEMD),yes)
mkdir -p $(DESTDIR)$(systemduserunitdir)
mkdir -p $(DESTDIR)$(systemdsystemunitdir)
ifeq ($(RHEL),1)
$(INSTALL) -m 0644 $(system_unit_files) $(DESTDIR)$(systemdsystemunitdir)
$(INSTALL) -m 0644 $(user_unit_files) $(DESTDIR)$(systemdsystemunitdir)
else
$(INSTALL) -m 0644 $(system_unit_files) $(DESTDIR)$(systemdsystemunitdir)
$(INSTALL) -m 0644 $(user_unit_files) $(DESTDIR)$(systemduserunitdir)
endif
else
ifeq ($(RHEL_VERSION),6)
$(INSTALL) contrib/init.d/onedrive.init $(DESTDIR)/etc/init.d/onedrive
$(INSTALL) contrib/init.d/onedrive_service.sh $(DESTDIR)$(bindir)/onedrive_service.sh
endif
endif
ifeq ($(COMPLETIONS),yes)
mkdir -p $(DESTDIR)$(ZSH_COMPLETION_DIR)
$(INSTALL) -m 0644 contrib/completions/complete.zsh $(DESTDIR)$(ZSH_COMPLETION_DIR)/_onedrive
mkdir -p $(DESTDIR)$(BASH_COMPLETION_DIR)
$(INSTALL) -m 0644 contrib/completions/complete.bash $(DESTDIR)$(BASH_COMPLETION_DIR)/onedrive
mkdir -p $(DESTDIR)$(FISH_COMPLETION_DIR)
$(INSTALL) -m 0644 contrib/completions/complete.fish $(DESTDIR)$(FISH_COMPLETION_DIR)/onedrive.fish
endif
uninstall:
rm -f $(DESTDIR)$(bindir)/onedrive
rm -f $(DESTDIR)$(mandir)/man1/onedrive.1
rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/onedrive
ifeq ($(HAVE_SYSTEMD),yes)
ifeq ($(RHEL),1)
rm -f $(DESTDIR)$(systemdsystemunitdir)/onedrive*.service
else
rm -f $(DESTDIR)$(systemdsystemunitdir)/onedrive*.service
rm -f $(DESTDIR)$(systemduserunitdir)/onedrive*.service
endif
else
ifeq ($(RHEL_VERSION),6)
rm -f $(DESTDIR)/etc/init.d/onedrive
rm -f $(DESTDIR)$(bindir)/onedrive_service.sh
endif
endif
for i in $(DOCFILES) ; do rm -f $(DESTDIR)$(docdir)/$$i ; done
ifeq ($(COMPLETIONS),yes)
rm -f $(DESTDIR)$(ZSH_COMPLETION_DIR)/_onedrive
rm -f $(DESTDIR)$(BASH_COMPLETION_DIR)/onedrive
rm -f $(DESTDIR)$(FISH_COMPLETION_DIR)/onedrive.fish
endif