automake: add basic framwork
authorOron Peled <oron.peled@xorcom.com>
Sun, 21 Dec 2014 20:07:59 +0000 (15:07 -0500)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Tue, 19 May 2015 13:22:10 +0000 (16:22 +0300)
* 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>

.gitignore
Makefile.am [new file with mode: 0644]
Makefile.legacy [moved from Makefile with 94% similarity]
build_tools/make_dist
configure.ac
ppp/Makefile.am [new file with mode: 0644]
ppp/Makefile.legacy [moved from ppp/Makefile with 100% similarity]
xpp/Makefile.am [new file with mode: 0644]
xpp/Makefile.legacy [moved from xpp/Makefile with 100% similarity]

index 37888c6..ad7f4e7 100644 (file)
@@ -4,6 +4,9 @@
 .*.lo.d
 *.asciidoc
 *.html
+Makefile
+Makefile.in
+auxdir/
 build_tools/menuselect-deps
 aclocal.m4
 autom4te.cache/
@@ -36,6 +39,7 @@ patgen
 patlooptest
 pattest
 sethdlc
+stamp-h1
 timertest
 tonezone.lo
 tonezones.txt
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..0f1a852
--- /dev/null
@@ -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
similarity index 94%
rename from Makefile
rename to Makefile.legacy
index 994046b..98303c5 100644 (file)
--- a/Makefile
@@ -14,9 +14,6 @@ ifeq ($(strip $(foreach var,clean distclean dist-clean,$(findstring $(var),$(MAK
  endif
 endif
 
-SUBDIRS_UTILS_ALL:= ppp
-SUBDIRS_UTILS := xpp
-
 OPTFLAGS=-O2
 CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
 ifneq (,$(findstring ppc,$(UNAME_M)))
@@ -134,14 +131,9 @@ all: prereq programs
 
 libs: $(LTZ_SO) $(LTZ_A)
 
-utils-subdirs:
-       @for dir in $(SUBDIRS_UTILS); do \
-               $(MAKE) -C $$dir; \
-       done
-
 programs: libs utils
 
-utils: $(BINS) utils-subdirs
+utils: $(BINS)
 
 tests: $(TEST_BINS)
 
@@ -224,7 +216,7 @@ install: all install-programs
 
 install-programs: install-utils install-libs
 
-install-utils: utils install-utils-subdirs
+install-utils: utils
 ifneq (,$(BINS))
        install -d $(DESTDIR)$(BIN_DIR)
        install  $(BINS) $(DESTDIR)$(BIN_DIR)/
@@ -273,11 +265,6 @@ endif
        $(INSTALL) -d -m 755 $(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
 ifneq (,$(TEST_BINS))
        install -d $(DESTDIR)$(BIN_DIR)
@@ -332,12 +319,6 @@ clean:
        rm -f $(BINS) $(TEST_BINS)
        rm -f *.o dahdi_cfg tzdriver sethdlc
        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 fxotune
        rm -f core
@@ -360,7 +341,7 @@ config.status: configure
        @echo "****"
        @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:
 
index 3dfc4d7..e00e88e 100755 (executable)
@@ -22,9 +22,18 @@ mkdir -p "$tmp_version_dir"
 git archive --format tar HEAD | tar xf - -C "$tmp_version_dir"
 echo "$version" > "$tmp_version_dir/.version"
 extra_dist='
-        autoconfig.h.in
-        configure
-        '
+       autoconfig.h.in
+       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"
 tar czf "$output" -C "$tmp_work_dir" "$tarball_prefix"
 rm -rf "$tmp_work_dir"
index 1e61315..3be3861 100644 (file)
@@ -10,6 +10,17 @@ AC_INIT([dahdi-tools], short_version, [www.asterisk.org])
 
 # check existence of the package
 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_REVISION($Revision$)
@@ -37,10 +48,15 @@ AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h])
 AC_CHECK_TOOL([LD], [ld])
 
 # Checks for programs.
+AC_PROG_CXX
 AC_PROG_CC
 AC_PROG_CPP
+AM_PROG_CC_C_O
 AC_PROG_INSTALL
 AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_RANLIB
+AC_PROG_AWK
 AST_CHECK_GNU_MAKE
 
 test_obj=conftest.o
@@ -216,6 +232,9 @@ AC_SUBST([TOOLSVERSION], m4_esyscmd([build_tools/make_version . dahdi/tools]))
 AC_CONFIG_FILES([
        makeopts
        version.c
+       Makefile
+       ppp/Makefile
+       xpp/Makefile
        ])
 AC_OUTPUT
 
diff --git a/ppp/Makefile.am b/ppp/Makefile.am
new file mode 100644 (file)
index 0000000..6f8fc04
--- /dev/null
@@ -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:
similarity index 100%
rename from ppp/Makefile
rename to ppp/Makefile.legacy
diff --git a/xpp/Makefile.am b/xpp/Makefile.am
new file mode 100644 (file)
index 0000000..22344f0
--- /dev/null
@@ -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:
similarity index 100%
rename from xpp/Makefile
rename to xpp/Makefile.legacy