Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    rafdcc60e r0e9b512  
    7373endif
    7474
     75ifneq ($(SLIBRARY),)
     76        LARCHIVE = $(LIBRARY).la
     77        LOUTPUT = $(SLIBRARY)
     78        EXTRA_OUTPUT += $(LOUTPUT).disasm
     79        EXTRA_CLEAN += $(LOUTPUT).map $(LOUTPUT).ldisasm \
     80            $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld
     81endif
     82
    7583DEPEND = Makefile.depend
    7684DEPEND_PREV = $(DEPEND).prev
     
    9098LIBNET_PREFIX = $(LIB_PREFIX)/net
    9199
     100ifeq ($(DYNAMIC_LINKING),y)
     101BASE_LIBS = $(LIBC_PREFIX)/libc.so.0 $(LIBSOFTINT_PREFIX)/libsoftint.a
     102LFLAGS = -Bdynamic
     103LINKER_SCRIPT ?= $(LIBC_PREFIX)/shared/arch/$(UARCH)/_link.ld
     104else
    92105BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a
    93 
    94106LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
     107endif
    95108
    96109ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
     
    102115.PHONY: all clean
    103116
    104 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(EXTRA_OUTPUT)
     117all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT)
    105118        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    106119
    107120clean:
    108         rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
     121        rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
    109122        find . -name '*.o' -follow -exec rm \{\} \;
     123        find . -name '*.lo' -follow -exec rm \{\} \;
    110124
    111125GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     
    130144        -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
    131145
     146LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__
     147LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
     148
    132149ifeq ($(CONFIG_DEBUG),y)
    133150        GCC_CFLAGS += -Werror
     
    175192
    176193OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
     194LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))
    177195
    178196ifneq ($(BINARY),)
     
    185203
    186204$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS)
    187         $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
     205        $(LD) -N $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
    188206ifeq ($(CONFIG_STRIP_BINARIES),y)
    189207        $(STRIP) $(BINARY)
    190208endif
    191209endif
     210
     211ifneq ($(SLIBRARY),)
     212%.disasm: $(LOUTPUT)
     213ifeq ($(CONFIG_LINE_DEBUG),y)
     214        $(OBJDUMP) -d -S $< > $@
     215else
     216        $(OBJDUMP) -d $< > $@
     217endif
     218
     219$(LOUTPUT): $(LARCHIVE) $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld
     220        $(LD) -T $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld $(LIB_LFLAGS) $(LARCHIVE) -o $@ -Map $(LOUTPUT).map
     221endif
     222
     223$(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld: $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld.in
     224        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
     225
     226$(LIBC_PREFIX)/shared/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/shared/arch/$(UARCH)/_link.ld.in
     227        $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
    192228
    193229ifneq ($(LIBRARY),)
     
    196232endif
    197233
     234ifneq ($(SLIBRARY),)
     235%.la: $(LOBJECTS)
     236        $(AR) rc $@ $(LOBJECTS)
     237endif
     238
    198239%.o: %.S $(DEPEND)
    199240        $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
     
    210251%.o: %.c $(DEPEND)
    211252        $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
     253ifeq ($(PRECHECK),y)
     254        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
     255endif
     256
     257%.lo: %.S $(DEPEND)
     258        $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@
     259ifeq ($(PRECHECK),y)
     260        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
     261endif
     262
     263%.lo: %.s $(DEPEND)
     264        $(AS) $(AFLAGS) -o $@ $<
     265ifeq ($(PRECHECK),y)
     266        $(JOBFILE) $(JOB) $< $@ as asm
     267endif
     268
     269%.lo: %.c $(DEPEND)
     270        $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@
    212271ifeq ($(PRECHECK),y)
    213272        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
     
    223282$(OUTPUT): $(OBJECTS)
    224283
     284$(LARCHIVE): $(LOBJECTS)
Note: See TracChangeset for help on using the changeset viewer.