Improved port of ifconfig... smaller and with more features.
[oweals/busybox.git] / Makefile
index e0f8880871339f77667f1e2f7f3c7b046dc5e395..239f3cf0284eeed8fe56de6119a6ab530fbd23a6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -82,15 +82,25 @@ AR = $(CROSS)ar
 STRIPTOOL = $(CROSS)strip
 
 # To compile vs uClibc, just use the compiler wrapper built by uClibc...
-# Isn't that easy?  Right now, uClibc needs BB_FEATURE_NFSMOUNT disabled 
-# since uClibc's nfs support isn't ready yet.
+# This make things very easy?  Everything should compile and work as
+# expected these days...
 #CC = ../uClibc/extra/gcc-uClibc/gcc-uClibc-i386
 
 # To compile vs some other alternative libc, you may need to use/adjust
 # the following lines to meet your needs...
-#LIBCDIR=/usr/i486-linuxlibc1/
+#
+# If you are using Red Hat 6.x with the compatible RPMs (for developing under
+# Red Hat 5.x and glibc 2.0) uncomment the following.  Be sure to read about
+# using the compatible RPMs (compat-*) at http://www.redhat.com !
+#LIBCDIR=/usr/i386-glibc20-linux
+#
+# The following is used for libc5 (if you install altgcc and libc5-altdev
+# on a Debian system).  
+#LIBCDIR=/usr/i486-linuxlibc1
+#
+# For other libraries, you are on your own...
 #LDFLAGS+=-nostdlib
-#LIBRARIES = $(LIBCDIR)/libc.a -lgcc
+#LIBRARIES = $(LIBCDIR)/lib/libc.a -lgcc
 #CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
 #GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
 
@@ -202,7 +212,6 @@ ifneq ($(strip $(USE_SYSTEM_PWD_GRP)),true)
     PWD_GRP    = pwd_grp
     PWD_GRP_DIR = $(BB_SRC_DIR)$(PWD_GRP)
     PWD_LIB     = libpwd.a
-    LIBRARIES  += $(PWD_LIB)
     PWD_CSRC=__getpwent.c pwent.c getpwnam.c getpwuid.c putpwent.c getpw.c \
            fgetpwent.c __getgrent.c grent.c getgrnam.c getgrgid.c fgetgrent.c \
            initgroups.c setgroups.c
@@ -241,6 +250,7 @@ docs/BusyBox.1: docs/busybox.pod
                $< > $@
 
 docs/BusyBox.html: docs/busybox.lineo.com/BusyBox.html
+       - mkdir -p docs
        -@ rm -f docs/BusyBox.html
        -@ ln -s busybox.lineo.com/BusyBox.html docs/BusyBox.html
 
@@ -279,7 +289,7 @@ docs/busybox/busyboxdocumentation.html: docs/busybox.sgml
 
 
 busybox: $(PWD_LIB) $(OBJECTS) 
-       $(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)
+       $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBRARIES) $(PWD_LIB)
        $(STRIP)
 
 # Without VPATH, rule expands to "/bin/sh busybox.mkll Config.h applets.h"
@@ -290,16 +300,14 @@ busybox.links: busybox.mkll Config.h applets.h
 
 nfsmount.o cmdedit.o: %.o: %.h
 $(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
-       $(CC) $(CFLAGS) -I- -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
+       $(CC) -I- $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
 
-$(PWD_OBJS): %.o: %.c pwd_lib_objdir Config.h busybox.h applets.h Makefile
+$(PWD_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile
+       - mkdir -p $(PWD_GRP)
        $(CC) $(CFLAGS) $(PWD_CFLAGS) -c $< -o $*.o
 
-$(PWD_LIB): $(PWD_OBJS)
-       $(AR) $(ARFLAGS) $(PWD_LIB) $^
-
-pwd_lib_objdir:
-       mkdir -p $(PWD_GRP)
+libpwd.a: $(PWD_OBJS)
+       $(AR) $(ARFLAGS) $@ $^
 
 usage.o: usage.h
 
@@ -318,9 +326,9 @@ clean:
        - rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
            docs/busybox.pdf docs/busybox.lineo.com/busybox.html
        - rm -f multibuild.log Config.h.orig
-       - rm -rf docs/busybox _install $(PWD_LIB) 
+       - rm -rf docs/busybox _install libpwd.a
        - rm -f busybox.links loop.h *~ slist.mk core applet_source_list
-       - find -name *.o | xargs rm -f;
+       - find -name \*.o -exec rm -f {} \;
 
 distclean: clean
        - rm -f busybox
@@ -344,17 +352,17 @@ dist release: distclean doc
        find busybox-$(VERSION)/ -type d        \
                                 -name CVS      \
                                 -print         \
-               | xargs rm -rf;                 \
+               -exec rm -rf {} \;              \
                                                \
        find busybox-$(VERSION)/ -type f        \
                                 -name .cvsignore \
                                 -print         \
-               | xargs rm -f;                  \
+               -exec rm -f {}  \;              \
                                                \
        find busybox-$(VERSION)/ -type f        \
                                 -name .\#*     \
                                 -print         \
-               | xargs rm -f;                  \
+               -exec rm -f {} \;               \
                                                \
        tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION)/;