From 225a789bf9fe4d65d063198165a6465442ecc387 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 9 Oct 2014 01:50:14 +0200 Subject: add installer for example scripts --- src/Makefile | 27 +++++++++++++++++++++++---- src/configure | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index a6ea007..e483963 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,8 +36,9 @@ ifneq ($(MAKECMDGOALS),distclean) include include.mk endif -EXECUTABLE_RTP := sydra-rtp -EXECUTABLE_LAUNCH := sydra-launch +SUITE_NAME := sydra +EXECUTABLE_RTP := $(SUITE_NAME)-rtp +EXECUTABLE_LAUNCH := $(SUITE_NAME)-launch EXECUTABLES := $(EXECUTABLE_RTP) $(EXECUTABLE_LAUNCH) C_OBJS_COMMON := log.o \ @@ -47,12 +48,12 @@ C_OBJS_RTP := $(C_OBJS_COMMON) \ options-rtp.o \ pipelines-rtp.o \ udp.o \ - sydra-rtp.o + $(SUITE_NAME)-rtp.o C_OBJS_LAUNCH := $(C_OBJS_COMMON) \ options-launch.o \ pipelines-launch.o \ - sydra-launch.o + $(SUITE_NAME)-launch.o C_SRCS_RTP := $(C_OBJS_RTP:%.o=%.c) C_SRCS_LAUNCH := $(C_OBJS_LAUNCH:%.o=%.c) @@ -106,6 +107,11 @@ INSTALL_TARGETS += install-man REMOVE_TARGETS += remove-man endif +ifdef EXAMPLESDIR +INSTALL_TARGETS += install-examples +REMOVE_TARGETS += remove-examples +endif + install: all $(INSTALL_TARGETS) install-bin: $(EXECUTABLES) @@ -118,6 +124,16 @@ install-man: manpage $(INSTALL) -m 644 ../doc/$(EXECUTABLE_RTP).8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE_RTP).8 $(INSTALL) -m 644 ../doc/$(EXECUTABLE_LAUNCH).8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE_LAUNCH).8 +install-examples: + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(SUITE_NAME) + @( for dir in `ls '../scripts/'`; do \ + if [ -d "../scripts/$$dir" ]; then \ + echo "install $$dir example" ; \ + $(CP) -a "../scripts/$$dir" $(DESTDIR)$(EXAMPLESDIR)/$(SUITE_NAME)/ ; \ + fi ; \ + done \ + ) + uninstall: remove remove: $(REMOVE_TARGETS) @@ -129,3 +145,6 @@ remove-bin: remove-man: rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE_RTP).8 rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE_LAUNCH).8 + +remove-examples: + rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/ diff --git a/src/configure b/src/configure index 01970d6..af3caf5 100755 --- a/src/configure +++ b/src/configure @@ -43,6 +43,8 @@ PREFIX='/usr/local' BINDIR='' MANDIR='' INSTALLMANPAGE=1 +EXAMPLESDIR='' +INSTALLEXAMPLES=1 print_usage() { echo "configure --help print this" @@ -51,6 +53,8 @@ print_usage() { echo " --bindir= the path to the bin directory (default: \$PREFIX/bin)" echo " --mandir= the path to the system man pages (default: \$PREFIX/share/man)" echo " --no-manpage dont't install manpages" + echo " --examplesdir= the path to the examples files (default: \$PREFIX/share/examples)" + echo " --no-examples dont't install example files" echo " --use-clang use clang/llvm as compiler/linker" } @@ -72,6 +76,12 @@ do --no-manpage) INSTALLMANPAGE=0 ;; + --examplesdir=*) + EXAMPLESDIR=${arg#--examplesdir=} + ;; + --no-examples) + INSTALLEXAMPLES=0 + ;; --use-clang) USE_CLANG=1 ;; @@ -133,6 +143,10 @@ if [ -z "$MANDIR" ]; then MANDIR=$PREFIX/share/man fi +if [ -z "$EXAMPLESDIR" ]; then + EXAMPLESDIR=$PREFIX/share/examples +fi + cat > include.mk <> include.mk + echo "installing example files" +else + echo "not installing example files" +fi + VERSION=`cat ../version` if which git >/dev/null; then GIT_HASH=`git rev-parse HEAD 2> /dev/null` @@ -213,6 +235,11 @@ if [ $INSTALLMANPAGE -eq 1 ]; then echo "#define MANDIR \"$MANDIR\"" >> config-rtp.h fi +if [ $INSTALLEXAMPLES -eq 1 ]; then + echo "#define EXAMPLESDIR \"$EXAMPLESDIR\"" >> config-launch.h + echo "#define EXAMPLESDIR \"$EXAMPLESDIR\"" >> config-rtp.h +fi + cat >> config-rtp.h <