aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.in
blob: 608ee0f0856518209e2842b5ea7aaadfa6e1fac9 (plain)
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
srcdir		:= @srcdir@
VPATH		:= $(srcdir)

# for package builds (buildroot install + no root privs needed)
DESTDIR=
SUID_ROOT=-m4755 -o root

# install paths
prefix		:= @prefix@
exec_prefix	:= @exec_prefix@
bindir		:= $(DESTDIR)@bindir@
mandir		:= $(DESTDIR)@mandir@
libdir		:= $(DESTDIR)@libdir@/xawtv
resdir		:= $(DESTDIR)@resdir@
config		:= @x11conf@/xawtvrc

# programs
CC		:= @CC@
CXX		:= @CXX@
INSTALL		:= @INSTALL@
INSTALL_PROGRAM := @INSTALL_PROGRAM@ -s
INSTALL_DATA	:= @INSTALL_DATA@
INSTALL_DIR	:= @INSTALL@ -d -m 755

# misc
VERSION		:= @VERSION@

# for CFLAGS
WARN_FLAGS	:= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
LFS_FLAGS	:= -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
X11_FLAGS	:= @X_CFLAGS@ -I/usr/X11R6/include/X11/fonts
LIB_FLAGS	:= -I. -I./vbistuff -I./x11 \
		   -I$(srcdir)/jwz -I$(srcdir)/common -I$(srcdir)/console \
		   -I$(srcdir)/x11 -I$(srcdir)/libng -Llibng

# various libraries
ATHENA_LIBS	:= @X_LIBS@ @LIBS@ @ATHENA@
MOTIF_LIBS	:= @X_LIBS@ @LIBS@ -lXm -lXmu -lXt @X_PRE_LIBS@ \
		   -lXp -lXpm -lXext -lX11 @X_EXTRA_LIBS@
THREAD_LIBS	:= @LIBPTHREAD@
CURSES_LIBS	:= @LIBCURSES@
LIRC_LIBS	:= @LIRC@
OSS_LIBS	:= @LIBOSS@
ALSA_LIBS	:= @LIBALSA@
AA_LIBS		:= @AALIBS@
QT_LIBS		:= @QTLIBS@
VBI_LIBS	:= @LIBZVBI@ -lm
GL_LIBS		:= @LIBGL@
DV_LIBS		:= @LIBDV@
FS_LIBS		:= -L@x_libraries@ @FSLIB@
DLFLAGS		:= @DLFLAGS@

# stuff configure has found
FOUND_AALIB	:= @FOUND_AALIB@
FOUND_ALSA	:= @FOUND_ALSA@
FOUND_DV	:= @FOUND_DV@
FOUND_GL	:= @FOUND_GL@
FOUND_LQT	:= @FOUND_LQT@
FOUND_MOTIF	:= @FOUND_MOTIF@
FOUND_OS	:= @FOUND_OS@
FOUND_X11	:= @FOUND_X11@
FOUND_ZVBI	:= @FOUND_ZVBI@

# build final cflags
CFLAGS	:= @CFLAGS@
CFLAGS	+= $(WARN_FLAGS)
CFLAGS	+= $(LFS_FLAGS)
CFLAGS	+= $(X11_FLAGS)
CFLAGS	+= $(LIB_FLAGS)
CFLAGS	+= -DCONFIGFILE='"$(config)"'
CFLAGS	+= -DLIBDIR='"$(libdir)"'
CFLAGS	+= -DVERSION='"$(VERSION)"'
CXXFLAGS = $(CFLAGS)

# shared objects need -fPIC
%.so : CFLAGS += -fPIC

# libraries
LDLIBS  := @LDLIBS@


#########################################################
# targets

build: all

Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
	$(srcdir)/configure

$(srcdir)/configure: $(srcdir)/configure.ac
	(cd $(srcdir); autoconf && autoheader)

install:: all
	$(INSTALL_DIR) $(bindir)

