linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: linux-hotplug@vger.kernel.org
Subject: [patch] better allow builds of extras programs under udev
Date: Sat, 06 Dec 2003 01:10:53 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-107067344901251@msgid-missing> (raw)

Here is an improved version of the patch that enables builds of the extras
progams for the targets all, clean, install, and uninstall, and passes
down the "prefix" for use by install and uninstall.

This patch enables building of the "extras" programs using the same build
environment as udev (i.e. build with udev's versions of klibc and
sysfsutils).

For example, build scsi_id and udev via:

	make EXTRAS=extras/scsi_id

Build scsi_id and udev with klibc via:

	make KLIBC=true EXTRAS=extras/scsi_id

=== Makefile 1.47 vs edited ==--- 1.47/Makefile	Thu Dec  4 11:21:04 2003
+++ edited/Makefile	Fri Dec  5 17:07:06 2003
@@ -42,6 +42,9 @@
 INSTALL_DATA  = ${INSTALL} -m 644
 INSTALL_SCRIPT = ${INSTALL_PROGRAM}
 
+# To build any of the extras programs, run with:
+# 	make EXTRAS="extras/a extras/b" 
+EXTRAS 
 # place to put our device nodes
 udevdir = ${prefix}/udev/
@@ -60,7 +63,7 @@
 STRIP = $(CROSS)strip
 RANLIB = $(CROSS)ranlib
 
-export CROSS CC AR STRIP RANLIB
+export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS ARCH_LIB_OBJS CRT0
 
 # code taken from uClibc to determine the current arch
 ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \
@@ -108,20 +111,20 @@
 # If we are using our version of klibc, then we need to build and link it.
 # Otherwise, use glibc and link statically.
 ifeq ($(strip $(KLIBC)),true)
-	KLIBC_DIR	= klibc/klibc
+	KLIBC_BASE	= $(PWD)/klibc
+	KLIBC_DIR	= $(KLIBC_BASE)/klibc
 	INCLUDE_DIR	:= $(KLIBC_DIR)/include
+	LINUX_INCLUDE_DIR	:= $(KLIBC_BASE)/linux/include
 	include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG
 	# arch specific objects
-	LIBGCC		= $(shell $(CC) --print-libgcc)
 	ARCH_LIB_OBJS =	\
-			$(KLIBC_DIR)/libc.a	\
-			$(LIBGCC)
+			$(KLIBC_DIR)/libc.a
 
 
 	CRT0 = $(KLIBC_DIR)/crt0.o
 	LIBC =	$(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0)
 	CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(KLIBC_DIR)/arch/$(ARCH)/include \
-		-I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -Iklibc/linux/include \
+		-I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -I$(LINUX_INCLUDE_DIR) \
 		-D__KLIBC__
 	LIB_OBJS  	LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs
@@ -133,7 +136,14 @@
 	LDFLAGS = --static 
 endif
 
+CFLAGS += -I$(PWD)/libsysfs
+
 all: $(ROOT)
+	@for target in $(EXTRAS) ; do \
+		echo $$target ; \
+		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
+			-C $$target $@ ; \
+	done ; \
 
 $(ROOT): $(LIBC)
 
@@ -145,13 +155,13 @@
 TDB =	tdb/tdb.o	\
 	tdb/spinlock.o
 
-SYSFS =	libsysfs/sysfs_bus.o	\
-	libsysfs/sysfs_class.o	\
-	libsysfs/sysfs_device.o	\
-	libsysfs/sysfs_dir.o	\
-	libsysfs/sysfs_driver.o	\
-	libsysfs/sysfs_utils.o	\
-	libsysfs/dlist.o
+SYSFS =	$(PWD)/libsysfs/sysfs_bus.o	\
+	$(PWD)/libsysfs/sysfs_class.o	\
+	$(PWD)/libsysfs/sysfs_device.o	\
+	$(PWD)/libsysfs/sysfs_dir.o	\
+	$(PWD)/libsysfs/sysfs_driver.o	\
+	$(PWD)/libsysfs/sysfs_utils.o	\
+	$(PWD)/libsysfs/dlist.o
 
 OBJS =	udev.o		\
 	udev_config.o	\
@@ -192,6 +202,11 @@
 	 | xargs rm -f 
 	-rm -f core $(ROOT) $(GEN_HEADERS)
 	$(MAKE) -C klibc clean
+	@for target in $(EXTRAS) ; do \
+		echo $$target ; \
+		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
+			-C $$target $@ ; \
+	done ; \
 
 DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort )
 DISTDIR := $(RELEASE_NAME)
@@ -236,6 +251,11 @@
 	$(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir)
 	- rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug
 	- ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug
+	@for target in $(EXTRAS) ; do \
+		echo $$target ; \
+		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
+			-C $$target $@ ; \
+	done ; \
 
 uninstall:
 	- rm $(hotplugdir)/udev.hotplug
@@ -247,5 +267,10 @@
 	- rmdir $(hotplugdir)
 	- rmdir $(configdir)
 	- rmdir $(udevdir)
+	@for target in $(EXTRAS) ; do \
+		echo $$target ; \
+		$(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \
+			-C $$target $@ ; \
+	done ; \
 
 


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

                 reply	other threads:[~2003-12-06  1:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-107067344901251@msgid-missing \
    --to=patmans@us.ibm.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).