Changes in uspace/Makefile.common [664af708:e8c5c11] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile.common
r664af708 re8c5c11 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 … … 90 112 LIBNET_PREFIX = $(LIB_PREFIX)/net 91 113 114 ifeq ($(STATIC_NEEDED),y) 115 STATIC_BUILD = y 116 else 117 ifeq ($(STATIC_ONLY),y) 118 STATIC_BUILD = y 119 else 120 ifeq ($(CONFIG_USE_SHARED_LIBS), y) 121 STATIC_BUILD = n 122 else 123 STATIC_BUILD = y 124 endif 125 endif 126 endif 127 128 ifeq ($(STATIC_BUILD), y) 92 129 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a 93 94 130 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld 131 else 132 BASE_LIBS = $(LIBC_PREFIX)/libc.so0 $(LIBSOFTINT_PREFIX)/libsofti.so0 133 LFLAGS = -Bdynamic 134 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld 135 endif 95 136 96 137 ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y) … … 102 143 .PHONY: all clean 103 144 104 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $( EXTRA_OUTPUT)145 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT) 105 146 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 106 147 107 148 clean: 108 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $( EXTRA_OUTPUT) $(EXTRA_CLEAN)149 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN) 109 150 find . -name '*.o' -follow -exec rm \{\} \; 151 find . -name '*.lo' -follow -exec rm \{\} \; 110 152 111 153 GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ … … 113 155 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \ 114 156 -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \ 115 - Werror-implicit-function-declaration -Wwrite-strings \157 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \ 116 158 -pipe -g -D__$(ENDIANESS)__ 117 159 … … 130 172 -pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__ 131 173 174 LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ 175 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive 176 132 177 ifeq ($(CONFIG_DEBUG),y) 133 178 GCC_CFLAGS += -Werror … … 175 220 176 221 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 222 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES))) 177 223 178 224 ifneq ($(BINARY),) … … 185 231 186 232 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS) 187 $(LD) - N$(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)233 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS) 188 234 ifeq ($(CONFIG_STRIP_BINARIES),y) 189 235 $(STRIP) $(BINARY) 190 236 endif 237 endif 238 239 ifneq ($(SLIBRARY),) 240 %.disasm: $(LOUTPUT) 241 ifeq ($(CONFIG_LINE_DEBUG),y) 242 $(OBJDUMP) -d -S $< > $@ 243 else 244 $(OBJDUMP) -d $< > $@ 245 endif 246 247 $(LOUTPUT): $(LARCHIVE) $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld 248 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld $(LIB_LFLAGS) $(LARCHIVE) -o $@ -Map $(LOUTPUT).map 249 250 $(LIBRARY).so: 251 ln -s $(SLIBRARY) $@ 252 253 $(LSONAME): 254 ln -s $(SLIBRARY) $@ 191 255 endif 192 256 … … 196 260 endif 197 261 262 ifneq ($(SLIBRARY),) 263 %.la: $(LOBJECTS) 264 $(AR) rc $@ $(LOBJECTS) 265 endif 266 198 267 %.o: %.S $(DEPEND) 199 268 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@ … … 210 279 %.o: %.c $(DEPEND) 211 280 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 281 ifeq ($(PRECHECK),y) 282 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) 283 endif 284 285 %.lo: %.S $(DEPEND) 286 $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@ 287 ifeq ($(PRECHECK),y) 288 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__ 289 endif 290 291 %.lo: %.s $(DEPEND) 292 $(AS) $(AFLAGS) -o $@ $< 293 ifeq ($(PRECHECK),y) 294 $(JOBFILE) $(JOB) $< $@ as asm 295 endif 296 297 %.lo: %.c $(DEPEND) 298 $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@ 212 299 ifeq ($(PRECHECK),y) 213 300 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) … … 223 310 $(OUTPUT): $(OBJECTS) 224 311 312 $(LARCHIVE): $(LOBJECTS)
Note:
See TracChangeset
for help on using the changeset viewer.