From ee83afa669944c9354d578af53c1861d1a6bae17 Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Sun, 21 Dec 2014 09:13:58 -0500 Subject: [PATCH] automake: handle xpp/ compilation via Makefile.am: * Added xpp/oct612x/Makefile.am: - Compile octasic sources into a convenience library (static, not installed) - Set OCTASIC_CFLAGS in configure.ac, as they are used in two Makefile.am's - Added relevant Makefile.in and Makefile into build_tools/make_dist * In xpp/Makefile.am: - Have USE_OCTASIC conditional (currently configure.ac always set it to true) * Added PBX_USB automake conditional, so we only build our tools if configure'd for libusb. * Create two convenience libraries (libastribank and libecholoader) Statically link them into our tools. * Handle man-pages for the tools. * Remove all new functionality from xpp/Makefile.legacy -- it now contains: - All perl related tools and man-pages - Other misc stuff (udev files, etc.) Signed-off-by: Tzafrir Cohen --- build_tools/make_dist | 1 + configure.ac | 9 ++++ xpp/Makefile.am | 55 ++++++++++++++++++++ xpp/Makefile.legacy | 110 ++-------------------------------------- xpp/oct612x/Makefile.am | 35 +++++++++++++ 5 files changed, 103 insertions(+), 107 deletions(-) create mode 100644 xpp/oct612x/Makefile.am diff --git a/build_tools/make_dist b/build_tools/make_dist index 26af271..8261c24 100755 --- a/build_tools/make_dist +++ b/build_tools/make_dist @@ -27,6 +27,7 @@ extra_dist=' ppp/Makefile Makefile xpp/Makefile + xpp/oct612x/Makefile ppp/Makefile.in Makefile.in xpp/Makefile.in diff --git a/configure.ac b/configure.ac index 0baec5b..cc935dd 100644 --- a/configure.ac +++ b/configure.ac @@ -230,6 +230,14 @@ fi AC_SUBST(PPPD_VERSION) +AM_CONDITIONAL([PBX_USB], [test "$PBX_USB" = "1"]) + +# Taken from octasic-helper +AC_SUBST([USE_OCTASIC], [yes]) +AM_CONDITIONAL([USE_OCTASIC], [test "$USE_OCTASIC" = 'yes']) +octasic_dir='$(top_srcdir)/xpp/oct612x' +AC_SUBST([OCTASIC_CFLAGS], ["-I$octasic_dir/include -I$octasic_dir/octdeviceapi -I$octasic_dir/octdeviceapi/oct6100api"]) + AC_SUBST([TOOLSVERSION], m4_esyscmd([build_tools/make_version . dahdi/tools])) AC_CONFIG_FILES([ @@ -238,6 +246,7 @@ AC_CONFIG_FILES([ Makefile ppp/Makefile xpp/Makefile + xpp/oct612x/Makefile ]) AC_OUTPUT diff --git a/xpp/Makefile.am b/xpp/Makefile.am index 22344f0..c456fad 100644 --- a/xpp/Makefile.am +++ b/xpp/Makefile.am @@ -16,3 +16,58 @@ install-exec-hook: # Cannot allow this yet distclean: maintainer-clean: + +SUBDIRS = + +GLOBAL_CFLAGS = -I$(srcdir) -I$(srcdir)/xtalk + +if PBX_USB + +SUBDIRS += oct612x + +noinst_LTLIBRARIES = libastribank.la libecholoader.la +libastribank_la_SOURCES = \ + xtalk/xusb.c \ + xtalk/xlist.c \ + xtalk/debug.c \ + xtalk/xtalk.c \ + mpptalk.c \ + astribank_usb.c +libastribank_la_CFLAGS = $(GLOBAL_CFLAGS) + +if USE_OCTASIC +libecholoader_la_SOURCES = \ + parse_span_specs.c \ + echo_loader.c +libecholoader_la_CFLAGS = $(GLOBAL_CFLAGS) $(OCTASIC_CFLAGS) +endif + +sbin_PROGRAMS = \ + astribank_tool \ + astribank_hexload \ + astribank_allow \ + astribank_is_starting + +check_PROGRAMS = test_parse + +astribank_tool_SOURCES = astribank_tool.c +astribank_tool_CFLAGS = $(GLOBAL_CFLAGS) +astribank_tool_LDFLAGS = $(USB_LIB) +astribank_tool_LDADD = libastribank.la + +astribank_hexload_SOURCES = astribank_hexload.c hexfile.c pic_loader.c +astribank_hexload_CFLAGS = $(GLOBAL_CFLAGS) $(OCTASIC_CFLAGS) +astribank_hexload_LDFLAGS = $(USB_LIB) +astribank_hexload_LDADD = libastribank.la libecholoader.la oct612x/liboctasic.la + +astribank_allow_SOURCES = astribank_allow.c astribank_license.c +astribank_allow_CFLAGS = $(GLOBAL_CFLAGS) +astribank_allow_LDFLAGS = $(USB_LIB) +astribank_allow_LDADD = libastribank.la + +man_MANS = \ + astribank_tool.8 \ + astribank_hexload.8 \ + astribank_allow.8 \ + astribank_is_starting.8 +endif diff --git a/xpp/Makefile.legacy b/xpp/Makefile.legacy index 8584dcc..9f37f0b 100644 --- a/xpp/Makefile.legacy +++ b/xpp/Makefile.legacy @@ -38,25 +38,6 @@ PERL_MODS := $(shell cd perl_modules; echo $(PERL_MODS_PAT)) # FIXME: Are those values really sane? HOSTCC ?= $(CC) -USE_OCTASIC := yes -OCTASIC_DIR := oct612x - -ifneq (no,$(USE_OCTASIC)) - -OCT_OBJS = $(shell $(OCTASIC_DIR)/octasic-helper objects $(OCTASIC_DIR)) -OCT_SRCS = $(shell echo $(OCT_OBJS) | tr -s ' ' '\n' | sed 's/\.o$$/.c/g') -OCT_HERE_OBJS = $(shell echo $(OCT_OBJS) | tr -s ' ' '\n' | sed 's,^.*/,,') -OCT_CFLAGS = $(shell $(OCTASIC_DIR)/octasic-helper cflags $(OCTASIC_DIR)) -OCT_DEFINES = \ - -DPTR_TYPE=uint32_t \ - -DcOCT6100_INTERNAL_SUPER_ARRAY_SIZE=1024 \ - -DcOCT6100_MAX_ECHO_CHANNELS=672 \ - -DcOCT6100_MAX_MIXER_EVENTS=1344 - -ECHO_LOADER_SRC = echo_loader.c parse_span_specs.c -ECHO_LOADER = $(ECHO_LOADER_SRC:.c=.o) -endif - %.8: % pod2man --section 8 $^ > $@ || $(RM) $@ PERL_SCRIPTS = \ @@ -71,45 +52,8 @@ PERL_SCRIPTS = \ PERL_MANS = $(PERL_SCRIPTS:%=%.8) -# 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 +TARGETS = .perlcheck -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 -MAN_INSTALL = $(PROG_INSTALL:%=%.8) -ifeq (1,$(PBX_USB)) -TARGETS += \ - astribank_tool \ - astribank_hexload \ - astribank_allow \ - test_parse -PROG_INSTALL += astribank_tool astribank_hexload astribank_allow -endif ifneq (,$(PERLLIBDIR)) PROG_INSTALL += $(PERL_SCRIPTS) TARGETS += $(PERL_MANS) @@ -128,7 +72,7 @@ install: all $(INSTALL) -d $(DESTDIR)$(udevrulesdir) $(INSTALL_DATA) xpp.rules $(DESTDIR)$(udevrulesdir)/ $(INSTALL) -d $(DESTDIR)$(MANDIR) - $(INSTALL_DATA) $(MAN_INSTALL) $(DESTDIR)$(MANDIR)/ + $(INSTALL_DATA) $(PERL_MANS) $(DESTDIR)$(MANDIR)/ ifneq (,$(PERLLIBDIR)) $(INSTALL) -d $(DESTDIR)$(PERLLIBDIR) for i in $(PERL_DIRS); \ @@ -141,57 +85,9 @@ ifneq (,$(PERLLIBDIR)) done endif -CFLAGS += -I. -Ixtalk -Wall -Werror - -astribank_hexload: $(ABHEXLOAD_OBJS) -astribank_hexload: LIBS+=$(EXTRA_LIBS) $(USB_LIB) -astribank_hexload: CFLAGS+=$(OCT_CFLAGS) - -astribank_tool: $(ABTOOL_OBJS) -astribank_tool: LIBS+=$(EXTRA_LIBS) $(USB_LIB) - -astribank_allow: $(ABALLOW_OBJS) -astribank_allow: LIBS+=$(EXTRA_LIBS) $(USB_LIB) - -astribank_is_starting: astribank_is_starting.o -astribank_is_starting: LIBS+=$(EXTRA_LIBS) - -hex2iic: hex2iic.o iic.o hexfile.o - -test_parse: test_parse.o hexfile.o -test_parse: LIBS+=$(EXTRA_LIBS) $(USB_LIB) - -ifneq (no,$(USE_OCTASIC)) -.octasic.depend: $(OCTASIC_DIR)/octasic-helper Makefile ../config.status - $(CC) -MM $(OCT_CFLAGS) \ - `$(OCTASIC_DIR)/octasic-helper objects | \ - tr -s ' ' '\n' | \ - sed -e 's,.*,$(OCTASIC_DIR)/&,' -e 's/\.o$$/.c/'` > $@ - --include .octasic.depend - -$(OCT_HERE_OBJS): Makefile - $(CC) -c $(CFLAGS) $(OCT_CFLAGS) $(OCT_DEFINES) $(OCT_SRCS) - -endif - - -%: %.o - $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ - .perlcheck: $(PERL_SCRIPTS) for i in $^; do perl -I./perl_modules -c $$i || exit 1; done touch $@ clean: - $(RM) .depend .octasic.depend *.o xtalk/*.o $(OCT_HERE_OBJS) $(TARGETS) - -.PHONY: depend -ifeq (1,$(PBX_USB)) -depend: .depend -.depend: *.c *.h xtalk/*.c - @echo "Calculating dependencies" - @if ! $(CC) $(CFLAGS) $(OCT_CFLAGS) -MM $(SRCS) > $@; then $(RM) $@; exit 1; fi - -include .depend -endif + $(RM) $(TARGETS) diff --git a/xpp/oct612x/Makefile.am b/xpp/oct612x/Makefile.am new file mode 100644 index 0000000..72f62fa --- /dev/null +++ b/xpp/oct612x/Makefile.am @@ -0,0 +1,35 @@ +OCTASIC_DEFINES = \ + -DPTR_TYPE=uint32_t \ + -DcOCT6100_INTERNAL_SUPER_ARRAY_SIZE=1024 \ + -DcOCT6100_MAX_ECHO_CHANNELS=672 \ + -DcOCT6100_MAX_MIXER_EVENTS=1344 + +noinst_LTLIBRARIES = liboctasic.la + +# Taken from octasic-helper +liboctasic_la_SOURCES = \ + octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_events.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c \ + octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c \ + apilib/bt/octapi_bt0.c \ + apilib/largmath/octapi_largmath.c \ + apilib/llman/octapi_llman.c + +liboctasic_la_CFLAGS = \ + $(OCTASIC_DEFINES) \ + $(OCTASIC_CFLAGS)