Changes in uspace/Makefile.common [9c14309:e6ae77a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile.common
r9c14309 re6ae77a 44 44 # EXTRA_CLEAN additional cleanup targets 45 45 # 46 # MATH set to 'y' to use the math library47 # POSIX_COMPAT set to 'y' to use POSIX compatibility layer48 #49 46 # Optionally, for a binary: 50 47 # STATIC_NEEDED set to 'y' for init binaries, will build statically … … 53 50 # (e.g. uses thread-local variables) 54 51 # 55 # Optionally, for a lib ary:56 # S LIBRARY Name with full version, e.g. libfoo.so.0.057 # LSONAME Soname / name with short version, e.g. libfoo.so.052 # Optionally, for a library: 53 # SOVERSION shared library version (major.minor), 54 # if missing, no shared library is built 58 55 # 59 56 # (x) required variables … … 75 72 -include $(CONFIG_MAKEFILE) 76 73 74 OUTPUTS = $(EXTRA_OUTPUT) 75 77 76 ifneq ($(BINARY),) 78 77 JOB = $(BINARY).job 79 OUTPUT = $(BINARY)80 78 TEST_BINARY = test-$(BINARY) 81 EXTRA_OUTPUT +=$(BINARY).disasm79 OUTPUTS += $(BINARY) $(BINARY).disasm 82 80 EXTRA_CLEAN += $(BINARY).map 83 81 endif … … 85 83 ifneq ($(LIBRARY),) 86 84 JOB = $(LIBRARY).job 87 OUTPUT = $(LIBRARY).a88 85 TEST_BINARY = test-$(LIBRARY) 86 OUTPUTS += $(LIBRARY).a 89 87 endif 90 88 91 89 ifeq ($(CONFIG_BUILD_SHARED_LIBS),y) 92 ifneq ($(SLIBRARY),) 93 LARCHIVE = $(LIBRARY).la 94 LOUTPUT = $(SLIBRARY) 95 EXTRA_OUTPUT += $(LOUTPUT).disasm $(LIBRARY).so $(LSONAME) 96 EXTRA_CLEAN += $(LOUTPUT).map $(LOUTPUT).ldisasm \ 97 $(LIBC_PREFIX)/shared/arch/$(UARCH)/_lib.ld \ 98 $(LIBRARY).so $(LSONAME) 90 ifneq ($(SOVERSION),) 91 SLIBRARY = $(LIBRARY).so.$(SOVERSION) 92 LSONAME = $(LIBRARY).so.$(basename $(SOVERSION)) 93 OUTPUTS += $(SLIBRARY) $(SLIBRARY).disasm $(LSONAME) 94 EXTRA_CLEAN += $(LIBRARY).la $(SLIBRARY).map 99 95 endif 100 96 endif … … 116 112 117 113 LIBPOSIX_PREFIX = $(LIB_PREFIX)/posix 118 119 LIBCRYPTO_PREFIX = $(LIB_PREFIX)/crypto120 LIBBLOCK_PREFIX = $(LIB_PREFIX)/block121 LIBFDISK_PREFIX = $(LIB_PREFIX)/fdisk122 LIBLABEL_PREFIX = $(LIB_PREFIX)/label123 LIBFS_PREFIX = $(LIB_PREFIX)/fs124 LIBCLUI_PREFIX = $(LIB_PREFIX)/clui125 LIBFMTUTIL_PREFIX = $(LIB_PREFIX)/fmtutil126 127 LIBGRAPH_PREFIX = $(LIB_PREFIX)/graph128 LIBSOFTREND_PREFIX = $(LIB_PREFIX)/softrend129 LIBDRAW_PREFIX = $(LIB_PREFIX)/draw130 LIBGUI_PREFIX = $(LIB_PREFIX)/gui131 132 LIBEXT4_PREFIX = $(LIB_PREFIX)/ext4133 134 LIBUSB_PREFIX = $(LIB_PREFIX)/usb135 LIBUSBHOST_PREFIX = $(LIB_PREFIX)/usbhost136 LIBUSBDEV_PREFIX = $(LIB_PREFIX)/usbdev137 LIBUSBHID_PREFIX = $(LIB_PREFIX)/usbhid138 LIBUSBVIRT_PREFIX = $(LIB_PREFIX)/usbvirt139 140 LIBDRV_PREFIX = $(LIB_PREFIX)/drv141 LIBHOUND_PREFIX = $(LIB_PREFIX)/hound142 LIBPCM_PREFIX = $(LIB_PREFIX)/pcm143 LIBNIC_PREFIX = $(LIB_PREFIX)/nic144 LIBIEEE80211_PREFIX = $(LIB_PREFIX)/ieee80211145 LIBMINIX_PREFIX = $(LIB_PREFIX)/minix146 LIBCOMPRESS_PREFIX = $(LIB_PREFIX)/compress147 114 LIBDLTEST_PREFIX = $(LIB_PREFIX)/dltest 148 115 149 LIBSCSI_PREFIX = $(LIB_PREFIX)/scsi 150 LIBTRACKMOD_PREFIX = $(LIB_PREFIX)/trackmod 151 152 LIBBITHENGE_PREFIX = $(LIB_PREFIX)/bithenge 153 154 LIBHTTP_PREFIX = $(LIB_PREFIX)/http 155 LIBURI_PREFIX = $(LIB_PREFIX)/uri 156 157 LIBNETTL_PREFIX = $(LIB_PREFIX)/nettl 158 159 AFLAGS = 160 LFLAGS = --fatal-warnings 161 162 # FIXME: This condition is a workaround for issues #692 and #693. 163 ifneq ($(KARCH),ia64) 164 ifneq ($(KARCH),mips32) 165 AFLAGS += --fatal-warnings 166 endif 167 endif 116 AFLAGS = --fatal-warnings 117 LFLAGS = --fatal-warnings --warn-common 168 118 169 119 ifeq ($(STATIC_NEEDED),y) … … 182 132 183 133 ifeq ($(STATIC_BUILD),y) 184 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a 185 ifeq ($(MATH),y) 186 BASE_LIBS += $(LIBMATH_PREFIX)/libmath.a 187 endif 188 else 189 BASE_LIBS = $(LIBC_PREFIX)/libc.so.0 $(LIBSOFTINT_PREFIX)/libsoftint.so.0 134 BASE_LIBS = $(LIBC_PREFIX)/libc.a 135 else 136 BASE_LIBS = $(LIBC_PREFIX)/libc.so.0 190 137 LINK_DYNAMIC = y 191 ifeq ($(MATH),y) 192 BASE_LIBS += $(LIBMATH_PREFIX)/libmath.so.0 193 endif 194 endif 138 endif 139 140 BASE_LIBS += $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a $(LIBSOFTINT_PREFIX)/libsoftint.a 195 141 196 142 ifeq ($(LINK_DYNAMIC),y) … … 201 147 endif 202 148 203 ifeq ($(MATH),y) 204 INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS) $(LIBMATH_INCLUDES_FLAGS) 205 else 206 INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS) 149 LIB_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld 150 151 INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS) 152 153 ifneq ($(LIBRARY),) 154 INCLUDES_FLAGS += -Iinclude -I. 155 endif 156 157 INCLUDES_FLAGS += $(foreach lib,$(LIBS), -I$(LIB_PREFIX)/$(lib) -I$(LIB_PREFIX)/$(lib)/include) 158 159 # TODO: get rid of this special case 160 ifneq ($(filter math, $(LIBS)),) 161 INCLUDES_FLAGS += $(LIBMATH_INCLUDES_FLAGS) 207 162 endif 208 163 209 164 # PCUT-based unit tests 210 165 ifneq ($(TEST_SOURCES),) 211 TEST_OUTPUT = $(TEST_BINARY) 212 TEST_DISASM = $(TEST_BINARY).disasm 166 TEST_OUTPUTS = $(TEST_BINARY) $(TEST_BINARY).disasm 213 167 TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__ 214 TEST_ OUTPUT_LIBS = $(LIB_PREFIX)/pcut/libpcut.a215 EXTRA_CLEAN += $(TEST_OUTPUT ) $(TEST_OUTPUT).map $(TEST_DISASM)168 TEST_BINARY_LIBS = $(LIB_PREFIX)/pcut/libpcut.a 169 EXTRA_CLEAN += $(TEST_OUTPUTS) $(TEST_BINARY).map 216 170 ifneq ($(LIBRARY),) 217 TEST_OUTPUT_LIBS += $(OUTPUT) 218 endif 219 TEST_OUTPUT_LIBS += $(TEST_LIBS) 220 endif 221 222 .PHONY: all clean depend 223 224 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT) 225 226 all-test: $(TEST_OUTPUT) $(TEST_DISASM) 227 228 clean: 229 rm -f $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN) 230 find . -name '*.o' -follow -exec rm \{\} \; 231 find . -name '*.lo' -follow -exec rm \{\} \; 232 find . -name '*.d' -follow -exec rm \{\} \; 171 TEST_BINARY_LIBS += $(LIBRARY).a 172 endif 173 TEST_BINARY_LIBS += $(TEST_LIBS) 174 endif 233 175 234 176 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ 235 177 -ffreestanding -fno-builtin -nostdlib -nostdinc -fexec-charset=UTF-8 \ 236 -finput-charset=UTF-8 -D__$(ENDIANESS)__ 178 -finput-charset=UTF-8 -D__$(ENDIANESS)__ -fno-common \ 179 -fdebug-prefix-map=$(realpath $(ROOT_PATH))=. 237 180 238 181 GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \ … … 257 200 endif 258 201 259 # Prepare for POSIX before including platform specific stuff260 ifeq ($(POSIX_COMPAT),y)261 CFLAGS += -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/262 BASE_LIBS = $(LIBPOSIX_PREFIX)/libposixaslibc.a $(LIBPOSIX_PREFIX)/libc4posix.a $(LIBSOFTINT_PREFIX)/libsoftint.a263 endif264 265 202 ## Setup platform configuration 266 203 # … … 271 208 # 272 209 273 JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py 210 ifeq ($(PRECHECK),y) 211 JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py 212 # XXX: Do not change the order of arguments. 213 CC_JOB = $(JOBFILE) $(JOB) $(CC) $< -o $@ 214 else 215 CC_JOB = $(CC) $< -o $@ 216 endif 274 217 275 218 ifeq ($(COMPILER),clang) … … 279 222 endif 280 223 224 ifeq ($(CONFIG_STRIP_BINARIES),y) 225 LFLAGS += --strip-all 226 endif 227 281 228 LIB_CFLAGS = $(CFLAGS) -fPIC 282 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive229 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) 283 230 284 231 AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS)) … … 290 237 DEPENDS := $(addsuffix .d,$(basename $(SOURCES))) $(addsuffix .test.d,$(basename $(TEST_SOURCES))) 291 238 292 -include $(DEPENDS) 293 294 ifneq ($(BINARY),) 295 $(BINARY).disasm: $(BINARY) 239 LIBTAGS := $(foreach lib,$(LIBS), $(USPACE_PREFIX)/lib/$(lib)/tag) 240 LIBARGS := $(addprefix -L$(USPACE_PREFIX)/lib/, $(LIBS)) $(addprefix -l, $(LIBS)) 241 242 .PHONY: all all-test clean fasterclean depend 243 244 all: tag $(OUTPUTS) 245 246 all-test: $(TEST_OUTPUTS) 247 248 clean: 249 rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk 250 find . -name '*.o' -follow -exec rm \{\} \; 251 find . -name '*.lo' -follow -exec rm \{\} \; 252 find . -name '*.d' -follow -exec rm \{\} \; 253 254 fasterclean: 255 rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk 256 257 depend: $(PRE_DEPEND) 258 259 # "Tag" files are used to force relink of binaries when dependencies get rebuilt, 260 # regardless of whether the dependency was linked statically or dynamically, 261 # or which version of a dynamic library was used. Prerequisites for this file 262 # are defined further down. 263 tag: 264 touch tag 265 266 # Generate inter-module make dependencies. 267 # This is needed to ensure correct build order of libraries and code depending on them. 268 deps.mk: Makefile 269 echo > $@.new 270 for lib in $(LIBS); do \ 271 echo "$(SELF_TARGET): lib/$$lib.build" >> $@.new; \ 272 done 273 mv -f $@.new $@ 274 275 %.disasm: % 296 276 ifeq ($(CONFIG_LINE_DEBUG),y) 297 277 $(OBJDUMP) -d -S $< > $@ … … 300 280 endif 301 281 302 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS) 303 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS) 304 ifeq ($(CONFIG_STRIP_BINARIES),y) 305 $(STRIP) $(BINARY) 306 endif 282 ifneq ($(BINARY),) 283 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBTAGS) $(BASE_LIBS) 284 $(LD) $(LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(OBJECTS) $(LIBARGS) $(BASE_LIBS) 285 endif 286 287 ifneq ($(TEST_BINARY),) 288 $(TEST_BINARY): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBTAGS) $(BASE_LIBS) 289 $(LD) $(LFLAGS) -T $(LINKER_SCRIPT) -Map $@.map -o $@ $(TEST_OBJECTS) $(TEST_BINARY_LIBS) $(LIBARGS) $(BASE_LIBS) 290 endif 291 292 ifneq ($(LIBRARY),) 293 tag: $(LIBRARY).a 294 295 $(LIBRARY).a: $(OBJECTS) 296 $(AR) rc $@ $(OBJECTS) 307 297 endif 308 298 309 299 ifneq ($(SLIBRARY),) 310 $(LOUTPUT).disasm: $(LOUTPUT) 311 ifeq ($(CONFIG_LINE_DEBUG),y) 312 $(OBJDUMP) -d -S $< > $@ 313 else 314 $(OBJDUMP) -d $< > $@ 315 endif 316 317 $(LOUTPUT): $(LARCHIVE) $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld 318 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld $(LIB_LFLAGS) $(LARCHIVE) -o $@ -Map $(LOUTPUT).map 319 320 $(LIBRARY).so: 321 ln -s $(SLIBRARY) $@ 300 tag: $(SLIBRARY) 301 302 $(LIBRARY).la: $(LOBJECTS) 303 $(AR) rc $@ $(LOBJECTS) 304 305 $(SLIBRARY): $(LIB_LINKER_SCRIPT) $(LIBRARY).la 306 $(LD) $(LIB_LFLAGS) -T $(LIB_LINKER_SCRIPT) -Map $@.map -o $@ --whole-archive $(LIBRARY).la --no-whole-archive 322 307 323 308 $(LSONAME): … … 325 310 endif 326 311 327 ifneq ($(LIBRARY),)328 $(LIBRARY).a: $(OBJECTS)329 $(AR) rc $@ $(OBJECTS)330 endif331 332 ifneq ($(LARCHIVE),)333 $(LARCHIVE): $(LOBJECTS)334 $(AR) rc $@ $(LOBJECTS)335 endif336 337 ifneq ($(TEST_OUTPUT),)338 $(TEST_OUTPUT): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS)339 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(TEST_OUTPUT).map -o $@ $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS) $(LIBS) $(BASE_LIBS)340 ifeq ($(CONFIG_STRIP_BINARIES),y)341 $(STRIP) $(TEST_OUTPUT)342 endif343 $(TEST_BINARY).disasm: $(TEST_BINARY)344 ifeq ($(CONFIG_LINE_DEBUG),y)345 $(OBJDUMP) -d -S $< > $@346 else347 $(OBJDUMP) -d $< > $@348 endif349 endif350 351 312 %.o: %.S | depend 352 $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@ 353 ifeq ($(PRECHECK),y) 354 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ 355 endif 313 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ 356 314 357 315 %.o: %.s | depend 358 $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@ 359 ifeq ($(PRECHECK),y) 360 $(JOBFILE) $(JOB) $< $@ as asm 361 endif 316 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ 362 317 363 318 %.o: %.c | depend 364 $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ 365 ifeq ($(PRECHECK),y) 366 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) 367 endif 319 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) 368 320 369 321 %.test.o: %.c | depend 370 $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -c $< -o $@ 371 ifeq ($(PRECHECK),y) 372 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) 373 endif 322 $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) 374 323 375 324 %.lo: %.S | depend 376 $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@ 377 ifeq ($(PRECHECK),y) 378 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ 379 endif 325 $(CC_JOB) -c -MD -MP $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ 380 326 381 327 %.lo: %.s | depend 382 $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@ 383 ifeq ($(PRECHECK),y) 384 $(JOBFILE) $(JOB) $< $@ as asm 385 endif 328 $(CC_JOB) -c -MD -MP $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ 386 329 387 330 %.lo: %.c | depend 388 $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ 389 ifeq ($(PRECHECK),y) 390 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) 391 endif 392 393 depend: $(PRE_DEPEND) 394 395 ## 396 # This explicit dependecy of the output binary on the object files seems to be 397 # necessary to prevent parallel build failures (GNU make bug #26893 ???). 398 $(OUTPUT): $(OBJECTS) 399 400 $(LARCHIVE): $(LOBJECTS) 331 $(CC_JOB) -c -MD -MP $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) 332 333 -include $(DEPENDS) 334
Note:
See TracChangeset
for help on using the changeset viewer.