Changeset 5e6e50b in mainline for uspace/Makefile.common
- Timestamp:
- 2011-05-17T09:20:34Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2aaf804
- Parents:
- a29529b (diff), 3375bd4 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile.common
ra29529b r5e6e50b 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 … … 71 82 JOB = $(LIBRARY).job 72 83 OUTPUT = $(LIBRARY).a 84 endif 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 73 95 endif 74 96 … … 96 118 LIBNET_PREFIX = $(LIB_PREFIX)/net 97 119 120 ifeq ($(STATIC_NEEDED),y) 121 STATIC_BUILD = y 122 else 123 ifeq ($(STATIC_ONLY),y) 124 STATIC_BUILD = y 125 else 126 ifeq ($(CONFIG_USE_SHARED_LIBS), y) 127 STATIC_BUILD = n 128 else 129 STATIC_BUILD = y 130 endif 131 endif 132 endif 133 134 ifeq ($(STATIC_BUILD), y) 98 135 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a 99 100 136 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld 137 else 138 BASE_LIBS = $(LIBC_PREFIX)/libc.so0 $(LIBSOFTINT_PREFIX)/libsofti.so0 139 LFLAGS = -Bdynamic 140 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld 141 endif 101 142 102 143 ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y) … … 108 149 .PHONY: all clean 109 150 110 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $( EXTRA_OUTPUT)151 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT) 111 152 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 112 153 113 154 clean: 114 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $( EXTRA_OUTPUT) $(EXTRA_CLEAN)155 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN) 115 156 find . -name '*.o' -follow -exec rm \{\} \; 157 find . -name '*.lo' -follow -exec rm \{\} \; 116 158 117 159 GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ … … 119 161 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \ 120 162 -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \ 121 - Werror-implicit-function-declaration -Wwrite-strings \163 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \ 122 164 -pipe -g -D__$(ENDIANESS)__ 123 165 … … 136 178 -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__ 137 179 180 LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ 181 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive 182 138 183 ifeq ($(CONFIG_DEBUG),y) 139 184 GCC_CFLAGS += -Werror … … 181 226 182 227 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 228 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES))) 183 229 184 230 ifneq ($(BINARY),) … … 191 237 192 238 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS) 193 $(LD) - N$(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)239 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS) 194 240 ifeq ($(CONFIG_STRIP_BINARIES),y) 195 241 $(STRIP) $(BINARY) 196 242 endif 243 endif 244 245 ifneq ($(SLIBRARY),) 246 %.disasm: $(LOUTPUT) 247 ifeq ($(CONFIG_LINE_DEBUG),y) 248 $(OBJDUMP) -d -S $< > $@ 249 else 250 $(OBJDUMP) -d $< > $@ 251 endif 252 253 $(LOUTPUT): $(LARCHIVE) $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld 254 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld $(LIB_LFLAGS) $(LARCHIVE) -o $@ -Map $(LOUTPUT).map 255 256 $(LIBRARY).so: 257 ln -s $(SLIBRARY) $@ 258 259 $(LSONAME): 260 ln -s $(SLIBRARY) $@ 197 261 endif 198 262 … … 202 266 endif 203 267 268 ifneq ($(SLIBRARY),) 269 %.la: $(LOBJECTS) 270 $(AR) rc $@ $(LOBJECTS) 271 endif 272 204 273 %.o: %.S $(DEPEND) 205 274 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ … … 216 285 %.o: %.c $(DEPEND) 217 286 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 287 ifeq ($(PRECHECK),y) 288 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) 289 endif 290 291 %.lo: %.S $(DEPEND) 292 $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@ 293 ifeq ($(PRECHECK),y) 294 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__ 295 endif 296 297 %.lo: %.s $(DEPEND) 298 $(AS) $(AFLAGS) -o $@ $< 299 ifeq ($(PRECHECK),y) 300 $(JOBFILE) $(JOB) $< $@ as asm 301 endif 302 303 %.lo: %.c $(DEPEND) 304 $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@ 218 305 ifeq ($(PRECHECK),y) 219 306 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) … … 229 316 $(OUTPUT): $(OBJECTS) 230 317 318 $(LARCHIVE): $(LOBJECTS)
Note:
See TracChangeset
for help on using the changeset viewer.