From c64302ae3336660c0a30a776f684ced24c255854 Mon Sep 17 00:00:00 2001
From: Richard Hacker <ha@igh-essen.com>
Date: Mon, 9 Oct 2006 12:59:09 +0000
Subject: [PATCH] Added file ./bootstrap; Added $(DESTDIR) to */Makefile.am
 make alternate root installs possible

---
 Makefile.am               | 22 +++-------------------
 bootstrap                 |  7 +++++++
 configure.ac              | 13 +++++++++----
 devices/Makefile.am       |  1 +
 examples/mini/Makefile.am |  1 +
 examples/msr/Makefile.am  |  1 +
 examples/rtai/Makefile.am |  1 +
 master/Makefile.am        |  1 +
 8 files changed, 24 insertions(+), 23 deletions(-)
 create mode 100755 bootstrap

diff --git a/Makefile.am b/Makefile.am
index 83cdc9ed..88e08d73 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,13 +35,9 @@
 #
 #------------------------------------------------------------------------------
 
-SUBDIRS = master/ devices/
-
-initdir = $(sysconfdir)/init.d
-sysdir = $(sysconfdir)/sysconfig
+SUBDIRS = master/ devices/ script/
 
 include_HEADERS = include/ecdb.h include/ecrt.h
-noinst_SCRIPTS = script/lsec.pl script/ethercat.sh script/sysconfig
 
 MINI_FILES = \
 	examples/mini/Kbuild \
@@ -66,7 +62,7 @@ MSR_FILES = \
 	examples/msr/msrserv.pl \
 	examples/msr/msr_unload
 
-EXTRA_DIST = $(noinst_SCRIPTS) documentation/ethercat_doc.pdf \
+EXTRA_DIST = documentation/ethercat_doc.pdf \
 	$(MINI_FILES) $(RTAI_FILES) $(MSR_FILES)
 
 mydist:
@@ -79,19 +75,7 @@ dist-hook:
 	fi
 
 install-data-local:
-	$(mkinstalldirs) $(bindir)
-	$(mkinstalldirs) $(initdir)
-	$(mkinstalldirs) $(sysdir)
-	$(INSTALL_SCRIPT) $(srcdir)/script/lsec.pl $(bindir)/lsec
-	$(INSTALL_SCRIPT) $(srcdir)/script/ethercat.sh $(initdir)/ethercat
-	$(INSTALL_DATA) $(srcdir)/script/sysconfig $(sysdir)/ethercat
-	$(DEPMOD) $(LINUX_KERNEL_VERSION)
-
-uninstall-local:
-	rm -rf $(LINUX_MODULES_DIR)/ethercat
-	rm $(bindir)/lsec
-	rm $(initdir)/ethercat
-	rm $(sysdir)/ethercat
+	$(DEPMOD) -b "$(DESTDIR)" $(LINUX_KERNEL_VERSION)
 
 doc:
 	doxygen Doxyfile
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 00000000..e4240a08
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -x
+aclocal -I config
+autoheader
+automake --add-missing
+autoconf
diff --git a/configure.ac b/configure.ac
index 05400904..36f8aa5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,10 +5,6 @@
 AC_INIT([ethercat],[1.1],[fp@igh-essen.com])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign dist-bzip2])
 AC_PREFIX_DEFAULT([/opt/etherlab])
-AC_CONFIG_FILES([Makefile master/Makefile devices/Makefile \
-	         examples/mini/Makefile \
-		 examples/rtai/Makefile \
-		 examples/msr/Makefile])
 
 #------------------------------------------------------------------------------
 # Linux sources
@@ -53,6 +49,15 @@ fi
 
 #------------------------------------------------------------------------------
 
+AC_CONFIG_FILES([
+        Makefile 
+        master/Makefile 
+        devices/Makefile 
+        script/Makefile
+        examples/mini/Makefile
+	examples/rtai/Makefile
+	examples/msr/Makefile
+])
 AC_OUTPUT
 
 #------------------------------------------------------------------------------
diff --git a/devices/Makefile.am b/devices/Makefile.am
index 0727a2b3..dc0279cc 100644
--- a/devices/Makefile.am
+++ b/devices/Makefile.am
@@ -51,6 +51,7 @@ clean-local:
 
 install-data-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(ABSSRCDIR)" \
+		INSTALL_MOD_PATH="$(DESTDIR)" \
 		INSTALL_MOD_DIR="ethercat" modules_install
 
 #------------------------------------------------------------------------------
diff --git a/examples/mini/Makefile.am b/examples/mini/Makefile.am
index 9ab35553..f681d1d6 100644
--- a/examples/mini/Makefile.am
+++ b/examples/mini/Makefile.am
@@ -45,6 +45,7 @@ clean-local:
 
 install-data-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(ABSSRCDIR)" \
+		INSTALL_MOD_PATH="$(DESTDIR)" \
 		INSTALL_MOD_DIR="ethercat" modules_install
 
 #------------------------------------------------------------------------------
diff --git a/examples/msr/Makefile.am b/examples/msr/Makefile.am
index 24acdf74..793904b4 100644
--- a/examples/msr/Makefile.am
+++ b/examples/msr/Makefile.am
@@ -52,6 +52,7 @@ clean-local:
 
 install-data-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(ABSSRCDIR)" \
+		INSTALL_MOD_PATH="$(DESTDIR)" \
 		INSTALL_MOD_DIR="ethercat" modules_install
 
 #------------------------------------------------------------------------------
diff --git a/examples/rtai/Makefile.am b/examples/rtai/Makefile.am
index acace65b..aa9bd648 100644
--- a/examples/rtai/Makefile.am
+++ b/examples/rtai/Makefile.am
@@ -47,6 +47,7 @@ clean-local:
 
 install-data-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(ABSSRCDIR)" \
+		INSTALL_MOD_PATH="$(DESTDIR)" \
 		INSTALL_MOD_DIR="ethercat" modules_install
 
 #------------------------------------------------------------------------------
diff --git a/master/Makefile.am b/master/Makefile.am
index 52fdde0f..8983f2d2 100644
--- a/master/Makefile.am
+++ b/master/Makefile.am
@@ -61,6 +61,7 @@ clean-local:
 
 install-data-local:
 	$(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(ABSSRCDIR)" \
+		INSTALL_MOD_PATH="$(DESTDIR)" \
 		INSTALL_MOD_DIR="ethercat" modules_install
 
 #------------------------------------------------------------------------------
-- 
GitLab