1PKGDIR ?= ..
2L4DIR  ?= $(PKGDIR)/../../..
3
4PC_FILENAME := libdl
5
6CON_DIR := $(PKGDIR)/../uclibc/lib/contrib/uclibc
7PTH_DIR := $(PKGDIR)/../uclibc/lib/libpthread
8
9DIR_amd64 := x86_64
10DIR_x86   := i386
11DIR_arm   := arm
12DIR_arm64 := arm64
13DIR_ppc32 := powerpc
14DIR_sparc := sparc
15DIR_mips  := mips
16
17
18vpath %.c $(CON_DIR)/ldso/libdl
19vpath %.S $(CON_DIR)/ldso/ldso/$(DIR_$(ARCH))
20
21PRIVATE_INCDIR-x86 := $(CON_DIR)/libc
22PRIVATE_INCDIR := $(PRIVATE_INCDIR-$(ARCH)) \
23                  $(CON_DIR)/ldso/ldso/$(DIR_$(ARCH)) \
24		  $(SRC_DIR)           \
25		  $(CON_DIR)/ldso/include \
26		  $(PTH_DIR)/src \
27		  $(PTH_DIR)/src/sysdeps/$(DIR_$(ARCH))
28
29TARGET := libdl.a libdl.so
30
31SRC_S_libdl.a := resolve.S
32SRC_C := libdl.c #dl-iterate-phdr.c dl-support.c
33
34
35CPPFLAGS := -DNOT_IN_libc -DIS_IN_libdl \
36            -DLDSO_ELFINTERP=\"../ldso/$(DIR_$(ARCH))/elfinterp.c\" \
37            -include libc-symbols.h -DUCLIBC_LDSO=\"libld-l4.so\" \
38            -DUCLIBC_RUNTIME_PREFIX=\"/\"
39
40DEFINES_x86-l4f   += -DUSE_TLS=1 -DUSE___THREAD=1
41DEFINES_amd64-l4f += -DUSE_TLS=1 -DUSE___THREAD=1
42DEFINES_arm-l4f   += -DUSE_TLS=1 -DUSE___THREAD=1
43DEFINES_arm64-l4f += -DUSE_TLS=1 -DUSE___THREAD=1
44DEFINES_mips-l4f  += -DUSE_TLS=1 -DUSE___THREAD=1
45
46LDFLAGS = -lld-l4
47#LDFLAGS  =  -fini dl_cleanup
48
49EXTRA_LIBS := -lld-l4
50
51CRT0 :=
52
53include $(L4DIR)/mk/lib.mk
54PICFLAGS += -DSHARED
55
56ldso.1.o: ldso.o
57	$(OBJCOPY) --weaken $< $@
58
59CXXFLAGS := -DL4_NO_RTTI -fno-rtti -fno-exceptions
60