Changes in uspace/Makefile.common [664af708:0feaae4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile.common
r664af708 r0feaae4 40 40 # BINARY (/) binary output name (like appname) 41 41 # LIBRARY (/) library output name (like libname) 42 # 42 43 # EXTRA_OUTPUT additional output targets 43 44 # 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 44 55 # 45 56 # (x) required variables … … 73 84 endif 74 85 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 75 97 DEPEND = Makefile.depend 76 98 DEPEND_PREV = $(DEPEND).prev … … 86 108 LIBCLUI_PREFIX = $(LIB_PREFIX)/clui 87 109 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 88 118 LIBDRV_PREFIX = $(LIB_PREFIX)/drv 89 119 LIBPACKET_PREFIX = $(LIB_PREFIX)/packet 90 120 LIBNET_PREFIX = $(LIB_PREFIX)/net 91 121 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) 92 145 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a 93 94 146 LINKER_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 95 152 96 153 ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y) … … 102 159 .PHONY: all clean 103 160 104 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $( EXTRA_OUTPUT)161 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT) 105 162 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 106 163 107 164 clean: 108 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) 109 166 find . -name '*.o' -follow -exec rm \{\} \; 167 find . -name '*.lo' -follow -exec rm \{\} \; 110 168 111 169 GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ … … 113 171 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \ 114 172 -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \ 115 - Werror-implicit-function-declaration -Wwrite-strings \173 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \ 116 174 -pipe -g -D__$(ENDIANESS)__ 117 175 … … 130 188 -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__ 131 189 190 LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ 191 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive 192 132 193 ifeq ($(CONFIG_DEBUG),y) 133 194 GCC_CFLAGS += -Werror … … 175 236 176 237 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 238 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES))) 177 239 178 240 ifneq ($(BINARY),) … … 185 247 186 248 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS) 187 $(LD) - N$(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)249 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS) 188 250 ifeq ($(CONFIG_STRIP_BINARIES),y) 189 251 $(STRIP) $(BINARY) 190 252 endif 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) $@ 191 271 endif 192 272 … … 196 276 endif 197 277 278 ifneq ($(SLIBRARY),) 279 %.la: $(LOBJECTS) 280 $(AR) rc $@ $(LOBJECTS) 281 endif 282 198 283 %.o: %.S $(DEPEND) 199 284 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ … … 210 295 %.o: %.c $(DEPEND) 211 296 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 297 ifeq ($(PRECHECK),y) 298 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) 299 endif 300 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 $@ 212 315 ifeq ($(PRECHECK),y) 213 316 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) … … 223 326 $(OUTPUT): $(OBJECTS) 224 327 328 $(LARCHIVE): $(LOBJECTS)
Note:
See TracChangeset
for help on using the changeset viewer.