-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.include.in
269 lines (229 loc) · 5.32 KB
/
Makefile.include.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#
# $Id$
#
# scanbd - KMUX scanner button daemon
#
# Copyright (C) 2008 - 2012 Wilhelm Meier ([email protected])
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Makefile.conf is generated from Makefile.conf.in by makefile from automake.
# This will set package name and version
#
# DO NOT EDIT THIS FILE
# local changes shall be made in Makefile.conf
# Values set there will override the defaults here
#
#
# TODO: add systemd config here
# TODO: add udev config here
# TODO: add hald config here
#
# Include Makefile.conf for local settings
# ===============================================
#
my_name := $(lastword $(MAKEFILE_LIST))
echo := $(shell echo $(my_name))
my_path := $(shell dirname $(my_name))
-include $(my_path)/Makefile.conf
#
# Set package name and version
# ============================
#
PACKAGE = @PACKAGENAME@
PACKAGE_VERSION = @PACKAGEVERSION@
OSTYPE := $(shell uname)
PKGCFG := $(shell which pkg-config)
#
# Dbus dependencies
# =================
#
ifneq ($(findstring pkg-config, $(PKGCFG)),)
DBUS_INCLUDE := $(shell pkg-config dbus-1 --cflags)
else
DBUS_INCLUDE=
endif
#
# Set default prefix
# ===================
#
ifndef PREFIX
PREFIX := /usr/local
endif
#
# Set own directories
# ==================
#
## ifndef DESTDIR
## SCANBD_CFG_DIR = $(PREFIX)/etc/scanbd
## else
## PREFIX = $(DESTDIR)/usr
## SCANBD_CFG_DIR = $(DESTDIR)/etc/scanbd
## endif
## SCANBUTTOND_LIB_DIR=$(SCANBD_CFG_DIR)/scanbuttond/backends
##
## BIN_DIR = $(PREFIX)/bin
ifndef BIN_DIR
BIN_DIR := $(PREFIX)/sbin
endif
ifndef SCANBD_CFG_DIR
SCANBD_CFG_DIR := $(PREFIX)/etc/scanbd
endif
ifndef SCANBUTTOND_LIB_DIR
SCANBUTTOND_LIB_DIR := $(PREFIX)/lib/scanbuttond
endif
#
# Saned path
# ==========
#
ifndef SANED_PATH
SANED_PATH := $(shell PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/usr/local/bin:/usr/local//sbin:/usr/local/libexec which saned)
endif
#
# OS dependent settings
# ======================
#
ifndef DBUS_PREFIX
ifeq ($(OSTYPE),FreeBSD)
DBUS_PREFIX := /usr/local
else
ifndef DESTDIR
DBUS_PREFIX :=
else
DBUS_PREFIX := $(DESTDIR)
endif # DESTDIR
endif # OSTYPE
endif # DBUS_PREFIX
ifndef USE_LIBUDEV
ifndef USE_HAL
ifeq ($(OSTYPE),Linux)
USE_LIBUDEV := yes
else
USE_LIBUDEV :=
endif
ifndef USE_LIBUDEV
USE_HAL := yes
endif
endif # USE_HAL
endif # USE_UDEV
#
# Use sane or scanbuttond?
# ========================
#
ifndef USE_SCANBUTTOND
USE_SANE := yes
endif
#
# Disable debugging code?
# =======================
#
ifdef NDEBUG
CPPFLAGS += -DNDEBUG
endif
#
# CPP and LD flags
# =================
#
ifeq ($(OSTYPE),Linux)
CPPFLAGS += -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include $(DBUS_INCLUDE) -DHAVE_LINUX_LIMITS_H -I../scanbuttond/include
endif
ifeq ($(OSTYPE),FreeBSD)
CPPFLAGS += -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/include/dbus-1.0/include $(DBUS_INCLUDE) -I../scanbuttond/include
LDLIBS += -L/usr/local/lib
endif
ifeq ($(OSTYPE),NetBSD)
CPPFLAGS += -I/usr/pkg/include -I/usr/pkg/include/dbus-1.0 -I/usr/pkg/lib/dbus-1.0/include $(DBUS_INCLUDE) -I../scanbuttond/include
LDLIBS += -lconfuse -lpthread -ldbus-1
endif
ifeq ($(OSTYPE),OpenBSD)
USE_HAL=
CPPFLAGS += -I/usr/local/include -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include $(DBUS_INCLUDE) -I../scanbuttond/include
LDLIBS += -L/usr/local/lib
endif
ifdef USE_SANE
CPPFLAGS += -DUSE_SANE -UUSE_SCANBUTTOND
LDLIBS += -lsane
else # USE_SANE
CPPFLAGS += -UUSE_SANE -DUSE_SCANBUTTOND -I./scanbuttond/include
LDFLAGS += -rdynamic
LDLIBS += -lusb
ifeq ($(OSTYPE),Linux)
LDLIBS += -ldl
endif
endif # USE_SANE
ifdef USE_HAL
CPPFLAGS += -DUSE_HAL
LDLIBS += -lhal
endif # USE_HAL
ifdef USE_LIBUDEV
CPPFLAGS += -DUSE_LIBUDEV
LDLIBS += -ludev
endif # USE_LIBUDEV
#
# Define common options
# ======================
#
CFLAGS += -Wall -Wextra -std=c99 -g
LDLIBS += -lconfuse -lpthread -ldbus-1
CPPFLAGS += -DSCANBD_CFG_DIR=\"$(SCANBD_CFG_DIR)\" -DSCANBUTTOND_LIB_DIR=\"$(SCANBUTTOND_LIB_DIR)\" \
-DSANED_PATH=\"$(SANED_PATH)\"
#
# SCANBD_USER
# ===========
#
ifndef SCANBD_USER
ifdef USE_LIBUDEV
SCANBD_USER := saned
else
ifeq ($(OSTYPE),OpenBSD)
SCANBD_USER := root
endif
ifeq ($(OSTYPE),FreeBSD)
SCANBD_USER := root
endif
ifeq ($(OSTYPE),NetBSD)
SCANBD_USER := root
endif
ifeq ($(OSTYPE),Linux)
SCANBD_USER := saned
endif
endif # USE_LIBUDEV
endif # SCANBD_USER
#
# SCANBD_GROUP
# ============
#
ifndef SCANBD_GROUP
ifdef USE_LIBUDEV
SCANBD_GROUP := saned
else
ifeq ($(OSTYPE),OpenBSD)
SCANBD_GROUP := lp
endif # OpenBSD
ifeq ($(OSTYPE),FreeBSD)
SCANBD_GROUP := lp
endif
ifeq ($(OSTYPE),NetBSD)
SCANBD_GROUP := lp
endif
ifeq ($(OSTYPE),Linux)
ifeq ($(shell grep scanner: /etc/passwd), "scanner:")
SCANBD_GROUP := scanner
else
SCANBD_GROUP := lp
endif
endif
endif # USE_LIBUDEV
endif # SCANBD_GROUP