[Pkg-voip-commits] [dahdi-tools] 190/285: xpp: safer compilation

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit ae02edacb44c3fe0e7f43fc58f4265e922592cad
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Sun May 4 11:09:05 2014 -0400

    xpp: safer compilation
    
    * Compile with "-Wall -Werror"
    * Better dependency calculation:
      - Explicit listing of sources, don't use wildcards.
      - Pass various CFLAGS to dependency calculation as well.
      - Make sure a failure is propagated
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
---
 xpp/Makefile | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/xpp/Makefile b/xpp/Makefile
index 49f7b33..ee15fe1 100644
--- a/xpp/Makefile
+++ b/xpp/Makefile
@@ -54,7 +54,8 @@ OCT_DEFINES	= \
 	-DcOCT6100_MAX_ECHO_CHANNELS=672		\
 	-DcOCT6100_MAX_MIXER_EVENTS=1344
 
-ECHO_LOADER	= echo_loader.o
+ECHO_LOADER_SRC	= echo_loader.c
+ECHO_LOADER	= $(ECHO_LOADER_SRC:.c=.o)
 endif
 
 %.8: %
@@ -71,12 +72,33 @@ PERL_SCRIPTS	=	\
 
 PERL_MANS	= $(PERL_SCRIPTS:%=%.8)
 
-XTALK_OBJS		= xtalk/xtalk.o xtalk/xusb.o xtalk/xlist.o xtalk/debug.o
-ASTRIBANK_OBJS		= astribank_usb.o mpptalk.o $(XTALK_OBJS)
-
-ABHEXLOAD_OBJS		= astribank_hexload.o hexfile.o pic_loader.o $(ECHO_LOADER) $(ASTRIBANK_OBJS) $(OCT_HERE_OBJS)
-ABTOOL_OBJS		= astribank_tool.o $(ASTRIBANK_OBJS)
-ABALLOW_OBJS		= astribank_allow.o astribank_license.o $(ASTRIBANK_OBJS)
+# List all our sources
+XUSB_SRCS		= xtalk/xusb.c xtalk/xlist.c xtalk/debug.c
+XTALK_SRCS		= xtalk/xtalk.c
+MPPTALK_SRCS		= mpptalk.c
+ASTRIBANK_SRCS		= astribank_usb.c
+ABHEXLOAD_SRCS		= astribank_hexload.c hexfile.c pic_loader.c
+ABTOOL_SRCS		= astribank_tool.c
+ABALLOW_SRCS		= astribank_allow.c astribank_license.c
+
+SRCS	= \
+	$(XUSB_SRCS)	\
+	$(XTALK_SRCS)	\
+	$(MPPTALK_SRCS)	\
+	$(ASTRIBANK_SRCS)	\
+	$(ABHEXLOAD_SRCS)	\
+	$(ABTOOL_SRCS)	\
+	$(ABALLOW_SRCS)	\
+	$(ECHO_LOADER_SRC)
+
+# Derive object files from source list
+XUSB_OBJS		= $(XUSB_SRCS:.c=.o)
+XTALK_OBJS		= $(XTALK_SRCS:.c=.o) $(XUSB_OBJS)
+MPPTALK_OBJS		= $(MPPTALK_SRCS:.c=.o) $(XTALK_OBJS)
+ASTRIBANK_OBJS		= $(ASTRIBANK_SRCS:.c=.o) $(MPPTALK_OBJS)
+ABHEXLOAD_OBJS		= $(ABHEXLOAD_SRCS:.c=.o) $(ASTRIBANK_OBJS) $(ECHO_LOADER) $(OCT_HERE_OBJS)
+ABTOOL_OBJS		= $(ABTOOL_SRCS:.c=.o) $(ASTRIBANK_OBJS)
+ABALLOW_OBJS		= $(ABALLOW_SRCS:.c=.o) $(ASTRIBANK_OBJS)
 
 TARGETS	= .perlcheck astribank_is_starting
 PROG_INSTALL	= astribank_is_starting
@@ -124,7 +146,7 @@ ifneq	(,$(PERLLIBDIR))
 	done
 endif
 
-CFLAGS		+= -I. -Ixtalk
+CFLAGS		+= -I. -Ixtalk -Wall -Werror
 
 astribank_hexload: $(ABHEXLOAD_OBJS)
 astribank_hexload: LIBS+=$(EXTRA_LIBS) $(USB_LIB)
@@ -171,7 +193,8 @@ clean:
 
 .PHONY: depend
 depend: .depend
-.depend: *.c *.h xtalk/*.c xtalk/*.h
-	@$(CC) $(CFLAGS) -MM *.c xtalk/*.c > $@ || rm -f $@
+.depend: *.c *.h xtalk/*.c
+	@echo "Calculating dependencies"
+	@if ! $(CC) $(CFLAGS) $(OCT_CFLAGS) -MM $(SRCS) > $@; then $(RM) $@; exit 1; fi
 
 include .depend

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list