From f080365c72a6aecb34e3632df07431b9e1522665 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 7 Oct 2014 23:16:08 +0200 Subject: prepared build system for multiple binaries --- .gitignore | 2 +- src/Makefile | 44 ++++++++++++++++++++++++-------------------- src/configure | 24 +++++++++++++++++++++++- src/options.c | 2 +- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 11d311f..9b1fb53 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ src/sydra-rtp src/*.o src/*.d src/*.d.* -src/config.h +src/config*.h src/recordings/ diff --git a/src/Makefile b/src/Makefile index 9db9ead..a45140b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,20 +36,24 @@ ifneq ($(MAKECMDGOALS),distclean) include include.mk endif -EXECUTABLE := sydra-rtp +EXECUTABLE_RTP := sydra-rtp +EXECUTABLES := $(EXECUTABLE_RTP) -C_OBJS := log.o \ - options.o \ - utils.o \ - pipelines.o \ - udp.o \ - sydra-rtp.o +C_OBJS_COMMON := log.o \ + options.o \ + utils.o \ + pipelines.o \ + udp.o -C_SRCS := $(C_OBJS:%.o=%.c) +C_OBJS_RTP := $(C_OBJS_COMMON) \ + sydra-rtp.o + +C_SRCS_RTP := $(C_OBJS_RTP:%.o=%.c) +C_SRCS := $(C_SRCS_RTP) .PHONY: clean cleanall distclean manpage install install-bin uninstall remove -all: $(EXECUTABLE) +all: $(EXECUTABLES) %.d: %.c @set -e; rm -f $@; \ @@ -61,27 +65,27 @@ ifneq ($(MAKECMDGOALS),distclean) -include $(C_SRCS:%.c=%.d) endif -$(EXECUTABLE): $(C_OBJS) - $(CC) $(C_OBJS) -o $@ $(LDFLAGS) +$(EXECUTABLE_RTP): $(C_OBJS_RTP) + $(CC) $(C_OBJS_RTP) -o $@ $(LDFLAGS) %.o: %.c $(CC) $(CFLAGS) -c $< -strip: $(EXECUTABLE) - $(STRIP) -s $(EXECUTABLE) +strip: $(EXECUTABLES) + $(STRIP) -s $(EXECUTABLE_RTP) distclean: clean find . -name *.o -exec rm -f {} \; find . -name "*.\~*" -exec rm -rf {} \; rm -f include.mk - rm -f config.h + rm -f config*.h clean: rm -f *.o rm -f *.d rm -f *.d.* - rm -f $(EXECUTABLE) + rm -f $(EXECUTABLES) INSTALL_TARGETS := install-bin REMOVE_TARGETS := remove-bin @@ -93,20 +97,20 @@ endif install: all $(INSTALL_TARGETS) -install-bin: $(EXECUTABLE) +install-bin: $(EXECUTABLES) $(INSTALL) -d $(DESTDIR)$(BINDIR) - $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR) + $(INSTALL) -m 755 $(EXECUTABLE_RTP) $(DESTDIR)$(BINDIR) install-man: manpage $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/ - $(INSTALL) -m 644 ../doc/$(EXECUTABLE).8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8 + $(INSTALL) -m 644 ../doc/$(EXECUTABLE_RTP).8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE_RTP).8 uninstall: remove remove: $(REMOVE_TARGETS) remove-bin: - rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE) + rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE_RTP) remove-man: - rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8 + rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE_RTP).8 diff --git a/src/configure b/src/configure index 077ffe4..73a1de7 100755 --- a/src/configure +++ b/src/configure @@ -147,7 +147,7 @@ fi HOSTNAME=`hostname` DATE=`date +"%d.%m.%Y %H:%M:%S %Z"` -cat > config.h < config-rtp.h < config.h < config-launch.h <