|
|
e0aa75 |
libc_src_dirs = $(SOURCE_DIR)/src/*/
|
|
|
e0aa75 |
libc_src_dirs += $(SOURCE_DIR)/crt/
|
|
|
e0aa75 |
libc_src_dirs += $(SOURCE_DIR)/ldso/
|
|
|
3ae283 |
|
|
|
e0aa75 |
ifeq ($(PORT_DIR),$(PROJECT_DIR))
|
|
|
e0aa75 |
libc_src_dirs += $(PROJECT_DIR)/src/*/
|
|
|
e0aa75 |
libc_src_dirs += $(PROJECT_DIR)/crt/
|
|
|
e0aa75 |
libc_src_dirs += $(PROJECT_DIR)/ldso/
|
|
|
e0aa75 |
endif
|
|
|
3ae283 |
|
|
|
e0aa75 |
libc_src_files = $(wildcard $(addsuffix *.c,$(libc_src_dirs)))
|
|
|
e0aa75 |
libc_src_sorted = $(sort $(libc_src_files))
|
|
|
3ae283 |
|
|
|
e0aa75 |
libc_src_merged = $(subst $(SOURCE_DIR)/,./, \
|
|
|
e0aa75 |
$(subst $(PROJECT_DIR)/,./, \
|
|
|
e0aa75 |
$(libc_src_sorted)))
|
|
|
e0aa75 |
|
|
|
418a36 |
libc_arch_dirs = $(sort $(wildcard $(addsuffix $(ARCH)/, $(libc_src_dirs))))
|
|
|
e0aa75 |
|
|
|
418a36 |
libc_arch_files_c = $(subst $(PORT_DIR)/,./,$(wildcard $(addsuffix *.c,$(libc_arch_dirs))))
|
|
|
418a36 |
libc_arch_files_s = $(subst $(PORT_DIR)/,./,$(wildcard $(addsuffix *.s,$(libc_arch_dirs))))
|
|
|
418a36 |
libc_arch_files_S = $(subst $(PORT_DIR)/,./,$(wildcard $(addsuffix *.S,$(libc_arch_dirs))))
|
|
|
e0aa75 |
|
|
|
418a36 |
libc_arch_files = $(libc_arch_files_c) \
|
|
|
418a36 |
$(libc_arch_files_s) \
|
|
|
418a36 |
$(libc_arch_files_S)
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_arch_substs_c = $(subst /$(ARCH)/,/,$(libc_arch_files_c))
|
|
|
e0aa75 |
libc_arch_substs_s = $(subst /$(ARCH)/,/,$(libc_arch_files_s))
|
|
|
e0aa75 |
libc_arch_substs_S = $(subst /$(ARCH)/,/,$(libc_arch_files_S))
|
|
|
e0aa75 |
|
|
|
418a36 |
libc_arch_substs = $(libc_arch_substs_c) \
|
|
|
418a36 |
$(libc_arch_substs_s:%.s=%.c) \
|
|
|
418a36 |
$(libc_arch_substs_S:%.S=%.c)
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_pure_files = $(filter-out $(libc_arch_substs), $(libc_src_merged))
|
|
|
e0aa75 |
libc_all_files = $(libc_pure_files) $(libc_arch_files)
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_crt_files_c = $(filter ./crt/%.c, $(libc_all_files))
|
|
|
e0aa75 |
libc_crt_files_s = $(filter ./crt/%.s, $(libc_all_files))
|
|
|
e0aa75 |
libc_crt_files_S = $(filter ./crt/%.S, $(libc_all_files))
|
|
|
e0aa75 |
libc_crt_files = $(filter ./crt/%, $(libc_all_files))
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_ldso_files = $(filter ./ldso/%, $(libc_all_files))
|
|
|
e0aa75 |
libc_ldso_files += $(filter ./src/ldso/%, $(libc_all_files))
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_ldso_files_c = $(filter %.c, $(libc_ldso_files))
|
|
|
e0aa75 |
libc_ldso_files_s = $(filter %.s, $(libc_ldso_files))
|
|
|
e0aa75 |
libc_ldso_files_S = $(filter %.S, $(libc_ldso_files))
|
|
|
e0aa75 |
|
|
|
0563c2 |
libc_excl_files = $(libc_crt_files) $(libc_ldso_files) $(LIBC_EXCL_FILES)
|
|
|
e0aa75 |
libc_core_files = $(filter-out $(libc_excl_files), $(libc_all_files))
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_core_files_c = $(filter %.c, $(libc_core_files))
|
|
|
e0aa75 |
libc_core_files_s = $(filter %.s, $(libc_core_files))
|
|
|
e0aa75 |
libc_core_files_S = $(filter %.S, $(libc_core_files))
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_tree_dirs = $(subst $(SOURCE_DIR)/,./, \
|
|
|
e0aa75 |
$(subst $(PORT_DIR)/,./, \
|
|
|
e0aa75 |
$(wildcard $(SOURCE_DIR)/src/*/) \
|
|
|
e0aa75 |
$(wildcard $(PORT_DIR)/src/*/) \
|
|
|
e0aa75 |
$(wildcard $(SOURCE_DIR)/src/*/$(ARCH)/) \
|
|
|
e0aa75 |
$(wildcard $(PORT_DIR)/src/*/$(ARCH)/)))
|
|
|
e0aa75 |
|
|
|
e0aa75 |
libc_tree_dirs += ./crt/ ./crt/$(ARCH)/
|
|
|
e0aa75 |
libc_tree_dirs += ./ldso/ ./ldso/$(ARCH)/
|
|
|
418a36 |
|
|
|
418a36 |
|
|
|
964b8d |
# depend on all headers
|
|
|
964b8d |
HEADER_DEPS = $(TARGET_SYS_HEADERS) $(src_bits_h) $(src_c_headers)
|
|
|
964b8d |
ALL_HEADERS += $(HEADER_DEPS)
|
|
|
964b8d |
|
|
|
418a36 |
# core objects
|
|
|
418a36 |
STATIC_OBJS += $(libc_core_files_c:%.c=%.o)
|
|
|
418a36 |
STATIC_OBJS += $(libc_core_files_s:%.s=%.o)
|
|
|
418a36 |
STATIC_OBJS += $(libc_core_files_S:%.S=%.o)
|
|
|
418a36 |
|
|
|
418a36 |
SHARED_OBJS += $(libc_core_files_c:%.c=%.lo)
|
|
|
418a36 |
SHARED_OBJS += $(libc_core_files_s:%.s=%.lo)
|
|
|
418a36 |
SHARED_OBJS += $(libc_core_files_S:%.S=%.lo)
|
|
|
418a36 |
|
|
|
418a36 |
$(STATIC_OBJS): headers.tag host.tag tree.tag
|
|
|
418a36 |
$(SHARED_OBJS): headers.tag host.tag tree.tag
|
|
|
418a36 |
|
|
|
3d4ab4 |
$(SHARED_OBJS): CFLAGS_SHARED += $(LIBC_CFLAGS_SHARED) -DSHARED=
|
|
|
3d4ab4 |
$(STATIC_OBJS): CFLAGS_STATIC += $(LIBC_CFLAGS_STATIC)
|
|
|
418a36 |
|
|
|
964b8d |
src/%.o:$(PORT_DIR)/src/%.c $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
|
|
|
418a36 |
|
|
|
418a36 |
src/%.o:$(PORT_DIR)/src/%.s
|
|
|
633b76 |
$(AS) -o $@ $< $(CFLAGS_ASM)
|
|
|
418a36 |
|
|
|
964b8d |
src/%.o:$(PORT_DIR)/src/%.S $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
|
|
|
418a36 |
|
|
|
964b8d |
src/%.lo:$(PORT_DIR)/src/%.c $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
|
|
|
418a36 |
|
|
|
418a36 |
src/%.lo:$(PORT_DIR)/src/%.s
|
|
|
633b76 |
$(AS) -o $@ $< $(CFLAGS_ASM)
|
|
|
418a36 |
|
|
|
964b8d |
src/%.lo:$(PORT_DIR)/src/%.S $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
|
|
|
418a36 |
|
|
|
418a36 |
|
|
|
418a36 |
# crt objects
|
|
|
418a36 |
CRT_OBJS += $(libc_crt_files_c:%.c=%.o)
|
|
|
418a36 |
CRT_OBJS += $(libc_crt_files_s:%.s=%.o)
|
|
|
418a36 |
CRT_OBJS += $(libc_crt_files_S:%.S=%.o)
|
|
|
418a36 |
|
|
|
418a36 |
$(CRT_OBJS): headers.tag host.tag tree.tag
|
|
|
418a36 |
$(CRT_OBJS): CFLAGS_CONFIG += -DCRT
|
|
|
418a36 |
|
|
|
418a36 |
./crt/Scrt1.o: CFLAGS_CONFIG += -fPIC
|
|
|
418a36 |
./crt/rcrt1.o: CFLAGS_CONFIG += -fPIC
|
|
|
418a36 |
|
|
|
964b8d |
crt/%.o:$(PORT_DIR)/crt/%.c $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
|
|
|
418a36 |
|
|
|
418a36 |
crt/%.o:$(PORT_DIR)/crt/%.s
|
|
|
633b76 |
$(AS) -o $@ $< $(CFLAGS_ASM)
|
|
|
418a36 |
|
|
|
964b8d |
crt/%.o:$(PORT_DIR)/crt/%.S $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
|
|
|
418a36 |
|
|
|
964b8d |
crt/%.o:$(SOURCE_DIR)/crt/%.c $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
|
|
|
418a36 |
|
|
|
418a36 |
crt-objs: $(CRT_OBJS)
|
|
|
418a36 |
shared-lib:$(CRT_OBJS)
|
|
|
418a36 |
static-lib:$(CRT_OBJS)
|
|
|
418a36 |
|
|
|
418a36 |
clean-crt-objs:
|
|
|
418a36 |
rm -f $(CRT_OBJS)
|
|
|
418a36 |
|
|
|
418a36 |
clean: clean-crt-objs
|
|
|
418a36 |
|
|
|
418a36 |
.PHONY: crt-objs clean-crt-objs
|
|
|
418a36 |
|
|
|
418a36 |
|
|
|
418a36 |
# ldso objects
|
|
|
418a36 |
LDSO_OBJS += $(libc_ldso_files_c:%.c=%.lo)
|
|
|
418a36 |
LDSO_OBJS += $(libc_ldso_files_s:%.s=%.lo)
|
|
|
418a36 |
LDSO_OBJS += $(libc_ldso_files_S:%.S=%.lo)
|
|
|
418a36 |
|
|
|
418a36 |
$(LDSO_OBJS): headers.tag host.tag tree.tag
|
|
|
418a36 |
|
|
|
418a36 |
$(LDSO_OBJS): CFLAGS_SHARED += -DSHARED=
|
|
|
418a36 |
|
|
|
964b8d |
ldso/%.lo:$(PORT_DIR)/ldso/%.c $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
|
|
|
418a36 |
|
|
|
418a36 |
ldso/%.lo:$(PORT_DIR)/ldso/%.s
|
|
|
633b76 |
$(AS) -o $@ $< $(CFLAGS_ASM)
|
|
|
418a36 |
|
|
|
964b8d |
ldso/%.lo:$(PORT_DIR)/ldso/%.S $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
|
|
|
418a36 |
|
|
|
964b8d |
ldso/%.lo:$(SOURCE_DIR)/ldso/%.c $(HEADER_DEPS)
|
|
|
418a36 |
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
|
|
|
418a36 |
|
|
|
418a36 |
ldso-objs:$(LDSO_OBJS)
|
|
|
418a36 |
|
|
|
418a36 |
clean-ldso-objs:
|
|
|
418a36 |
rm -f $(LDSO_OBJS)
|
|
|
418a36 |
|
|
|
418a36 |
clean: clean-ldso-objs
|
|
|
418a36 |
|
|
|
418a36 |
.PHONY: ldso-objs clean-ldso-objs
|