# Makefile for uClibc
#
# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

klib-y += brk.c sigaction.c __syscall_error.c

klib-y += \
    __longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
    bsd-_setjmp.S syscall.S mmap.S mmap64.S

CFGLAGS_crt1.o := -DL_crt1

obj-y := crt1.S crti.S crtn.S


# HAVE_SHARED is from .config
ifeq ($(HAVE_SHARED),y)

# HAVE_SHARED is from .config
obj-y += Scrt1.o

# Scrt1.o is built in "shared library case" only.
# Unlike Linux kerenl, creation of built-in.o out of all obj-y files
# in the directory (and subdirs) is vestigial in uclibc.
# Here it will fail since crt.o and Scrt.o both have _start, __data_start etc.
# Suppress the error by adding this to LD command line:
EXTRA_LDFLAGS := -z muldefs

CFGLAGS_Scrt1.o := -DL_Scrt1

# Explain that Scrt1.o is to be built from crt1.S
$(obj)/Scrt1.o: $(obj)/crt1.S
	$(call if_changed_dep,as_o_S)

endif
