automake: add basic framwork

* Added needed boilerplate to configure.ac

* Wrap original Makefile's with automake:
  - Renamed all original Makefile -> Makefile.legacy
  - Force automake generated Makefile to call Makefile.legacy:
    Currently handle: all, install, clean, distclean, dist, docs, config
  - Note: our temporary 'dist' target conflicts with automake 'dist' target.

* Temporarily added extra dist files into build_tools/make_dist
  (until we move "make dist" functionality into automake)

* For now, we don't try to compile ppp/ as it wasn't compiled
  from the top-level Makefile before.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2014-12-21 15:07:59 -05:00 committed by Tzafrir Cohen
parent 723b3ce87f
commit fc620819b6
9 changed files with 97 additions and 25 deletions

4
.gitignore vendored
View File

@ -4,6 +4,9 @@
.*.lo.d .*.lo.d
*.asciidoc *.asciidoc
*.html *.html
Makefile
Makefile.in
auxdir/
build_tools/menuselect-deps build_tools/menuselect-deps
aclocal.m4 aclocal.m4
autom4te.cache/ autom4te.cache/
@ -36,6 +39,7 @@ patgen
patlooptest patlooptest
pattest pattest
sethdlc sethdlc
stamp-h1
timertest timertest
tonezone.lo tonezone.lo
tonezones.txt tonezones.txt

27
Makefile.am Normal file
View File

@ -0,0 +1,27 @@
ACLOCAL_AMFLAGS = -I m4
LEGACY_MAKE = \
$(MAKE) -f $(srcdir)/Makefile.legacy \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir)
SUBDIRS = xpp
all-local:
$(LEGACY_MAKE) all
clean-local:
$(LEGACY_MAKE) clean
install-exec-hook:
$(LEGACY_MAKE) install
dist:
$(LEGACY_MAKE) dist
docs config:
$(LEGACY_MAKE) $@
DISTCLEANFILES = makeopts config.log config.status .*.d
.PHONY: docs config

View File

