File: Makefile.am

package info (click to toggle)
sane-backends-extras 1.0.22.4
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,080 kB
  • ctags: 2,710
  • sloc: ansic: 27,680; sh: 10,433; makefile: 448
file content (196 lines) | stat: -rw-r--r-- 7,461 bytes parent folder | download | duplicates (3)
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
##  Makefile.am -- an automake template for Makefile.in file
##  Copyright (C) 2009 Chris Bagwell, Olaf Meeuwissen, and Sane Developers.
##
##  This file is part of the "Sane" build infra-structure.  See
##  included LICENSE file for license information.

INSTALL_LOCKPATH = @INSTALL_LOCKPATH@
LOCKPATH_GROUP = @LOCKPATH_GROUP@

BACKEND_LIBS_ENABLED=@BACKEND_LIBS_ENABLED@
BACKEND_CONFS_ENABLED=@BACKEND_CONFS_ENABLED@

DL_LIBS = @DL_LIBS@ 
LIBV4L_LIBS = @LIBV4L_LIBS@ 
MATH_LIB = @MATH_LIB@ 
IEEE1284_LIBS = @IEEE1284_LIBS@ 
TIFF_LIBS = @TIFF_LIBS@ 
JPEG_LIBS = @JPEG_LIBS@ 
GPHOTO2_LIBS = @GPHOTO2_LIBS@
GPHOTO2_LDFLAGS = @GPHOTO2_LDFLAGS@
SOCKET_LIBS = @SOCKET_LIBS@ 
AVAHI_LIBS = @AVAHI_LIBS@
USB_LIBS = @USB_LIBS@ 
SCSI_LIBS = @SCSI_LIBS@
PTHREAD_LIBS = @PTHREAD_LIBS@

AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="$(libdir)/sane"

V_MAJOR = @V_MAJOR@
V_MINOR = @V_MINOR@
V_REV = @V_REV@

AM_LDFLAGS = @STRICT_LDFLAGS@
# The -rpath option is added because we are creating _LTLIBRARIES based
# on configure substitution.  This causes automake to not know the
# correct $libdir and must be added here.
DIST_SANELIBS_LDFLAGS = $(AM_LDFLAGS) -rpath '$(libdir)/sane' -version-number $(V_MAJOR):$(V_MINOR):$(V_REV) $(DYNAMIC_FLAG)
DIST_LIBS_LDFLAGS = $(AM_LDFLAGS) -rpath '$(libdir)' -version-number $(V_MAJOR):$(V_MINOR):$(V_REV)

# LIBTOOL install is a little to noisy for my liking.
LIBTOOL = @LIBTOOL@ --silent
FIRMWARE_DIRS = 

EXTRA_DIST = sane_strstatus.c

all: becfg

EXTRA_DIST += stubs.c

# FIXME: % is a GNU extension... This is only thing left requiring
# use to use GNU make.
%-s.c: $(srcdir)/stubs.c
	rm -f $@
	$(LN_S) $(srcdir)/stubs.c $@

dll-preload.h:
	rm -f $@
	list="$(PRELOADABLE_BACKENDS)"; for be in $$list; do \
	  echo "PRELOAD_DECL($$be)" >> $@; \
	done
	echo "static struct backend preloaded_backends[] = {" >> $@
	sep=""; \
	list="$(PRELOADABLE_BACKENDS)"; \
	if test -z "$${list}"; then \
	  echo { 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }} >> $@; \
	else \
	  for be in $$list; do \
	    echo "$${sep}PRELOAD_DEFN($$be)" >> $@; \
	    sep=","; \
	  done; \
	fi
	echo "};" >> $@

# TODO: This really belongs together with the saned sources and
# should be installed there as well.
EXTRA_DIST += saned.conf.in

# Backends are not required to have a config file. Any backend
# that wants to install a config file should list it here.
BACKEND_CONFS = geniusvp2.conf
becfg: $(BACKEND_CONFS)

SUFFIXES = .conf.in .conf
.conf.in.conf:
	@echo Generating $@ from $^
	@sed -e 's|@DATADIR@|$(datadir)|g' \
	     -e 's|@CONFIGDIR@|$(configdir)|g' \
	     -e 's|@DOCDIR@|$(docdir)|g' \
	     -e 's|@LIBDIR@|$(libdir)/sane|g' \
	     -e 's|@BINDIR@|$(bindir)|g' \
	     -e 's|@SBINDIR@|$(sbindir)|g' \
	     -e 's|@PACKAGEVERSION@|$(PACKAGE_VERSION)|g' $? > $@

install-data-hook: install-becfg install-firmware-path $(INSTALL_LOCKPATH)

