3 # Makefile configuration, without explicit rules
6 # CROSS is the prefix used for system tools like gcc, ld etc.
9 # KCROSS is the prefix we use for klibc installations. This is usually
10 # the same as CROSS, but may be different, e.g. to install an i386
11 # cross-compilation suite on an x86-64 system, using the same gcc/binutils.
14 # Location for installation
16 bindir = $(prefix)/bin
17 libdir = $(prefix)/lib
18 mandir = $(prefix)/man
19 INSTALLDIR = $(prefix)/lib/klibc
22 INSTALL_EXEC = install -m 755
23 INSTALL_DATA = install -m 644
25 # Eventually support separate compilation, but we don't have it yet...
28 # Kernel trees (source and obj) - can potentially be different
29 KRNLSRC = $(SRCROOT)/linux
30 KRNLOBJ = $(SRCROOT)/linux
32 # klibc version information
33 KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \
34 -D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version)
36 ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
39 KLIBSRC = $(SRCROOT)/klibc
40 KLIBOBJ = $(OBJROOT)/klibc
41 INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \
42 -I$(SRCROOT)/include/bits$(BITSIZE) \
43 -I$(SRCROOT)/include \
44 -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include
45 REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdinc -iwithprefix include \
49 RANLIB = $(CROSS)ranlib
52 OBJCOPY = $(CROSS)objcopy
55 STRIPFLAGS = --strip-all -R .comment -R .note
56 STRIPCMD = $(STRIP) $(STRIPFLAGS)
63 # Static library paths
64 CRT0 = $(KLIBOBJ)/crt0.o
65 KLIBC = $(KLIBOBJ)/libc.a
66 LIBGCC = $(shell $(CC) $(REQFLAGS) $(OPTFLAGS) --print-libgcc)
68 # Shared library paths
69 CRTSHARED = $(KLIBOBJ)/interp.o
70 LIBSHARED = $(KLIBOBJ)/libc.so
73 # This indicates the location of the final version of the shared library.
74 # THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH.
75 # Leave this empty to make it the root.
79 # Enable this to make perror/strerror return real error messages
80 # This makes klibc.so and any static binary which uses these functions
84 # Include zlib in klibc. This roughly triples the size of klibc!
88 # Include arch-specific rule fragments
90 include $(KLIBSRC)/arch/$(ARCH)/MCONFIG
93 STRIP = /bin/true -Since_we_are_debugging
97 # How to tell the linker main() is the entrypoint