@ -14,9 +14,6 @@ ifeq ($(strip $(foreach var,clean distclean dist-clean,$(findstring $(var),$(MAK
endif endif
endif endif
SUBDIRS_UTILS_ALL:= ppp
SUBDIRS_UTILS := xpp
OPTFLAGS=-O2 OPTFLAGS=-O2
CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
ifneq (,$(findstring ppc,$(UNAME_M))) ifneq (,$(findstring ppc,$(UNAME_M)))
@ -134,14 +131,9 @@ all: prereq programs
libs: $(LTZ_SO) $(LTZ_A) libs: $(LTZ_SO) $(LTZ_A)
utils-subdirs:
@for dir in $(SUBDIRS_UTILS); do \
$(MAKE) -C $$dir; \
done
programs: libs utils programs: libs utils
utils: $(BINS) utils-subdirs utils: $(BINS)
tests: $(TEST_BINS) tests: $(TEST_BINS)
@ -224,7 +216,7 @@ install: all install-programs
install-programs: install-utils install-libs install-programs: install-utils install-libs
install-utils: utils install-utils-subdirs install-utils: utils
ifneq (,$(BINS)) ifneq (,$(BINS))
install -d $(DESTDIR)$(BIN_DIR) install -d $(DESTDIR)$(BIN_DIR)
install $(BINS) $(DESTDIR)$(BIN_DIR)/ install $(BINS) $(DESTDIR)$(BIN_DIR)/
@ -273,11 +265,6 @@ endif
$(INSTALL) -d -m 755 $(DESTDIR)/$(INC_DIR) $(INSTALL) -d -m 755 $(DESTDIR)/$(INC_DIR)
$(INSTALL) -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/ $(INSTALL) -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/
install-utils-subdirs:
@for dir in $(SUBDIRS_UTILS); do \
$(MAKE) -C $$dir install; \
done
install-tests: tests install-tests: tests
ifneq (,$(TEST_BINS)) ifneq (,$(TEST_BINS))
install -d $(DESTDIR)$(BIN_DIR) install -d $(DESTDIR)$(BIN_DIR)
@ -332,12 +319,6 @@ clean:
rm -f $(BINS) $(TEST_BINS) rm -f $(BINS) $(TEST_BINS)
rm -f *.o dahdi_cfg tzdriver sethdlc rm -f *.o dahdi_cfg tzdriver sethdlc
rm -f $(LTZ_SO) $(LTZ_A) *.lo rm -f $(LTZ_SO) $(LTZ_A) *.lo
@for dir in $(SUBDIRS_UTILS_ALL); do \
$(MAKE) -C $$dir clean; \
done
@for dir in $(SUBDIRS_UTILS); do \
$(MAKE) -C $$dir clean; \
done
rm -f libtonezone* rm -f libtonezone*
rm -f fxotune rm -f fxotune
rm -f core rm -f core
@ -360,7 +341,7 @@ config.status: configure
@echo "****" @echo "****"
@exit 1 @exit 1
.PHONY: distclean dist-clean clean all install programs tests devel data config install-programs install-libs install-utils-subdirs utils-subdirs prereq dist .PHONY: distclean dist-clean clean all install programs tests devel data config install-programs install-libs prereq dist
FORCE: FORCE:

View File

@ -22,9 +22,18 @@ mkdir -p "$tmp_version_dir"
git archive --format tar HEAD | tar xf - -C "$tmp_version_dir" git archive --format tar HEAD | tar xf - -C "$tmp_version_dir"
echo "$version" > "$tmp_version_dir/.version" echo "$version" > "$tmp_version_dir/.version"
extra_dist=' extra_dist='
autoconfig.h.in autoconfig.h.in
configure configure
' ppp/Makefile
Makefile
xpp/Makefile
ppp/Makefile.in
Makefile.in
xpp/Makefile.in
auxdir/install-sh
auxdir/missing
'
find $extra_dist | cpio -pudmv "$tmp_version_dir" find $extra_dist | cpio -pudmv "$tmp_version_dir"
tar czf "$output" -C "$tmp_work_dir" "$tarball_prefix" tar czf "$output" -C "$tmp_work_dir" "$tarball_prefix"
rm -rf "$tmp_work_dir" rm -rf "$tmp_work_dir"

View File

@ -10,6 +10,17 @@ AC_INIT([dahdi-tools], short_version, [www.asterisk.org])
# check existence of the package # check existence of the package
AC_CONFIG_SRCDIR([dahdi_cfg.c]) AC_CONFIG_SRCDIR([dahdi_cfg.c])
AC_CONFIG_AUX_DIR([auxdir])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
build_version=`build_tools/make_version . dahdi/tools`
AC_SUBST([BUILD_VERSION], "$build_version")
# enable nice build output on automake1.11
m4_pattern_allow([AM_DEFAULT_VERBOSITY])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],[AM_DEFAULT_VERBOSITY=1])
AM_CONDITIONAL([SILENT_RULES], [test "$AM_DEFAULT_VERBOSITY" = '0'])
AC_COPYRIGHT("dahdi-tools") AC_COPYRIGHT("dahdi-tools")
AC_REVISION($Revision$) AC_REVISION($Revision$)
@ -37,10 +48,15 @@ AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h])
AC_CHECK_TOOL([LD], [ld]) AC_CHECK_TOOL([LD], [ld])
# Checks for programs. # Checks for programs.
AC_PROG_CXX
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
AM_PROG_CC_C_O
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_AWK
AST_CHECK_GNU_MAKE AST_CHECK_GNU_MAKE
test_obj=conftest.o test_obj=conftest.o
@ -216,6 +232,9 @@ AC_SUBST([TOOLSVERSION], m4_esyscmd([build_tools/make_version . dahdi/tools]))
AC_CONFIG_FILES([ AC_CONFIG_FILES([
makeopts makeopts
version.c version.c
Makefile
ppp/Makefile
xpp/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

14
ppp/Makefile.am Normal file
View File

@ -0,0 +1,14 @@
LEGACY_MAKE = \
$(MAKE) -f $(srcdir)/Makefile.legacy \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir)
all-local:
$(LEGACY_MAKE) all
clean-local:
$(LEGACY_MAKE) clean
# Cannot allow this yet
distclean:
maintainer-clean:

18
xpp/Makefile.am Normal file
View File

@ -0,0 +1,18 @@
LEGACY_MAKE = \
$(MAKE) -f $(srcdir)/Makefile.legacy \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir)
all-local:
$(LEGACY_MAKE) all
clean-local:
$(LEGACY_MAKE) clean
install-exec-hook:
$(LEGACY_MAKE) install
# Cannot allow this yet
distclean:
maintainer-clean: