[klibc] [PATCH] make install support

Olaf Hering olh at suse.de
Sun Feb 13 11:05:04 PST 2005


This adds make install support, either static or shared, default is
static to avoid dependency mess.


Index: MCONFIG
===================================================================
--- MCONFIG	(revision 1009)
+++ MCONFIG	(working copy)
@@ -45,6 +45,19 @@
 CRTSHARED = $(KLIBOBJ)/interp.o
 LIBSHARED = $(KLIBOBJ)/libc.so
 
+INSTALL = /usr/bin/install
+
+# offset during make install
+DESTDIR =
+
+# binaries will be installed here
+# this is not the system /bin dir because the klibc binaries
+# have not support for all cmdline options of their glibc counterparts
+# it must also be accessible before /usr is mounted because udev
+# PROGRAM= helper apps may rely on it. 
+# they are also possible part of an initrd
+KLIBC_BINDIR = /lib/klibc/bin
+
 #
 # This indicates the location of the final version of the shared library.
 # THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH.
Index: klibc/Makefile
===================================================================
--- klibc/Makefile	(revision 1009)
+++ klibc/Makefile	(working copy)
@@ -152,6 +152,13 @@
 objects-static: $(STATIC)
 	touch $(DIR)static.obj
 
+install-shared:
+	$(INSTALL) -d $(DESTDIR)$(SHLIBDIR)
+	$(INSTALL) -m 0755 klibc-`cat $(SOLIB).hash`.so $(DESTDIR)$(SHLIBDIR)
+
+install-static:
+	:
+
 clean: archclean
 	find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f
 	rm -f *.a *.so *.hash *.syms *.stripped
Index: ipconfig/Makefile
===================================================================
--- ipconfig/Makefile	(revision 1009)
+++ ipconfig/Makefile	(working copy)
@@ -29,6 +29,14 @@
 $(LIB): $(OBJS)
 	$(AR) cru $(LIB) $(OBJS)
 
+install-shared:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(SHAREDPROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
+install-static:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(STATICPROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
 clean:
 	$(RM) *.o $(PROG) $(LIB) core
 	$(RM) -r static static.g shared shared.g
Index: utils/Makefile
===================================================================
--- utils/Makefile	(revision 1009)
+++ utils/Makefile	(working copy)
@@ -43,6 +43,14 @@
 $(CRT0) $(LIBS):
 	@echo '*** error: $@ not up to date' || exit 1
 
+install-shared:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(SHAREDPROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
+install-static:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(STATICPROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
 clean:
 	$(RM) *.o core $(LIBUTILS) $(PROGS) .*.d
 	$(RM) -rf static static.g shared shared.g
Index: gzip/Makefile
===================================================================
--- gzip/Makefile	(revision 1009)
+++ gzip/Makefile	(working copy)
@@ -64,6 +64,13 @@
 gzip.stripped: gzip
 	$(STRIP) $< -o $@
 
+install-static install-shared:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 gzip $(DESTDIR)$(KLIBC_BINDIR)
+	ln -sf gzip $(DESTDIR)$(KLIBC_BINDIR)/gunzip
+	ln -sf gzip $(DESTDIR)$(KLIBC_BINDIR)/zcat
+
+
 clean:
 	$(RM) -f core *.o gzip gunzip zcat gzip.stripped .*.d
 
Index: nfsmount/Makefile
===================================================================
--- nfsmount/Makefile	(revision 1009)
+++ nfsmount/Makefile	(working copy)
@@ -30,6 +30,14 @@
 $(LIB): $(OBJS)
 	$(AR) cru $(LIB) $(OBJS)
 
+install-shared:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(SHAREDPROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
+install-static:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(STATICPROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
 clean:
 	$(RM) *.o $(LIB) core
 	$(RM) -r static static.g shared shared.g
Index: ash/Makefile
===================================================================
--- ash/Makefile	(revision 1009)
+++ ash/Makefile	(working copy)
@@ -145,6 +145,14 @@
 arith.h: arith.c
 	$(PERL) -ne 'print if ( /^\#\s*define\s+ARITH/ );' < $< > $@
 
+install-shared:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(PROG).shared $(DESTDIR)$(KLIBC_BINDIR)/$(PROG)
+
+install-static:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(PROG) $(DESTDIR)$(KLIBC_BINDIR)
+
 clean:
 	rm -f core $(CLEANFILES) $(OBJS) .*.d *.g
 	rm -f $(PROG) $(PROG).shared
Index: Makefile
===================================================================
--- Makefile	(revision 1009)
+++ Makefile	(working copy)
@@ -15,6 +15,15 @@
 %:
 	@set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
+install: install-static
+	:
+
+install-shared:
+	@set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
+install-static:
+	@set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+
 clean:
 	@set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
Index: kinit/Makefile
===================================================================
--- kinit/Makefile	(revision 1009)
+++ kinit/Makefile	(working copy)
@@ -22,6 +22,10 @@
 	cp -f $@ $@.g
 	$(STRIP) $@
 
+install-static install-shared:
+	$(INSTALL) -d $(DESTDIR)$(KLIBC_BINDIR)
+	$(INSTALL) -m 0755 $(PROGS) $(DESTDIR)$(KLIBC_BINDIR)
+
 clean:
 	-rm -f *.o *.g kinit
 



More information about the klibc mailing list