--- Makefile.orig 2010-12-31 15:05:22.000000000 +0100 +++ Makefile 2011-01-06 15:50:07.925298000 +0100 @@ -10,16 +10,16 @@ # specifies where to install the binaries after compilation # to use another directory you can specify it with: # $ sudo make DESTDIR=/some/path install -DESTDIR = /usr/local +TARGETDIR = /usr # set the compiler to use CC = gcc -SVNDEV := -D'SVN_REV="$(shell svnversion -c .)"' -CFLAGS += $(SVNDEV) +#SVNDEV := -D'SVN_REV="$(shell svnversion -c .)"' +#CFLAGS += $(SVNDEV) # general compile flags, enable all warnings to make compile more verbose -CFLAGS += -O2 -DLINUX -D_GNU_SOURCE -Wall +CFLAGS += $(RPM_OPT_FLAGS) -O2 -DLINUX -D_GNU_SOURCE -Wall # CFLAGS += -g #CFLAGS += -DDEBUG @@ -30,6 +30,8 @@ # define the name of the program APP_BINARY = mjpg_streamer +APP_NAME = mjpg-streamer +WRAPPER = mstreamer # define the names and targets of the plugins PLUGINS = input_uvc.so @@ -40,11 +42,11 @@ PLUGINS += output_autofocus.so PLUGINS += input_gspcav1.so PLUGINS += input_file.so -# PLUGINS += output_rtsp.so -# PLUGINS += output_ptp2.so # commented out because it depends on libgphoto +PLUGINS += output_rtsp.so +# PLUGINS += output_ptp2.so # PLUGINS += input_control.so # commented out because the output_http does it's job -# PLUGINS += input_http.so -# PLUGINS += output_viewer.so # commented out because it depends on SDL +# PLUGINS += input_http.so +# PLUGINS += output_viewer.so # define the names of object files OBJECTS=mjpg_streamer.o utils.o @@ -59,68 +61,68 @@ plugins: $(PLUGINS) $(APP_BINARY): mjpg_streamer.c mjpg_streamer.h mjpg_streamer.o utils.c utils.h utils.o - $(CC) $(CFLAGS) $(LFLAGS) $(OBJECTS) -o $(APP_BINARY) + $(CC) $(CFLAGS) $(OBJECTS) -o $(APP_BINARY) $(LFLAGS) chmod 755 $(APP_BINARY) output_autofocus.so: mjpg_streamer.h utils.h - make -C plugins/output_autofocus all + $(MAKE) -C plugins/output_autofocus all cp plugins/output_autofocus/output_autofocus.so . input_testpicture.so: mjpg_streamer.h utils.h - make -C plugins/input_testpicture all + $(MAKE) -C plugins/input_testpicture all cp plugins/input_testpicture/input_testpicture.so . ifeq ($(USE_LIBV4L2),true) input_uvc.so: mjpg_streamer.h utils.h - make -C plugins/input_uvc USE_LIBV4L2=true all + $(MAKE) -C plugins/input_uvc USE_LIBV4L2=true all cp plugins/input_uvc/input_uvc.so . else input_uvc.so: mjpg_streamer.h utils.h - make -C plugins/input_uvc all + $(MAKE) -C plugins/input_uvc all cp plugins/input_uvc/input_uvc.so . endif input_control.so: mjpg_streamer.h utils.h - make -C plugins/input_control all + $(MAKE) -C plugins/input_control all cp plugins/input_control/input_control.so . output_file.so: mjpg_streamer.h utils.h - make -C plugins/output_file all + $(MAKE) -C plugins/output_file all cp plugins/output_file/output_file.so . ifeq ($(WXP_COMPAT),true) output_http.so: mjpg_streamer.h utils.h - make -C plugins/output_http WXP_COMPAT=true all + $(MAKE) -C plugins/output_http WXP_COMPAT=true all cp plugins/output_http/output_http.so . else output_http.so: mjpg_streamer.h utils.h - make -C plugins/output_http all + $(MAKE) -C plugins/output_http all cp plugins/output_http/output_http.so . endif output_udp.so: mjpg_streamer.h utils.h - make -C plugins/output_udp all + $(MAKE) -C plugins/output_udp all cp plugins/output_udp/output_udp.so . input_gspcav1.so: mjpg_streamer.h utils.h - make -C plugins/input_gspcav1 all + $(MAKE) -C plugins/input_gspcav1 all cp plugins/input_gspcav1/input_gspcav1.so . input_file.so: mjpg_streamer.h utils.h - make -C plugins/input_file all + $(MAKE) -C plugins/input_file all cp plugins/input_file/input_file.so . output_rtsp.so: mjpg_streamer.h utils.h - make -C plugins/output_rtsp all + $(MAKE) -C plugins/output_rtsp all cp plugins/output_rtsp/output_rtsp.so . output_ptp2.so: mjpg_streamer.h utils.h - make -C plugins/input_ptp2 all - cp plugins/input_ptp2/input_ptp2.so . + $(MAKE) -C plugins/input_ptp2 all + cp plugins/input_ptp2/input_ptp2.so . #input_http.so: mjpg_streamer.h utils.h -# make -C plugins/input_http all +# $(MAKE) -C plugins/input_http all # cp plugins/input_http/input_http.so . # The viewer plugin requires the SDL library for compilation @@ -129,22 +131,22 @@ # execute the following command: # make output_viewer.so output_viewer.so: mjpg_streamer.h utils.h - make -C plugins/output_viewer all + $(MAKE) -C plugins/output_viewer all cp plugins/output_viewer/output_viewer.so . # cleanup clean: - make -C plugins/input_uvc $@ - make -C plugins/input_testpicture $@ - make -C plugins/output_file $@ - make -C plugins/output_http $@ - make -C plugins/output_udp $@ - make -C plugins/output_autofocus $@ - make -C plugins/input_gspcav1 $@ - make -C plugins/output_viewer $@ - make -C plugins/input_control $@ - make -C plugins/output_rtsp $@ -# make -C plugins/input_http $@ + $(MAKE) -C plugins/input_uvc $@ + $(MAKE) -C plugins/input_testpicture $@ + $(MAKE) -C plugins/output_file $@ + $(MAKE) -C plugins/output_http $@ + $(MAKE) -C plugins/output_udp $@ + $(MAKE) -C plugins/output_autofocus $@ + $(MAKE) -C plugins/input_gspcav1 $@ + $(MAKE) -C plugins/output_viewer $@ + $(MAKE) -C plugins/input_control $@ + $(MAKE) -C plugins/output_rtsp $@ +# $(MAKE) -C plugins/input_http $@ rm -f *.a *.o $(APP_BINARY) core *~ *.so *.lo # useful to make a backup "make tgz" @@ -154,14 +156,22 @@ # install MJPG-streamer and example webpages install: all - install --mode=755 $(APP_BINARY) $(DESTDIR)/bin - install --mode=644 $(PLUGINS) $(DESTDIR)/lib/ - install --mode=755 -d $(DESTDIR)/www - install --mode=644 -D www/* $(DESTDIR)/www + strip $(APP_BINARY) + strip $(PLUGINS) + chmod -x start.sh + install --mode=755 -d $(DESTDIR)$(TARGETDIR)/bin + install --mode=755 $(APP_BINARY) $(DESTDIR)$(TARGETDIR)/bin/ + install --mode=755 start.sh $(DESTDIR)$(TARGETDIR)/bin/$(WRAPPER) + install --mode=755 -d $(DESTDIR)$(LIBDIR)/$(APP_NAME) + install --mode=755 $(PLUGINS) $(DESTDIR)$(LIBDIR)/$(APP_NAME)/ + install --mode=755 -d $(DESTDIR)$(TARGETDIR)/share/$(APP_NAME)/www + install --mode=644 www/* $(DESTDIR)$(TARGETDIR)/share/$(APP_NAME)/www/ # remove the files installed above uninstall: - rm -f $(DESTDIR)/bin/$(APP_BINARY) + rm -f $(DESTDIR)$(TARGETDIR)/bin/$(APP_BINARY) + rm -f $(DESTDIR)$(TARGETDIR)/bin/$(WRAPPER) for plug in $(PLUGINS); do \ - rm -f $(DESTDIR)/lib/$$plug; \ + rm -f $(DESTDIR)$(LIBDIR)/$(APP_NAME)/$$plug; \ done; + rm -f $(DESTDIR)$(TARGETDIR)/share/$(APP_NAME)/www/*