Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r0feaae4 r664af708  
    4040#   BINARY         (/) binary output name (like appname)
    4141#   LIBRARY        (/) library output name (like libname)
    42 #
    4342#   EXTRA_OUTPUT       additional output targets
    4443#   EXTRA_CLEAN        additional cleanup targets
    45 #
    46 # Optionally, for a binary:
    47 #   STATIC_NEEDED      set to 'y' for init binaries, will build statically
    48 #                      linked version
    49 #   STATIC_ONLY        set to 'y' if binary cannot be linked dynamically
    50 #                      (e.g. uses thread-local variables)
    51 #
    52 # Optionally, for a libary:
    53 #   SLIBRARY           Name with full version, e.g. libfoo.so.0.0
    54 #   LSONAME            Soname / name with short version, e.g. libfoo.so.0
    5544#
    5645# (x) required variables
     
    8473endif
    8574
    86 ifeq ($(CONFIG_BUILD_SHARED_LIBS), y)
    87         ifneq ($(SLIBRARY),)
    88                 LARCHIVE = $(LIBRARY).la
    89                 LOUTPUT = $(SLIBRARY)
    90                 EXTRA_OUTPUT += $(LOUTPUT).disasm $(LIBRARY).so $(LSONAME)
    91                 EXTRA_CLEAN += $(LOUTPUT).map $(LOUTPUT).ldisasm \
    92                     $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld \
    93                     $(LIBRARY).so $(LSONAME)
    94         endif
    95 endif
    96 
    9775DEPEND = Makefile.depend
    9876DEPEND_PREV = $(DEPEND).prev
     
    10886LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
    10987
    110 LIBEXT2_PREFIX = $(LIB_PREFIX)/ext2
    111 
    112 LIBUSB_PREFIX = $(LIB_PREFIX)/usb
    113 LIBUSBHOST_PREFIX = $(LIB_PREFIX)/usbhost
    114 LIBUSBDEV_PREFIX = $(LIB_PREFIX)/usbdev
    115 LIBUSBHID_PREFIX = $(LIB_PREFIX)/usbhid
    116 LIBUSBVIRT_PREFIX = $(LIB_PREFIX)/usbvirt
    117 
    11888LIBDRV_PREFIX = $(LIB_PREFIX)/drv
    11989LIBPACKET_PREFIX = $(LIB_PREFIX)/packet
    12090LIBNET_PREFIX = $(LIB_PREFIX)/net
    12191
    122 LIBSCSI_PREFIX = $(LIB_PREFIX)/scsi
    123 
    124 ifeq ($(STATIC_NEEDED),y)
    125         STATIC_BUILD = y
    126 else
    127         ifeq ($(STATIC_ONLY),y)
    128                 STATIC_BUILD = y
    129         else
    130                 ifeq ($(CONFIG_USE_SHARED_LIBS), y)
    131                         STATIC_BUILD = n
    132                 else
    133                         STATIC_BUILD = y
    134                 endif
    135         endif
    136 endif
    137 
    138 # Build static whenever we use libusb because that library uses
    139 # thread local variables
    140 ifneq ($(findstring usb, $(LIBS)),)
    141         STATIC_BUILD = y
    142 endif
    143 
    144 ifeq ($(STATIC_BUILD), y)
    14592BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a
     93
    14694LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
    147 else
    148 BASE_LIBS = $(LIBC_PREFIX)/libc.so0 $(LIBSOFTINT_PREFIX)/libsofti.so0
    149 LFLAGS = -Bdynamic
    150 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
    151 endif
    15295
    15396ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
     
    159102.PHONY: all clean
    160103
    161 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT)
     104all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(EXTRA_OUTPUT)
    162105        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    163106
    164107clean:
    165         rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
     108        rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
    166109        find . -name '*.o' -follow -exec rm \{\} \;
    167         find . -name '*.lo' -follow -exec rm \{\} \;
    168110
    169111GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     
    171113        -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
    172114        -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
    173         -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
     115        -Werror-implicit-function-declaration -Wwrite-strings \
    174116        -pipe -g -D__$(ENDIANESS)__
    175117
     
    188130        -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
    189131
    190 LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__
    191 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
    192 
    193132ifeq ($(CONFIG_DEBUG),y)
    194133        GCC_CFLAGS += -Werror
     
    236175
    237176OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
    238 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))
    239177
    240178ifneq ($(BINARY),)
     
    247185
    248186$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS)
    249         $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
     187        $(LD) -N $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
    250188ifeq ($(CONFIG_STRIP_BINARIES),y)
    251189        $(STRIP) $(BINARY)
    252190endif
    253 endif
    254 
    255 ifneq ($(SLIBRARY),)
    256 %.disasm: $(LOUTPUT)
    257 ifeq ($(CONFIG_LINE_DEBUG),y)
    258         $(OBJDUMP) -d -S $< > $@
    259 else
    260         $(OBJDUMP) -d $< > $@
    261 endif
    262 
    263 $(LOUTPUT): $(LARCHIVE) $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld
    264         $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld $(LIB_LFLAGS) $(LARCHIVE) -o $@ -Map $(LOUTPUT).map
    265 
    266 $(LIBRARY).so:
    267         ln -s $(SLIBRARY) $@
    268 
    269 $(LSONAME):
    270         ln -s $(SLIBRARY) $@
    271191endif
    272192
     
    274194%.a: $(OBJECTS)
    275195        $(AR) rc $@ $(OBJECTS)
    276 endif
    277 
    278 ifneq ($(SLIBRARY),)
    279 %.la: $(LOBJECTS)
    280         $(AR) rc $@ $(LOBJECTS)
    281196endif
    282197
     
    299214endif
    300215
    301 %.lo: %.S $(DEPEND)
    302         $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@
    303 ifeq ($(PRECHECK),y)
    304         $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
    305 endif
    306 
    307 %.lo: %.s $(DEPEND)
    308         $(AS) $(AFLAGS) -o $@ $<
    309 ifeq ($(PRECHECK),y)
    310         $(JOBFILE) $(JOB) $< $@ as asm
    311 endif
    312 
    313 %.lo: %.c $(DEPEND)
    314         $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@
    315 ifeq ($(PRECHECK),y)
    316         $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
    317 endif
    318 
    319216$(DEPEND): $(PRE_DEPEND)
    320217        makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
     
    326223$(OUTPUT): $(OBJECTS)
    327224
    328 $(LARCHIVE): $(LOBJECTS)
Note: See TracChangeset for help on using the changeset viewer.