summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/Makefile
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-06-04 18:31:57 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-06-04 18:31:57 +0000
commit09e967c2d732783b2579e4e120cd9b608404cb00 (patch)
tree8d2783a6a7e33608c6012efd6a88b8f5694df81d /mdk-stage1/dietlibc/Makefile
parent18fcff49d3c836697d3b75a3d01d31c700e69974 (diff)
downloaddrakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar.gz
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar.bz2
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.tar.xz
drakx-09e967c2d732783b2579e4e120cd9b608404cb00.zip
Merge from R9_0-AMD64, most notably:
- AMD64 support to insmod-busybox, minilibc, et al. - Sync with insmod-modutils 2.4.19 something but everyone should use dietlibc nowadays - Factor out compilation and prefix with $(DIET) for dietlibc builds - 64-bit & varargs fixes
Diffstat (limited to 'mdk-stage1/dietlibc/Makefile')
-rw-r--r--mdk-stage1/dietlibc/Makefile351
1 files changed, 309 insertions, 42 deletions
diff --git a/mdk-stage1/dietlibc/Makefile b/mdk-stage1/dietlibc/Makefile
index b6e7b2783..0fe32e61b 100644
--- a/mdk-stage1/dietlibc/Makefile
+++ b/mdk-stage1/dietlibc/Makefile
@@ -1,13 +1,101 @@
-ARCH=$(shell uname -m | sed 's/i[4-9]86/i386/')
+INSTALL=install
+prefix?=/usr
+# Set the following to install to a different root
+#DESTDIR=/tmp/fefix
+# Use "make DEBUG=1" to compile a debug version.
+
+MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/' -e 's/ppc64/ppc/')
+
+# This extra-ugly cruft is here so make will not run uname and sed each
+# time it looks at $(OBJDIR). This alone sped up running make when
+# nothing has to be done from 1 sec to 0.12 sec on a 900 MHz Athlon.
+# We don't use ARCH:=$(MYARCH) so we can detect unknown architectures.
+ifeq ($(MYARCH),i386)
+ARCH=i386
+else
+ifeq ($(MYARCH),mips)
+ARCH=mips
+else
+ifeq ($(MYARCH),alpha)
+ARCH=alpha
+else
+ifeq ($(MYARCH),ppc)
+ARCH=ppc
+else
+ifeq ($(MYARCH),arm)
+ARCH=arm
+else
+ifeq ($(MYARCH),sparc)
+ARCH=sparc
+else
+ifeq ($(MYARCH),sparc64)
+ARCH=sparc64
+else
+ifeq ($(MYARCH),s390)
+ARCH=s390
+else
+ifeq ($(MYARCH),mipsel)
+ARCH=mipsel
+else
+ifeq ($(MYARCH),parisc)
+ARCH=parisc
+else
+ifeq ($(MYARCH),parisc64)
+ARCH=parisc
+MYARCH=parisc
+else
+ifeq ($(MYARCH),x86_64)
+ARCH=x86_64
+else
+ifeq ($(MYARCH),ia64)
+ARCH=ia64
+else
+$(error unknown architecture, please fix Makefile)
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+
+# ARCH=$(MYARCH)
+
+LIBDIR=${prefix}/lib
+ifeq ($(ARCH),x86_64)
+LIBDIR=${prefix}/lib64
+endif
+BINDIR=${prefix}/bin
+MAN1DIR=${prefix}/share/man/man1
+INSTALLHOME=$(LIBDIR)/dietlibc
OBJDIR=bin-$(ARCH)
+ILIBDIR=$(INSTALLHOME)/lib-$(ARCH)
-all: $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/librpc.a $(OBJDIR)/diet
+HOME=$(shell pwd)
-CFLAGS=-pipe
+WHAT= $(OBJDIR) $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o \
+ $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a \
+ $(OBJDIR)/libcompat.a $(OBJDIR)/libm.a \
+ $(OBJDIR)/librpc.a $(OBJDIR)/libpthread.a \
+ $(OBJDIR)/diet $(OBJDIR)/diet-i
+
+all: $(WHAT)
+
+profiling: $(OBJDIR)/libgmon.a $(OBJDIR)/pstart.o
+
+CFLAGS=-pipe -nostdinc
CROSS=
-VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:librpc:libregex:syscalls.c
+CC=gcc
+
+VPATH=lib:libstdio:libugly:libcruft:libcrypt:libshell:liblatin1:libcompat:libdl:librpc:libregex:libm:profiling
SYSCALLOBJ=$(patsubst syscalls.s/%.S,$(OBJDIR)/%.o,$(wildcard syscalls.s/*.S))
@@ -17,13 +105,23 @@ LIBSTDIOOBJ=$(patsubst libstdio/%.c,$(OBJDIR)/%.o,$(wildcard libstdio/*.c))
LIBCRUFTOBJ=$(patsubst libcruft/%.c,$(OBJDIR)/%.o,$(wildcard libcruft/*.c))
LIBCRYPTOBJ=$(patsubst libcrypt/%.c,$(OBJDIR)/%.o,$(wildcard libcrypt/*.c))
LIBSHELLOBJ=$(patsubst libshell/%.c,$(OBJDIR)/%.o,$(wildcard libshell/*.c))
+LIBCOMPATOBJ=$(patsubst libcompat/%.c,$(OBJDIR)/%.o,$(wildcard libcompat/*.c)) $(OBJDIR)/syscall.o
+LIBMATH=$(patsubst libm/%.c,%.o,$(wildcard libm/*.c))
LIBRPCOBJ=$(patsubst librpc/%.c,$(OBJDIR)/%.o,$(wildcard librpc/*.c))
LIBREGEXOBJ=$(patsubst libregex/%.c,$(OBJDIR)/%.o,$(wildcard libregex/*.c))
+LIBDLOBJ=$(patsubst libdl/%.c,$(OBJDIR)/%.o,$(wildcard libdl/*.c)) $(OBJDIR)/_dl_jump.o
+
+LIBPTHREAD_OBJS=$(patsubst libpthread/%.c,$(OBJDIR)/%.o,$(shell ./threadsafe.sh)) $(OBJDIR)/__testandset.o
+
+LIBGMON_OBJS=$(OBJDIR)/__mcount.o $(OBJDIR)/monitor.o $(OBJDIR)/profil.o
+
include $(ARCH)/Makefile.add
-ifeq ($(CFLAGS),-pipe)
+LIBMATHOBJ=$(patsubst %,$(OBJDIR)/%,$(LIBMATH))
+
+ifeq ($(CFLAGS),-pipe -nostdinc)
CFLAGS+=-O -fomit-frame-pointer
endif
@@ -31,28 +129,39 @@ ifneq ($(DEBUG),)
CFLAGS = -g
COMMENT = :
endif
-CFLAGS += -Wall -Wno-switch
+CFLAGS += -Wall -W -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wredundant-decls -Wno-unused
PWD=$(shell pwd)
.SUFFIXES:
.SUFFIXES: .S .c
-$(OBJDIR):
+# added real dynamic dietlibc.so
+PICODIR = pic-$(ARCH)
+
+$(OBJDIR) $(PICODIR):
mkdir $@
% :: %,v
-$(OBJDIR)/%.o: %.S
+$(OBJDIR)/pstart.o: start.S
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -DPROFILING -c $< -o $@
+
+$(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h
$(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
+$(OBJDIR)/pthread_%.o: libpthread/pthread_%.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
+ $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
+
$(OBJDIR)/%.o: %.c
$(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -c $< -o $@
- $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+ $(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
-DIETLIBC_OBJ = $(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
+DIETLIBC_OBJ = $(OBJDIR)/unified.o \
+$(SYSCALLOBJ) $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
$(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ) \
-$(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o $(OBJDIR)/unified.o \
+$(OBJDIR)/__longjmp.o $(OBJDIR)/setjmp.o \
$(OBJDIR)/mmap.o $(OBJDIR)/clone.o
$(OBJDIR)/dietlibc.a: $(DIETLIBC_OBJ) $(OBJDIR)/start.o
@@ -65,67 +174,179 @@ LIBLATIN1_OBJS=$(patsubst liblatin1/%.c,$(OBJDIR)/%.o,$(wildcard liblatin1/*.c))
$(OBJDIR)/liblatin1.a: $(LIBLATIN1_OBJS)
$(CROSS)ar cru $@ $^
+$(OBJDIR)/libgmon.a: $(LIBGMON_OBJS)
+ $(CROSS)ar cru $@ $^
+
+$(OBJDIR)/libpthread.a: $(LIBPTHREAD_OBJS) dietfeatures.h
+ $(CROSS)ar cru $@ $(LIBPTHREAD_OBJS)
+
+$(OBJDIR)/libcompat.a: $(LIBCOMPATOBJ)
+ $(CROSS)ar cru $@ $(LIBCOMPATOBJ)
+
+$(OBJDIR)/libm.a: $(LIBMATHOBJ)
+ $(CROSS)ar cru $@ $(LIBMATHOBJ)
+
$(OBJDIR)/libdietc.so: $(OBJDIR)/dietlibc.a
$(CROSS)ld -whole-archive -shared -o $@ $^
+dyn: dyn_lib
+
+# added dynamic linker
+$(OBJDIR)/libdl.a: $(LIBDLOBJ)
+ $(CROSS)ar cru $@ $(LIBDLOBJ)
+
+dyn_lib: $(PICODIR) $(PICODIR)/libc.so $(PICODIR)/dstart.o \
+ $(PICODIR)/dyn_so_start.o $(PICODIR)/dyn_start.o $(PICODIR)/dyn_stop.o \
+ $(PICODIR)/libpthread.so $(PICODIR)/libdl.so $(PICODIR)/libcompat.so \
+ $(PICODIR)/diet-dyn $(PICODIR)/diet-dyn-i
+
+$(PICODIR)/%.o: %.S $(ARCH)/syscalls.h
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+
+$(PICODIR)/pthread_%.o: libpthread/pthread_%.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+
+$(PICODIR)/%.o: %.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+
+$(PICODIR)/dstart.o: start.S
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -c $< -o $@
+
+$(PICODIR)/dyn_so_start.o: dyn_start.c
+ $(CROSS)$(CC) -I. -Iinclude $(CFLAGS) -fPIC -D__DYN_LIB -D__DYN_LIB_SHARED -c $< -o $@
+ $(COMMENT) $(CROSS)strip -x -R .comment -R .note $@
+
+DYN_LIBC_PIC = $(LIBOBJ) $(LIBSTDIOOBJ) $(LIBUGLYOBJ) \
+$(LIBCRUFTOBJ) $(LIBCRYPTOBJ) $(LIBSHELLOBJ) $(LIBREGEXOBJ)
+
+DYN_LIBC_OBJ = $(PICODIR)/dyn_syscalls.o $(PICODIR)/errlist.o \
+ $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(DYN_LIBC_PIC))
+
+DYN_PTHREAD_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBPTHREAD_OBJS))
+
+DYN_LIBDL_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBDLOBJ))
+
+DYN_LIBCOMPAT_OBJS = $(patsubst $(OBJDIR)/%.o,$(PICODIR)/%.o,$(LIBCOMPATOBJ))
+
+$(PICODIR)/libc.so: $(PICODIR) $(DYN_LIBC_OBJ)
+ $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBC_OBJ) -lgcc -Wl,-soname=libc.so
+
+$(PICODIR)/libpthread.so: $(DYN_PTHREAD_OBJS) dietfeatures.h
+ $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_PTHREAD_OBJS) -L$(PICODIR) -lc -Wl,-soname=libpthread.so
+
+$(PICODIR)/libdl.so: libdl/_dl_main.c dietfeatures.h
+ $(CROSS)$(CC) -D__OD_CLEAN_ROOM -DNODIETREF -fPIC -nostdlib -shared -o $@ $(CFLAGS) -I. -Iinclude libdl/_dl_main.c -Wl,-soname=libdl.so
+
+#$(PICODIR)/libdl.so: $(DYN_LIBDL_OBJS) dietfeatures.h
+# $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBDL_OBJS) -L$(PICODIR) -ldietc -Wl,-soname=libdl.so
+
+$(PICODIR)/libcompat.so: $(DYN_LIBCOMPAT_OBJS) dietfeatures.h
+ $(CROSS)$(CC) -nostdlib -shared -o $@ $(CFLAGS) -fPIC $(DYN_LIBCOMPAT_OBJS) -L$(PICODIR) -lc -Wl,-soname=libcompat.so
+
+
+
$(SYSCALLOBJ): syscalls.h
-$(OBJDIR)/diet: diet.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a
- $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(PWD)\"
+VERSION=dietlibc-$(shell head -1 CHANGES|sed 's/://')
+CURNAME=$(notdir $(shell pwd))
+
+$(OBJDIR)/diet: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -DVERSION=\"$(VERSION)\" -lgcc
+ $(CROSS)strip -R .comment -R .note $@
+
+$(OBJDIR)/diet-i: $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o diet.c $(OBJDIR)/dietlibc.a $(OBJDIR)/dyn_stop.o
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -nostdlib -o $@ $^ -DDIETHOME=\"$(INSTALLHOME)\" -DVERSION=\"$(VERSION)\" -DINSTALLVERSION -lgcc
$(CROSS)strip -R .comment -R .note $@
+$(PICODIR)/diet-dyn: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(HOME)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(HOME)/$(PICODIR)/libdl.so
+ $(CROSS)strip -R .command -R .note $@
+
+$(PICODIR)/diet-dyn-i: $(PICODIR)/start.o $(PICODIR)/dyn_start.o diet.c
+ $(CROSS)$(CC) -Iinclude $(CFLAGS) -fPIC -nostdlib -o $@ $^ -DDIETHOME=\"$(prefix)\" -D__DYN_LIB -DVERSION=\"$(VERSION)\" -L$(PICODIR) -lc -lgcc $(PICODIR)/dyn_stop.o -Wl,-dynamic-linker=$(ILIBDIR)/libdl.so -DINSTALLVERSION
+ $(CROSS)strip -R .command -R .note $@
+
$(OBJDIR)/djb: $(OBJDIR)/compile $(OBJDIR)/load
$(OBJDIR)/compile:
- echo 'exec gcc $(CFLAGS) -I$(PWD)/$(OBJDIR)/include -c $${1+"$$@"}' > $@
+ echo 'exec' $(CC) '$(CFLAGS) -I$(PWD)/$(OBJDIR)/include -c $${1+"$$@"}' > $@
chmod 755 $@
$(OBJDIR)/load:
- echo 'main="$$1"; shift; exec gcc -nostdlib -o "$$main" $(PWD)/$(OBJDIR)/start.o "$$main".o $${1+"$$@"} $(PWD)/$(OBJDIR)/dietlibc.a -lgcc' > $@
+ echo 'main="$$1"; shift; exec' $(CC) '-nostdlib -o "$$main" $(PWD)/$(OBJDIR)/start.o "$$main".o $${1+"$$@"} $(PWD)/$(OBJDIR)/dietlibc.a -lgcc' > $@
chmod 755 $@
clean:
rm -f *.o *.a t t1 compile load exports mapfile libdietc.so
- rm -rf bin-*
+ rm -rf bin-* pic-*
+ $(MAKE) -C libdl clean
-tar: clean
- rm -f armv4l
- ln -sf arm armv4l
- cd ..; tar cvvf dietlibc.tar.bz2 dietlibc --use=bzip2 --exclude CVS
+tar: clean rename
+ cd ..; tar cvvf $(VERSION).tar.bz2 $(VERSION) --use=bzip2 --exclude CVS
+
+rename:
+ if test $(CURNAME) != $(VERSION); then cd .. && mv $(CURNAME) $(VERSION); fi
$(OBJDIR)/exports: $(OBJDIR)/dietlibc.a
nm -g $(OBJDIR)/dietlibc.a | grep -w T | awk '{ print $$3 }' | sort -u > $(OBJDIR)/exports
.PHONY: t t1
t:
- $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o t t.c $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a -lgcc -Wl,-Map,mapfile
+ $(CROSS)$(CC) -g $(CFLAGS) -fno-builtin -nostdlib -Iinclude -o t t.c $(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dietlibc.a -lgcc $(OBJDIR)/dyn_stop.o -Wl,-Map,mapfile
t1:
$(CROSS)$(CC) -g -o t1 t.c
-install: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/diet
- cp $(OBJDIR)/start.o $(INSTALLPREFIX)$(prefix)/lib/dietstart.o
- cp $(OBJDIR)/dietlibc.a $(INSTALLPREFIX)$(prefix)/lib/libdietc.a
- cp $(OBJDIR)/liblatin1.a $(INSTALLPREFIX)$(prefix)/lib/libdietlatin1.a
- cp $(OBJDIR)/diet $(INSTALLPREFIX)$(prefix)/bin/diet
-
-.PHONY: sparc ppc mips arm alpha i386
-
-arm sparc ppc alpha i386:
- $(MAKE) ARCH=$@ CROSS=$@-linux- all t bin-$@/libdietc.so
-
-mips:
- $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all t bin-$@/libdietc.so
+install: $(OBJDIR)/start.o $(OBJDIR)/dietlibc.a $(OBJDIR)/librpc.a $(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(OBJDIR)/diet-i
+ $(INSTALL) -d $(DESTDIR)$(ILIBDIR) $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(BINDIR)
+ $(INSTALL) $(OBJDIR)/start.o $(DESTDIR)$(ILIBDIR)/start.o
+ $(INSTALL) -m 644 $(OBJDIR)/libm.a $(OBJDIR)/libpthread.a $(OBJDIR)/librpc.a \
+$(OBJDIR)/liblatin1.a $(OBJDIR)/libcompat.a $(DESTDIR)$(ILIBDIR)
+ $(INSTALL) -m 644 $(OBJDIR)/dietlibc.a $(DESTDIR)$(ILIBDIR)/libc.a
+ifeq ($(MYARCH),$(ARCH))
+ $(INSTALL) $(OBJDIR)/diet-i $(DESTDIR)$(BINDIR)/diet
+ -$(INSTALL) $(PICODIR)/diet-dyn-i $(DESTDIR)$(BINDIR)/diet-dyn
+endif
+ -$(INSTALL) $(OBJDIR)/pstart.o $(OBJDIR)/libgmon.a $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o $(DESTDIR)$(ILIBDIR)
+ -$(INSTALL) $(PICODIR)/libc.so $(DESTDIR)$(ILIBDIR)/libc.so
+ -$(INSTALL) $(PICODIR)/libpthread.so $(DESTDIR)$(ILIBDIR)/libpthread.so
+ -$(INSTALL) $(PICODIR)/libdl.so $(DESTDIR)$(ILIBDIR)/libdl.so
+ -$(INSTALL) $(PICODIR)/libcompat.so $(DESTDIR)$(ILIBDIR)/libcompat.so
+ -$(INSTALL) $(PICODIR)/dyn_start.o $(DESTDIR)$(ILIBDIR)/dyn_dstart.o
+ -$(INSTALL) $(PICODIR)/dyn_stop.o $(DESTDIR)$(ILIBDIR)/dyn_dstop.o
+ -$(INSTALL) $(PICODIR)/dstart.o $(PICODIR)/dyn_so_start.o $(DESTDIR)$(ILIBDIR)
+ $(INSTALL) -m 644 diet.1 $(DESTDIR)$(MAN1DIR)/diet.1
+ if test -f $(PICODIR)/libc.so -a ! -f $(DESTDIR)/etc/diet.ld.conf; then echo "$(ILIBDIR)" > $(DESTDIR)/etc/diet.ld.conf; fi
+ for i in `find include -name \*.h`; do install -m 644 -D $$i $(DESTDIR)$(INSTALLHOME)/$$i; done
+
+.PHONY: sparc ppc mips arm alpha i386 parisc mipsel powerpc s390 sparc64
+.PHONY: x86_64 ia64
+
+arm sparc ppc alpha i386 mips parisc s390 sparc64 x86_64 ia64:
+ $(MAKE) ARCH=$@ CROSS=$@-linux- all
+
+# Cross compile for little endian MIPS
+mipsel:
+ $(MAKE) ARCH=$@ CROSS=mips-linux- all
+
+mips-gnu:
+ $(MAKE) ARCH=$@ CROSS=$@-linux-gnu- all
+
+# Some people named their cross compiler toolchain powerpc-linux-gcc
+powerpc:
+ $(MAKE) ARCH=ppc CROSS=powerpc-linux- all
cross:
- $(MAKE) arm sparc ppc alpha i386 mips
+ $(MAKE) arm sparc ppc alpha i386 mips sparc64
# these depend on dietfeatures.h for large file backward compatibility
-$(OBJDIR)/__fstat64.o $(OBJDIR)/__lstat64.o $(OBJDIR)/__stat64.o: dietfeatures.h
+$(OBJDIR)/__fstat64.o $(OBJDIR)/__lstat64.o $(OBJDIR)/__stat64.o $(OBJDIR)/lseek64.o $(OBJDIR)/readdir64.o $(OBJDIR)/stat64.o $(OBJDIR)/lstat64.o $(OBJDIR)/fstat64.o $(OBJDIR)/truncate64.o $(OBJDIR)/__truncate64.o $(OBJDIR)/ftruncate64.o $(OBJDIR)/__ftruncate64.o $(PICODIR)/dyn_syscalls.o $(PICODIR)/__truncate64.o $(PICODIR)/__ftruncate64.o $(PICODIR)/__stat64.o $(PICODIR)/__lstat64.o $(PICODIR)/__fstat64.o: dietfeatures.h
# these depend on dietfeatures.h for thread support
-$(OBJDIR)/alloc.o $(OBJDIR)/perror.o $(OBJDIR)/logging.o $(OBJDIR)/unified.o: dietfeatures.h
+$(OBJDIR)/alloc.o $(OBJDIR)/perror.o $(OBJDIR)/logging.o $(OBJDIR)/unified.o $(OBJDIR)/clone.o $(OBJDIR)/set_errno.o: dietfeatures.h
# these depend on dietfeatures.h for linker warnings
$(OBJDIR)/assert_fail.o $(OBJDIR)/sprintf.o $(OBJDIR)/vsnprintf.o $(OBJDIR)/___div.o $(OBJDIR)/fflush.o $(OBJDIR)/setvbuf.o $(OBJDIR)/system.o $(OBJDIR)/sendfile.o $(OBJDIR)/setenv.o: dietfeatures.h
@@ -137,10 +358,56 @@ fclose.o $(OBJDIR)/fdglue.o $(OBJDIR)/fflush.o $(OBJDIR)/fgetc.o $(OBJDIR)/fputc
strcasecmp.o $(OBJDIR)/strcat.o $(OBJDIR)/strchr.o $(OBJDIR)/strcmp.o $(OBJDIR)/strcpy.o $(OBJDIR)/strlen.o $(OBJDIR)/strncasecmp.o $(OBJDIR)/strncat.o $(OBJDIR)/strrchr.o: dietfeatures.h
# these depend on dietfeatures.h for /proc
-$(OBJDIR)/tty.o: dietfeatures.h
-
-# these depend on dietfeatures.h for ungetc support ;-)
-$(OBJDIR)/ungetc.o: dietfeatures.h
+$(OBJDIR)/ttyname.o $(OBJDIR)/sysconf_cpus.o: dietfeatures.h
# these depend on dietfeatures.h for WANT_TZFILE_PARSER
-$(OBJDIR)/localtime_r.o: dietfeatures.h
+$(OBJDIR)/localtime_r.o $(OBJDIR)/strftime.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_SMALL_STDIO_BUFS
+$(LIBSTDIOOBJ): dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_FULL_RESOLV_CONF
+$(OBJDIR)/dnscruft.o $(OBJDIR)/dnscruft2.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_THREAD_SAFE and errno
+$(LIBRPCOBJ) $(OBJDIR)/logging.o $(OBJDIR)/alloc.o $(OBJDIR)/cfsetospeed.o $(OBJDIR)/cfsetispeed.o \
+$(OBJDIR)/execl.o $(OBJDIR)/execlp.o $(OBJDIR)/execv.o $(OBJDIR)/execvp.o $(OBJDIR)/isatty.o \
+$(OBJDIR)/lockf.o $(OBJDIR)/perror.o $(OBJDIR)/remove.o $(OBJDIR)/set_errno.o $(OBJDIR)/sigemptyset.o \
+$(OBJDIR)/tcsetattr.o $(OBJDIR)/dnscruft2.o $(OBJDIR)/dnscruft.o $(OBJDIR)/entlib.o \
+$(OBJDIR)/gethostbyaddr.o $(OBJDIR)/gethostbyaddr_r.o $(OBJDIR)/gethostbyname.o \
+$(OBJDIR)/gethostbyname_r.o $(OBJDIR)/gethostbyname2.o $(OBJDIR)/gethostbyname2_r.o \
+$(OBJDIR)/inet_pton.o $(OBJDIR)/mkstemp.o $(OBJDIR)/mktemp.o $(OBJDIR)/tempnam.o \
+$(OBJDIR)/glob.o $(OBJDIR)/realpath.o $(OBJDIR)/fdglue.o $(OBJDIR)/fdglue2.o \
+$(OBJDIR)/getaddrinfo.o $(OBJDIR)/getnameinfo.o $(OBJDIR)/getprotoent.o \
+$(OBJDIR)/getservent.o $(OBJDIR)/iconv.o $(OBJDIR)/iconv_open.o \
+$(OBJDIR)/netent.o $(OBJDIR)/system.o $(OBJDIR)/stdin.o $(OBJDIR)/stdout.o \
+$(OBJDIR)/stderr.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_CRYPT_MD5
+$(OBJDIR)/crypt.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_FREAD_OPTIMIZATION
+$(OBJDIR)/fread.o $(OBJDIR)/fwrite.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_DYNAMIC
+$(OBJDIR)/start.o $(OBJDIR)/dyn_start.o $(OBJDIR)/dyn_stop.o: dietfeatures.h
+
+$(OBJDIR)/unified.o: dietuglyweaks.h
+
+$(OBJDIR)/adjtimex.o: include/sys/timex.h
+
+$(OBJDIR)/fgetc_unlocked.o $(OBJDIR)/fread.o $(OBJDIR)/ungetc.o: dietstdio.h
+
+# these depend on dietfeatures.h for WANT_LINKER_WARNINGS
+$(OBJDIR)/setlinebuf.o $(OBJDIR)/bzero.o $(OBJDIR)/setegid.o \
+$(OBJDIR)/seteuid.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_FULL_POSIX_COMPAT
+$(OBJDIR)/strncpy.o: dietfeatures.h
+$(OBJDIR)/strxfrm.o: dietfeatures.h
+
+# these depend on dietfeatures.h for WANT_INET_ADDR_DNS
+$(OBJDIR)/gethostbyname_r.o: dietfeatures.h
+
+
+# CFLAGS+=-W -Wshadow -Wid-clash-31 -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wwrite-strings