1PKGDIR		?= .
2L4DIR		?= $(PKGDIR)/../../..
3
4SYSTEMS		= $(SYSTEMS_PLAIN)
5
6define PC_EXTRA
7Link_Start= %{nocrt1|shared:; :%:search(crt1.o %(libdir))} %:search(crti%{shared:.s}.o %(libdir)) %{static:%:if-exists(%:search(crtbeginT.o %(gcclibdir)) %:search(crtbegin.o %(gcclibdir)));shared:%:search(crtbeginS.o %(gcclibdir));:%:search(crtbegin.o %(gcclibdir))}
8Link_End=   %:search(%{shared:crtendS.o;:crtend.o} %(gcclibdir)) %:search(crtn%{shared:.s}.o %(libdir))
9endef
10
11LD_SCRIPTS      = main_stat.ld main_rel.ld main_dyn.ld
12PC_FILENAME    := ldscripts
13PC_LIBS        :=
14
15# Create the wrapper binaries for programs and shared libs from uclibc
16# source files (assembly).
17# This is done here bacause l4sys.so already depends on the wrappers and must
18# not depend on the whole libc package.
19#
20# to find the uclibc files
21UCLIBC_ARCH_x86   := i386
22UCLIBC_ARCH_arm   := arm
23UCLIBC_ARCH_arm64 := arm64
24UCLIBC_ARCH_amd64 := x86_64
25UCLIBC_ARCH_mips  := mips
26UCLIBC_ARCH_ppc32 := powerpc
27UCLIBC_ARCH_sparc := sparc
28UCLIBC_BASE       = $(PKGDIR)/../uclibc
29UCLIBC_SYSDEPS    = $(UCLIBC_BASE)/lib/contrib/uclibc/libc/sysdeps/linux/$(UCLIBC_ARCH_$(ARCH))
30
31PRIVATE_INCDIR    = $(PKGDIR) $(UCLIBC_SYSDEPS)
32TARGET            =
33
34vpath %.S $(UCLIBC_SYSDEPS)
35
36INSTALL_TARGET	= $(LD_SCRIPTS) crti.o crtn.o crt1.o crti.s.o crtn.s.o crt1.s.o
37DEFINES_crt1.s.o = -DL_Scrt1
38
39REQUIRES_LIBS_all_lib :=
40
41include $(L4DIR)/mk/lib.mk
42
43$(eval $(call BID_MAKE_RULE_template, crti_s.o, crti.S,AS))
44
45crti.o: crti_s.o kip_addr.o
46	@$(GEN_MESSAGE)
47	$(VERBOSE)$(LD) -r -o $@ $^
48
49%.ld: $(PKGDIR)/ARCH-$(ARCH)/%.ld $(SRC_DIR)/Makefile $(SRC_DIR)/generic.h
50	@$(GEN_MESSAGE)
51	$(VERBOSE)$(CPP) -nostdinc -include $(SRC_DIR)/generic.h \
52	      -Wno-trigraphs -U$(UCLIBC_ARCH_$(ARCH)) $(CFLAGS) -P $$CPP_ARGS $< $@
53