clean::
	find . -name \*~ -print | xargs rm -f
	find . -name \*.o -print | xargs rm -f
	find . -name \*.a -print | xargs rm -f
	find . -name \*.dep -print | xargs rm -f
	rm -f .deps.*

distclean:: clean
	-rm -f Makefile Make.config
	-rm -f config.cache config.h config.log config.status
	cp Makefile.clean Makefile

realclean:: distclean
	find . -name snap0*.ppm  -print | xargs -i rm -f
	find . -name snap0*.jpeg -print | xargs -i rm -f
	find . -name .nfs* -print | xargs -i rm -f
	find . -name core.* -print | xargs -i rm -f


#########################################################
# some rules ...

tmpdep		= $*.dep
depfile		= .deps.$(subst /,_,$*)

compile_c	= $(CC) $(CFLAGS) -Wp,-MD,$(tmpdep) -c -o $@ $<
compile_cc	= $(CXX) $(CXXFLAGS) -Wp,-MD,$(tmpdep) -c -o $@ $<
fixup_deps	= sed -e "s|.*\.o:|$@::|" < $(tmpdep) > $(depfile) && rm -f $(tmpdep)

link_app	= $(CC) $(LDFLAGS) -o $@  $^ $(LDLIBS)
link_so		= $(CC) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $< $(LDLIBS)
ar_lib		= rm -f $@ && ar -r $@ $^ && ranlib $@

# non-verbose output
VERBOSE		= no
ifeq ($(VERBOSE),yes)
echo_compile_c	= echo $(compile_c)
echo_compile_cc	= echo $(compile_cc)
echo_link_app	= echo $(link_app)
echo_link_so	= echo $(link_so)
echo_ar_lib	= echo $(ar_lib)
else
echo_compile_c	= echo "compile	" $@
echo_compile_cc	= echo "compile	" $@
echo_link_app	= echo "link	" $@
echo_link_so	= echo "link	" $@
echo_ar_lib	= echo "archive	" $@
endif

.SUFFIXES: .c .cc .h .o .so .in .ad
# .bdf .pcf.gz

.c.o:
	@$(echo_compile_c)
	@$(compile_c)
	@$(fixup_deps)

.cc.o:
	@$(echo_compile_cc)
	@$(compile_cc)
	@$(fixup_deps)

.o.so:
	@$(echo_link_so)
	@$(link_so)

%: %.o
	@$(echo_link_app)
	@$(link_app)

.in.h:
	perl $(srcdir)/scripts/html.pl < $< > $@

.ad.h:
	perl $(srcdir)/scripts/fallback.pl < $< > $@

#.bdf.pcf.gz:
#	bdftopcf -o $*.pcf $<
#	gzip $*.pcf


#########################################################
# include stuff

# must come first
include $(srcdir)/common/Subdir.mk

# subdirs
include $(srcdir)/console/Subdir.mk
include $(srcdir)/debug/Subdir.mk
include $(srcdir)/libng/Subdir.mk
include $(srcdir)/libng/plugins/Subdir.mk
include $(srcdir)/libng/contrib-plugins/Subdir.mk
include $(srcdir)/man/Subdir.mk
include $(srcdir)/scripts/Subdir.mk
include $(srcdir)/vbistuff/Subdir.mk
include $(srcdir)/x11/Subdir.mk

# dependences
-include .deps.*


#########################################################
# just for me, some maintaining jobs.  Don't use them

checkit: distclean
	dpkg-buildpackage -tc -us -uc -rfakeroot
	lintian ../xawtv_*.changes

release: distclean
	dpkg-buildpackage -tc -rfakeroot

port:
	dpkg-buildpackage -b -tc -rfakeroot

tarball: distclean
	(cd ..; tar cvzf xawtv_$(VERSION).tar.gz \
		xawtv-$(VERSION))

rpm: tarball
	rpm -ta ../xawtv_$(VERSION).tar.gz

snapshot: distclean
	(cd ..; tar cvzf xawtv-snap-`date +%Y-%m-%d`.tar.gz \
		xawtv-$(VERSION))

Privacy Policy