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
|
# config
srcdir = .
VPATH = $(srcdir)
-include Make.config
include $(srcdir)/mk/Variables.mk
resdir = $(DESTDIR)$(RESDIR)
# fixup flags
CFLAGS += -DVERSION='"$(VERSION)"' -I$(srcdir)
# default target
all: build
# what to build
TARGETS := exiftran thumbnail.cgi
ifeq ($(HAVE_LINUX_FB_H),yes)
TARGETS += fbi
endif
ifeq ($(HAVE_MOTIF),yes)
TARGETS += ida
endif
#################################################################
# poor man's autoconf ;-)
include $(srcdir)/mk/Autoconf.mk
define make-config
LIB := $(LIB)
RESDIR := $(call ac_resdir)
HAVE_ENDIAN_H := $(call ac_header,endian.h)
HAVE_LINUX_FB_H := $(call ac_header,linux/fb.h)
HAVE_GLIBC := $(call ac_func,fopencookie)
HAVE_STRCASESTR := $(call ac_func,strcasestr)
HAVE_LIBPCD := $(call ac_lib,pcd_open,pcd)
HAVE_LIBUNGIF := $(call ac_lib,DGifOpenFileName,ungif)
HAVE_LIBPNG := $(call ac_lib,png_read_info,png,-lz)
HAVE_LIBTIFF := $(call ac_lib,TIFFOpen,tiff)
#HAVE_LIBMAGICK := $(call ac_binary,Magick-config)
HAVE_LIBSANE := $(call ac_lib,sane_init,sane)
HAVE_LIBCURL := $(call ac_lib,curl_easy_init,curl)
HAVE_LIBLIRC := $(call ac_lib,lirc_init,lirc_client)
HAVE_MOTIF := $(call ac_lib,XmStringGenerate,Xm,-L/usr/X11R6/$(LIB) -lXpm -lXt -lXext -lX11)
endef
# transparent http/ftp access using curl depends on fopencookie (glibc)
ifneq ($(HAVE_GLIBC),yes)
HAVE_LIBCURL := no
endif
# catch fopen calls for transparent ftp/http access
ifeq ($(HAVE_LIBCURL),yes)
ida fbi : CFLAGS += -D_GNU_SOURCE
ida fbi : LDFLAGS += -Wl,--wrap=fopen
endif
########################################################################
# conditional stuff
includes = ENDIAN_H STRCASESTR
libraries = PCD UNGIF PNG TIFF CURL SANE LIRC
ida_libs = PCD UNGIF PNG TIFF CURL SANE
fbi_libs = PCD UNGIF PNG TIFF CURL LIRC
#MAGICK_CFLAGS = $(shell Magick-config --cflags)
#MAGICK_LDFLAGS = $(shell Magick-config --ldflags)
#MAGICK_LDLIBS = $(shell Magick-config --libs)
#MAGICK_OBJS := rd/magick.o
PNG_LDLIBS := -lpng -lz
TIFF_LDLIBS := -ltiff
PCD_LDLIBS := -lpcd
UNGIF_LDLIBS := -lungif
SANE_LDLIBS := -lsane
CURL_LDLIBS := -lcurl
LIRC_LDLIBS := -llirc_client
PNG_OBJS := rd/read-png.o wr/write-png.o
TIFF_OBJS := rd/read-tiff.o wr/write-tiff.o
PCD_OBJS := rd/read-pcd.o
UNGIF_OBJS := rd/read-gif.o
SANE_OBJS := sane.o
CURL_OBJS := curl.o
LIRC_OBJS := lirc.o
# common objs
OBJS_READER := readers.o rd/read-ppm.o rd/read-bmp.o rd/read-jpeg.o
OBJS_WRITER := writers.o wr/write-ppm.o wr/write-ps.o wr/write-jpeg.o
# update various flags depending on HAVE_*
CFLAGS += $(call ac_inc_cflags,$(includes))
CFLAGS += $(call ac_lib_cflags,$(libraries))
CFLAGS += $(call ac_lib_mkvar,$(libraries),CFLAGS)
LDFLAGS += $(call ac_lib_mkvar,$(libraries),LDFLAGS)
# link which conditional libs
ida : LDLIBS += $(call ac_lib_mkvar,$(ida_libs),LDLIBS)
fbi : LDLIBS += $(call ac_lib_mkvar,$(fbi_libs),LDLIBS)
########################################################################
# rules for the small tools
# jpeg/exif libs
exiftran : LDLIBS += -ljpeg -lexif -lm
genthumbnail : LDLIBS += -ljpeg -lexif -lm
thumbnail.cgi : LDLIBS += -lexif -lm
exiftran: exiftran.o genthumbnail.o jpegtools.o jpeg/transupp.o \
filter.o op.o readers.o rd/read-jpeg.o
thumbnail.cgi: thumbnail.cgi.o
########################################################################
# rules for ida
# object files
OBJS_IDA := \
ida.o man.o hex.o x11.o viewer.o dither.o icons.o \
parseconfig.o idaconfig.o fileops.o desktop.o \
RegEdit.o selections.o xdnd.o jpeg/transupp.o \
filebutton.o filelist.o browser.o jpegtools.o \
op.o filter.o lut.o color.o \
rd/read-xwd.o rd/read-xpm.o
OBJS_IDA += $(call ac_lib_mkvar,$(ida_libs),OBJS)
# for X11 + Motif
ida : CFLAGS += -I/usr/X11R6/include
ida : LDFLAGS += -L/usr/X11R6/$(LIB)
ida : LDLIBS += -lXm -lXpm -lXt -lXext -lX11
# jpeg/exif libs
ida : LDLIBS += -ljpeg -lexif -lm
# RegEdit.c is good old K&R ...
RegEdit.o : CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes
ida: $(OBJS_IDA) $(OBJS_READER) $(OBJS_WRITER)
Ida.ad.h: Ida.ad $(srcdir)/fallback.pl
perl $(srcdir)/fallback.pl < $< > $@
logo.h: logo.jpg
hexdump -v -e '1/1 "0x%02x,"' < $< > $@
echo >> $@ # make gcc 3.x happy
ida.o: Ida.ad.h logo.h
########################################################################
# rules for fbi
# object files
OBJS_FBI := \
fbi.o fbtools.o fs.o fb-gui.o desktop.o \
parseconfig.o fbiconfig.o \
jpegtools.o jpeg/transupp.o \
dither.o filter.o op.o
OBJS_FBI += $(filter-out wr/%,$(call ac_lib_mkvar,$(fbi_libs),OBJS))
# jpeg/exif libs
fbi : LDLIBS += -ljpeg -lexif -lm
fs.o fb-gui.o : CFLAGS += -DX_DISPLAY_MISSING=1
fbi: $(OBJS_FBI) $(OBJS_READER)
########################################################################
# general rules
.PHONY: build install clean distclean realclean
build: $(TARGETS)
install: build
$(INSTALL_DIR) $(bindir)
$(INSTALL_DIR) $(mandir)/man1
$(INSTALL_BINARY) exiftran $(bindir)
$(INSTALL_DATA) $(srcdir)/exiftran.man $(mandir)/man1/exiftran.1
ifeq ($(HAVE_LINUX_FB_H),yes)
$(INSTALL_BINARY) fbi fbgs $(bindir)
$(INSTALL_DATA) $(srcdir)/fbi.man $(mandir)/man1/fbi.1
$(INSTALL_DATA) $(srcdir)/fbgs.man $(mandir)/man1/fbgs.1
endif
ifeq ($(HAVE_MOTIF),yes)
$(INSTALL_BINARY) ida $(bindir)
$(INSTALL_DATA) $(srcdir)/ida.man $(mandir)/man1/ida.1
$(INSTALL_DIR) $(resdir)/app-defaults
$(INSTALL_DATA) $(srcdir)/Ida.ad $(resdir)/app-defaults/Ida
endif
clean:
-rm -f *.o jpeg/*.o rd/*.o wr/*.o $(depfiles) core core.*
realclean distclean: clean
-rm -f Make.config
-rm -f $(TARGETS) *~ rd/*~ wr/*~ xpm/*~ Ida.ad.h logo.h
include $(srcdir)/mk/Compile.mk
-include $(depfiles)
########################################################################
# maintainer stuff
include $(srcdir)/mk/Maintainer.mk
sync::
cp $(srcdir)/../xawtv/common/parseconfig.[ch] $(srcdir)
cp $(srcdir)/../xawtv/console/fbtools.[ch] $(srcdir)
cp $(srcdir)/../xawtv/console/fs.[ch] $(srcdir)
|