# Custom install target to install config files.  Do not overwrite
# files that have been previously installed so that user modifications
# are not lost.
install-becfg:
	@# Libtool has a bug where it will sometimes symlink the last 
	@# installed library in $(sanelibdir) to $(sanelibdir)/libsane.*.  
	@# Having two libsane's can cause issues so get rid of it.
	-rm -f $(DESTDIR)$(sanelibdir)/libsane.*
	test -z "$(configdir)" || $(MKDIR_P) "$(DESTDIR)$(configdir)"
	test -z "$(configdir)/dll.d" || $(MKDIR_P) "$(DESTDIR)$(configdir)/dll.d"
	@list="$(BACKEND_CONFS_ENABLED) saned.conf dll.conf"; for cfg in $$list; do \
	  if test ! -r $${cfg}; then continue; fi; \
	  if test -f $(DESTDIR)$(configdir)/$${cfg}; then \
	  echo NOT overwriting $${cfg} in $(configdir)...; \
	  else \
	  echo installing $${cfg} in $(configdir)/$${cfg}...; \
	  $(INSTALL_DATA) $${cfg} $(DESTDIR)$(configdir)/$${cfg} \
	  || exit 1; \
	  fi; \
	  done

install-firmware-path:
	for dir in $(FIRMWARE_DIRS) ; do \
	  $(mkinstalldirs) $(DESTDIR)$(datadir)/sane/$${dir} ; \
	  done

install-lockpath:
	$(mkinstalldirs) -m 775 -g $(LOCKPATH_GROUP) $(DESTDIR)$(locksanedir)

uninstall-hook:
	rm -rf $(DESTDIR)$(libdir)/sane $(DESTDIR)$(configdir) $(DESTDIR)$(locksanedir)
	rm -f $(DESTDIR)$(libdir)/libsane.*
	-for dir in $(FIRMWARE_DIRS) ; do \
	  rmdir $(DESTDIR)$(datadir)/sane/$${dir} ; \
	done

CLEANFILES = $(BACKEND_CONFS) $(be_convenience_libs)
clean-local:
	find . -type l -name \*-s.c | xargs rm -f


# Backends
#
# All possible backends should be listed here.  As a first step, we create
# a convenience library containing all files needed to link a backend
# directly into libsane.la.  Convenience library should have the
# form of lib${backend}.la to match what configure will list to
# build.
# Occasionally, this approach will have name conflicts with external
# libraries that need to be linked in.  See libgphoto2_i.la for 
# example of working around that issue.
be_convenience_libs = libgeniusvp2.la libls5000.la

# Each stand alone backend thats possible to be built should be listed
# here.  There are the libraries that are installed under $(libdir)/sane.
# Format is libsane-${backend}.la.
be_dlopen_libs = libsane-geniusvp2.la libsane-ls5000.la

EXTRA_LTLIBRARIES = $(be_convenience_libs) $(be_dlopen_libs)

lib_LTLIBRARIES = 

sanelibdir = $(libdir)/sane
sanelib_LTLIBRARIES = $(BACKEND_LIBS_ENABLED)

COMMON_LIBS = ../lib/liblib.la

# Each backend should define a convenience library that compiles
# all related files within backend directory.  General guideline
# is to have a ${backend}.c and ${backend}.h.  Some backends also
# add a few support source files to convience library.
# Note: automake doesn't really use header files listed here. 
# They are indications that they need to be distributed only.

# Each backend should define a stand alone library that gets installed.
# This will need to link in a special file ${backend}-s.c that allows
# the backend to be stand alone and contain all SANE API functions.
# Also, it will need to link in related convenience library as well as
# any external libraries required to resolve symbols.
#
# All backends should include $(DIST_SANELIBS_LDFLAGS) so that 
# library is correctly versioned.
#
# If a backend has a config file, it must be listed here to get distributed.
libgeniusvp2_la_SOURCES = geniusvp2-adc.c geniusvp2-adc.h geniusvp2-asic.c geniusvp2-asic.h geniusvp2-image.c geniusvp2-image.h \
	geniusvp2-misc.c geniusvp2-misc.h geniusvp2-parport.c geniusvp2-parport.h geniusvp2-registers.h geniusvp2-switcher.c \
	geniusvp2-switcher.h geniusvp2.c geniusvp2.h
libgeniusvp2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=geniusvp2

nodist_libsane_geniusvp2_la_SOURCES = geniusvp2-s.c
libsane_geniusvp2_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=geniusvp2
libsane_geniusvp2_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
libsane_geniusvp2_la_LIBADD = $(COMMON_LIBS) libgeniusvp2.la ../sanei/sanei_init_debug.lo ../sanei/sanei_config.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_thread.lo sane_strstatus.lo $(PTHREAD_LIBS)

libls5000_la_SOURCES = ls5000.c
libls5000_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ls5000

nodist_libsane_ls5000_la_SOURCES = ls5000-s.c
libsane_ls5000_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=ls5000
libsane_ls5000_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
libsane_ls5000_la_LIBADD = $(COMMON_LIBS) libls5000.la ../sanei/sanei_init_debug.lo ../sanei/sanei_config.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_usb.lo sane_strstatus.lo $(USB_LIBS) $(MATH_LIB)