Changeset 1affcdf3 in mainline for uspace/Makefile.common


Ignore:
Timestamp:
2011-06-10T19:33:41Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1878386
Parents:
13ecdac9 (diff), 79a141a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r13ecdac9 r1affcdf3  
    4040#   BINARY         (/) binary output name (like appname)
    4141#   LIBRARY        (/) library output name (like libname)
     42#
    4243#   EXTRA_OUTPUT       additional output targets
    4344#   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
    4455#
    4556# (x) required variables
     
    7384endif
    7485
     86ifeq ($(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
     95endif
     96
    7597DEPEND = Makefile.depend
    7698DEPEND_PREV = $(DEPEND).prev
     
    86108LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
    87109
     110LIBEXT2_PREFIX = $(LIB_PREFIX)/ext2
     111
     112LIBUSB_PREFIX = $(LIB_PREFIX)/usb
     113LIBUSBHOST_PREFIX = $(LIB_PREFIX)/usbhost
     114LIBUSBDEV_PREFIX = $(LIB_PREFIX)/usbdev
     115LIBUSBHID_PREFIX = $(LIB_PREFIX)/usbhid
     116LIBUSBVIRT_PREFIX = $(LIB_PREFIX)/usbvirt
     117
    88118LIBDRV_PREFIX = $(LIB_PREFIX)/drv
    89119LIBPACKET_PREFIX = $(LIB_PREFIX)/packet
     
    92122LIBMINIX_PREFIX = $(LIB_PREFIX)/minix
    93123
     124ifeq ($(STATIC_NEEDED),y)
     125        STATIC_BUILD = y
     126else
     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
     136endif
     137
     138# Build static whenever we use libusb because that library uses
     139# thread local variables
     140ifneq ($(findstring usb, $(LIBS)),)
     141        STATIC_BUILD = y
     142endif
     143
     144ifeq ($(STATIC_BUILD), y)
    94145BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a
    95 
    96146LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
     147else
     148BASE_LIBS = $(LIBC_PREFIX)/libc.so0 $(LIBSOFTINT_PREFIX)/libsofti.so0
     149LFLAGS = -Bdynamic
     150LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
     151endif
    97152
    98153ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
     
    104159.PHONY: all clean
    105160
    106 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(EXTRA_OUTPUT)
     161all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT)
    107162        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    108163
    109164clean:
    110         rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
     165        rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
    111166        find . -name '*.o' -follow -exec rm \{\} \;
     167        find . -name '*.lo' -follow -exec rm \{\} \;
    112168
    113169GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     
    115171        -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
    116172        -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
    117         -Werror-implicit-function-declaration -Wwrite-strings \
     173        -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
    118174        -pipe -g -D__$(ENDIANESS)__
    119175
     
    132188        -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
    133189
     190LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__
     191LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
     192
    134193ifeq ($(CONFIG_DEBUG),y)
    135194        GCC_CFLAGS += -Werror
     
    177236
    178237OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
     238LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))
    179239
    180240ifneq ($(BINARY),)
     
    193253endif
    194254
     255ifneq ($(SLIBRARY),)
     256%.disasm: $(LOUTPUT)
     257ifeq ($(CONFIG_LINE_DEBUG),y)
     258        $(OBJDUMP) -d -S $< > $@
     259else
     260        $(OBJDUMP) -d $< > $@
     261endif
     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) $@
     271endif
     272
    195273ifneq ($(LIBRARY),)
    196274%.a: $(OBJECTS)
     
    198276endif
    199277
     278ifneq ($(SLIBRARY),)
     279%.la: $(LOBJECTS)
     280        $(AR) rc $@ $(LOBJECTS)
     281endif
     282
    200283%.o: %.S $(DEPEND)
    201284        $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
     
    212295%.o: %.c $(DEPEND)
    213296        $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
     297ifeq ($(PRECHECK),y)
     298        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
     299endif
     300
     301%.lo: %.S $(DEPEND)
     302        $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@
     303ifeq ($(PRECHECK),y)
     304        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
     305endif
     306
     307%.lo: %.s $(DEPEND)
     308        $(AS) $(AFLAGS) -o $@ $<
     309ifeq ($(PRECHECK),y)
     310        $(JOBFILE) $(JOB) $< $@ as asm
     311endif
     312
     313%.lo: %.c $(DEPEND)
     314        $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@
    214315ifeq ($(PRECHECK),y)
    215316        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
     
    225326$(OUTPUT): $(OBJECTS)
    226327
     328$(LARCHIVE): $(LOBJECTS)
Note: See TracChangeset for help on using the changeset viewer.