X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=klibc%2FMCONFIG;h=1141b78d474bed1d9c2361240dd11d1e4ce1b9e0;hp=ed7755b3823264be00834879869be2a0f41baeec;hb=cb948532ff3cb7edf1d2eead7a5cce9e8a1a7a97;hpb=a41a0e28c2ba0abf99b5e7ea17645ae0e4f05758 diff --git a/klibc/MCONFIG b/klibc/MCONFIG index ed7755b38..1141b78d4 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -3,30 +3,71 @@ # Makefile configuration, without explicit rules # -ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) +# CROSS is the prefix used for system tools like gcc, ld etc. CROSS = + +# KCROSS is the prefix we use for klibc installations. This is usually +# the same as CROSS, but may be different, e.g. to install an i386 +# cross-compilation suite on an x86-64 system, using the same gcc/binutils. +KCROSS ?= $(CROSS) + +# Location for installation +prefix = /usr +bindir = $(prefix)/bin +libdir = $(prefix)/lib +mandir = $(prefix)/man +INSTALLDIR = $(prefix)/lib/klibc +INSTALLROOT = + +INSTALL_EXEC = install -m 755 +INSTALL_DATA = install -m 644 + +# Eventually support separate compilation, but we don't have it yet... +OBJROOT = $(SRCROOT) + +# Kernel trees (source and obj) - can potentially be different +KRNLSRC = $(SRCROOT)/linux +KRNLOBJ = $(SRCROOT)/linux + +# klibc version information +KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \ + -D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version) + +ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) CC = $(CROSS)gcc LD = $(CROSS)ld KLIBSRC = $(SRCROOT)/klibc -REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include -I$(KLIBSRC) \ - -I$(KLIBSRC)/arch/$(ARCH)/include \ - -I$(KLIBSRC)/include/bits$(BITSIZE) \ - -D__KLIBC__ -DBITSIZE=$(BITSIZE) -I$(KLIBSRC)/include \ - -I$(SRCROOT)/linux/include +KLIBOBJ = $(OBJROOT)/klibc +INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \ + -I$(SRCROOT)/include/bits$(BITSIZE) \ + -I$(SRCROOT)/include \ + -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include +REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdinc -iwithprefix include \ + $(INCLUDE) LDFLAGS = AR = $(CROSS)ar RANLIB = $(CROSS)ranlib NM = $(CROSS)nm PERL = perl -STRIP = $(CROSS)strip --strip-all -R .comment -R .note +OBJCOPY = $(CROSS)objcopy + +STRIP = $(CROSS)strip +STRIPFLAGS = --strip-all -R .comment -R .note +STRIPCMD = $(STRIP) $(STRIPFLAGS) HOST_CC = gcc -HOST_LDFLAGS = -s +HOST_CFLAGS = -g -O +HOST_LDFLAGS = HOST_LIBS = -CRT0 = $(KLIBSRC)/crt0.o -KLIBC = $(KLIBSRC)/libc.a -LIBGCC = $(shell $(CC) --print-libgcc) +# Static library paths +CRT0 = $(KLIBOBJ)/crt0.o +KLIBC = $(KLIBOBJ)/libc.a +LIBGCC = $(shell $(CC) $(REQFLAGS) $(OPTFLAGS) --print-libgcc) + +# Shared library paths +CRTSHARED = $(KLIBOBJ)/interp.o +LIBSHARED = $(KLIBOBJ)/libc.so # # This indicates the location of the final version of the shared library. @@ -35,7 +76,23 @@ LIBGCC = $(shell $(CC) --print-libgcc) # SHLIBDIR = /lib +# Enable this to make perror/strerror return real error messages +# This makes klibc.so and any static binary which uses these functions +# about 4K bigger. +ERRLIST = 1 + +# Include zlib in klibc. This roughly triples the size of klibc! +ZLIB = 0 + # # Include arch-specific rule fragments # include $(KLIBSRC)/arch/$(ARCH)/MCONFIG + +ifeq ($(DEBUG),y) +STRIP = /bin/true -Since_we_are_debugging +OPTFLAGS += -O1 -g +endif + +# How to tell the linker main() is the entrypoint +EMAIN ?= -e main