Blame project/extras.mk

79e62f
./src/internal/version.o:	build/version.h
79e62f
./src/internal/version.lo:	build/version.h
bfd503
bfd503
# libc.so
bfd503
SHARED_OBJS      += $(LDSO_OBJS)
0563c2
SHARED_LIB_DEPS  += $(LIBC_DEPS)
bfd503
bfd503
LDFLAGS_COMMON   += -nostdlib
bfd503
LDFLAGS_COMMON   += -Wl,-Bsymbolic-functions
bfd503
LDFLAGS_COMMON   += -Wl,--sort-common
bfd503
LDFLAGS_COMMON   += -Wl,--gc-sections
bfd503
LDFLAGS_COMMON   += -Wl,--no-undefined
bfd503
LDFLAGS_COMMON   += -Wl,--exclude-libs=ALL
bfd503
bfd503
LDFLAGS_COMMON   += -Wl,-e              -Wl,_dlstart
bfd503
LDFLAGS_COMMON   += -Wl,--sort-section  -Wl,alignment
bfd503
9a3eef
ifeq ($(CC_BINFMT),ELF)
9a3eef
LDFLAGS_COMMON   += -Wl,--hash-style    -Wl,both
9a3eef
endif
9a3eef
d01251
# common cflags
d01251
CFLAGS_COMMON    += -fdata-sections
d01251
CFLAGS_COMMON    += -ffunction-sections
d01251
CFLAGS_COMMON    += -fno-unwind-tables
d01251
CFLAGS_COMMON    += -frounding-math
d01251
CFLAGS_COMMON    += -fexcess-precision=standard
e22b08
633b76
# assembler cflags
633b76
ifeq ($(CC_BINFMT),ELF)
633b76
CFLAGS_ASM       += -Wa,--noexecstack
633b76
CFLAGS_CONFIG    += $(CFLAGS_ASM)
633b76
endif
633b76
e22b08
# memory modules
e22b08
libc_mem_modules  = \
e22b08
	./src/string/memcpy.c \
e22b08
	./src/string/memmove.c \
e22b08
	./src/string/memcmp.c   \
e22b08
	./src/string/memset.c
e22b08
e22b08
libc_mem_objs     = $(libc_mem_modules:%.c=%.o)
e22b08
libc_mem_lobjs    = $(libc_mem_modules:%.c=%.lo)
e22b08
e22b08
$(libc_mem_objs):   CFLAGS_CONFIG += -fno-tree-loop-distribute-patterns
e22b08
$(libc_mem_lobjs):  CFLAGS_CONFIG += -fno-tree-loop-distribute-patterns
3ca8cd
3ca8cd
# target libdir
3ca8cd
$(DESTDIR)$(LIBDIR):
3ca8cd
	mkdir -p $@
3ca8cd
3ca8cd
# empty libs
3ca8cd
LIBC_EMPTY_LIBS_NAMES    = m rt dl crypt util pthread xnet resolv
3ca8cd
LIBC_EMPTY_LIBS          = $(LIBC_EMPTY_LIBS_NAMES:%=lib/lib%.a)
3ca8cd
LIBC_EMPTY_LIBS_TARGET   = $(LIBC_EMPTY_LIBS_NAMES:%=$(DESTDIR)$(LIBDIR)/lib%.a)
3ca8cd
3ca8cd
shared-lib:                $(LIBC_EMPTY_LIBS)
3ca8cd
static-lib:                $(LIBC_EMPTY_LIBS)
3ca8cd
3ca8cd
$(DESTDIR)$(LIBDIR)/%.a: lib/%.a $(DESTDIR)$(LIBDIR)
3ca8cd
	cp $< $@.tmp
3ca8cd
	chmod 0644 $@.tmp
3ca8cd
	mv $@.tmp $@
3ca8cd
3ca8cd
install-shared:	$(LIBC_EMPTY_LIBS_TARGET)
3ca8cd
install-static:	$(LIBC_EMPTY_LIBS_TARGET)
b3c063
b3c063
# crt objects
b3c063
CRT_OBJS_REFS   = $(subst $(ARCH)/,,$(CRT_OBJS))
b3c063
CRT_OBJS_TARGET = $(subst ./crt/,$(DESTDIR)$(LIBDIR)/,$(CRT_OBJS_REFS))
b3c063
b3c063
$(DESTDIR)$(LIBDIR)/%.o: crt/$(ARCH)/%.o $(DESTDIR)$(LIBDIR)
b3c063
	cp $< $@.tmp
b3c063
	chmod 0644 $@.tmp
b3c063
	mv $@.tmp $@
b3c063
b3c063
$(DESTDIR)$(LIBDIR)/%.o: crt/%.o $(DESTDIR)$(LIBDIR)
b3c063
	cp $< $@.tmp
b3c063
	chmod 0644 $@.tmp
b3c063
	mv $@.tmp $@
b3c063
b3c063
install-shared:	$(CRT_OBJS_TARGET)
b3c063
install-static:	$(CRT_OBJS_TARGET)