forked from sackmotion/motion
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.in
290 lines (256 loc) · 13.4 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
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
################################################################################
# Makefile for Motion #
################################################################################
# Copyright 2000 by Jeroen Vreeken #
# #
# This program is published under the GNU public license version 2.0 or later. #
# Please read the file COPYING for more info. #
################################################################################
# Please visit the Motion home page: #
# http://www.lavrsen.dk/twiki/bin/view/Motion #
################################################################################
CC = @CC@
INSTALL = install
INSTALL_DATA = ${INSTALL} -m 644
################################################################################
# Install locations, controlled by setting configure flags. #
################################################################################
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = $(datadir)/doc/@PACKAGE_NAME@-@PACKAGE_VERSION@
examplesdir = $(datadir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/examples
################################################################################
# These variables contain compiler flags, object files to build and files to #
# install. #
################################################################################
CFLAGS = @CFLAGS@ -Wall -DVERSION=\"@PACKAGE_VERSION@\" -Dsysconfdir=\"$(sysconfdir)\"
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
VIDEO_OBJ = @VIDEO@
OBJ = motion.o logger.o conf.o draw.o jpegutils.o vloopback_motion.o $(VIDEO_OBJ) \
netcam.o netcam_ftp.o netcam_jpeg.o netcam_wget.o track.o \
alg.o event.o picture.o rotate.o webhttpd.o \
stream.o md5.o netcam_rtsp.o @FFMPEG_OBJ@ @SDL_OBJ@
SRC = $(OBJ:.o=.c)
DOC = CHANGELOG COPYING CREDITS README motion_guide.html
EXAMPLES = *.conf
EXAMPLES_BIN = motion.init-Debian motion.init-Fedora motion.init-FreeBSD.sh
PROGS = motion
DEPEND_FILE = .depend
################################################################################
# ALL and PROGS build Motion and, possibly, Motion-control. #
################################################################################
all: progs
ifneq (,$(findstring freebsd,$(VIDEO_OBJ)))
@echo "Build complete, run \"gmake install\" to install Motion!"
else
@echo "Build complete, run \"make install\" to install Motion!"
endif
@echo
progs: pre-build-info $(PROGS)
################################################################################
# PRE-BUILD-INFO outputs some general info before the build process starts. #
################################################################################
pre-build-info:
@echo "Welcome to the setup procedure for Motion, the motion detection daemon! If you get"
@echo "error messages during this procedure, please report them to the mailing list. The"
@echo "Motion Guide contains all information you should need to get Motion up and running."
@echo "Run \"make updateguide\" to download the latest version of the Motion Guide."
@echo
@echo "Version: @PACKAGE_VERSION@"
ifneq (,$(findstring freebsd,$(VIDEO_OBJ)))
@echo "Platform: FreeBSD"
else
@echo "Platform: Linux (if this is incorrect, please read README.FreeBSD)"
endif
@echo
################################################################################
# MOTION builds motion. MOTION-OBJECTS and PRE-MOBJECT-INFO are helpers. #
################################################################################
motion: motion-objects
@echo "Linking Motion..."
@echo "--------------------------------------------------------------------------------"
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
@echo "--------------------------------------------------------------------------------"
@echo "Motion has been linked."
@echo
motion-objects: dep pre-mobject-info $(OBJ)
@echo "--------------------------------------------------------------------------------"
@echo "Motion object files compiled."
@echo
pre-mobject-info:
@echo "Compiling Motion object files..."
@echo "--------------------------------------------------------------------------------"
################################################################################
# Define the compile command for C files. #
################################################################################
#%.o: %.c
# @echo -e "\tCompiling $< into $@..."
# @$(CC) -c $(CFLAGS) $< -o $@
################################################################################
# Include the dependency file if it exists. #
################################################################################
ifeq ($(DEPEND_FILE), $(wildcard $(DEPEND_FILE)))
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
-include $(DEPEND_FILE)
endif
endif
################################################################################
# Make the dependency file depend on all header files and all relevant source #
# files. This forces the file to be re-generated if the source/header files #
# change. Note, however, that the existing version will be included before #
# re-generation. #
################################################################################
$(DEPEND_FILE): *.h $(SRC)
@echo "Generating dependencies, please wait..."
@$(CC) $(CFLAGS) -M $(SRC) > .tmp
@mv -f .tmp $(DEPEND_FILE)
@echo
################################################################################
# DEP, DEPEND and FASTDEP generate the dependency file. #
################################################################################
dep depend fastdep: $(DEPEND_FILE)
################################################################################
# DEV, BUILD with developer flags #
################################################################################
dev: distclean autotools all
################################################################################
# DEV-GIT, BUILD with developer flags #
################################################################################
dev-git: distclean autotools-git all
################################################################################
# GIT, BUILD with developer flags #
################################################################################
build-commit-git: distclean set-version-git all
################################################################################
# CURRENT, BUILD current svn trunk. #
################################################################################
current: distclean svn autotools all
svn:
svn update
autotools:
@sed -i 's/.\/commit-version.sh/.\/version.sh/g' configure.in
autoconf
./configure --with-developer-flags
autotools-git:
@sed -i 's/.\/git-commit-version.sh/.\/version.sh/g' configure.in
autoconf
./configure --with-developer-flags
build-commit: distclean svn set-version all
set-version:
@sed -i 's/.\/version.sh/.\/commit-version.sh/g' configure.in
autoconf
@sed -i 's/.\/commit-version.sh/.\/version.sh/g' configure.in
./configure --with-developer-flags
set-version-git:
@sed -i 's/.\/version.sh/.\/git-commit-version.sh/g' configure.in
autoconf
@sed -i 's/.\/git-commit-version.sh/.\/version.sh/g' configure.in
./configure --with-developer-flags
help:
@echo "--------------------------------------------------------------------------------"
@echo "make Build motion from local copy in your computer"
@echo "make current Build last version of motion from svn"
@echo "make dev Build motion with dev flags"
@echo "make dev-git Build motion with dev flags for git"
@echo "make build-commit Build last version of motion and prepare to commit to svn"
@echo "make build-commit-git Build last version of motion and prepare to commit to git"
@echo "make clean Clean objects"
@echo "make distclean Clean everything"
@echo "make install Install binary , examples , docs and config files"
@echo "make uninstall Uninstall all installed files"
@echo "--------------------------------------------------------------------------------"
@echo
################################################################################
# INSTALL installs all relevant files. #
################################################################################
install:
@echo "Installing files..."
@echo "--------------------------------------------------------------------------------"
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(mandir)/man1
mkdir -p $(DESTDIR)$(sysconfdir)/motion
mkdir -p $(DESTDIR)$(docdir)
mkdir -p $(DESTDIR)$(examplesdir)
$(INSTALL_DATA) motion.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) $(DOC) $(DESTDIR)$(docdir)
$(INSTALL_DATA) $(EXAMPLES) $(DESTDIR)$(examplesdir)
$(INSTALL) $(EXAMPLES_BIN) $(DESTDIR)$(examplesdir)
$(INSTALL_DATA) motion-dist.conf $(DESTDIR)$(sysconfdir)/motion
$(INSTALL_DATA) thread1.conf $(DESTDIR)$(sysconfdir)/motion
$(INSTALL_DATA) thread2.conf $(DESTDIR)$(sysconfdir)/motion
$(INSTALL_DATA) thread3.conf $(DESTDIR)$(sysconfdir)/motion
$(INSTALL_DATA) thread4.conf $(DESTDIR)$(sysconfdir)/motion
for prog in $(PROGS); \
do \
($(INSTALL) $$prog $(DESTDIR)$(bindir) ); \
done
@echo "--------------------------------------------------------------------------------"
@echo "Install complete! The default configuration file, motion-dist.conf, has been"
@echo "installed to $(sysconfdir)/motion. You need to rename/copy it to motion.conf"
@echo "for Motion to find it. More configuration examples as well as init scripts"
@echo "can be found in $(examplesdir)."
@echo
################################################################################
# UNINSTALL and REMOVE uninstall already installed files. #
################################################################################
uninstall remove: pre-build-info
@echo "Uninstalling files..."
@echo "--------------------------------------------------------------------------------"
for prog in $(PROGS); \
do \
($ rm -f $(bindir)/$$prog ); \
done
rm -f $(mandir)/man1/motion.1
rm -f $(sysconfdir)/motion/motion-dist.conf
rm -f $(sysconfdir)/motion/thread1.conf
rm -f $(sysconfdir)/motion/thread2.conf
rm -f $(sysconfdir)/motion/thread3.conf
rm -f $(sysconfdir)/motion/thread4.conf
rm -rf $(docdir)
rm -rf $(examplesdir)
@echo "--------------------------------------------------------------------------------"
@echo "Uninstall complete!"
@echo
################################################################################
# CLEAN is basic cleaning; removes object files and executables, but does not #
# remove files generated from the configure step. #
################################################################################
clean: pre-build-info
@echo "Removing compiled files and binaries..."
@rm -f *~ *.jpg *.o $(PROGS) combine $(DEPEND_FILE)
################################################################################
# DIST restores the directory to distribution state. #
################################################################################
dist: distclean updateguide
@chmod -R 644 *
@chmod 755 configure
@chmod 755 version.sh
################################################################################
# DISTCLEAN removes all files generated during the configure step in addition #
# to basic cleaning. #
################################################################################
distclean: clean
@echo "Removing files generated by configure..."
@rm -f config.status config.log config.cache Makefile motion.init-Fedora motion.init-Debian motion.init-FreeBSD.sh
@rm -f thread1.conf thread2.conf thread3.conf thread4.conf motion-dist.conf motion-help.conf motion.spec
@rm -rf autom4te.cache config.h
@echo "You will need to re-run configure if you want to build Motion."
@echo
################################################################################
# UPDATEGUIDE downloads the Motion Guide from TWiki. #
################################################################################
updateguide: pre-build-info
@echo "Downloading Motion Guide. If it fails, please check your Internet connection."
@echo
wget www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideOneLargeDocument?skin=text -O motion_guide.tmp
@echo "Cleaning up and fixing links..."
@cat motion_guide.tmp | sed -e 's/\?skin=text//g;s,"/twiki/,"http://www.lavrsen.dk/twiki/,g' > motion_guide.html
@rm -f motion_guide.tmp
@echo "All done, you should now have an up-to-date local copy of the Motion guide."
@echo