Changes in uspace/Makefile.common [4fb794c:58563585] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile.common
r4fb794c r58563585 44 44 # EXTRA_CLEAN additional cleanup targets 45 45 # 46 # MATH set to 'y' to use the math library 46 47 # POSIX_COMPAT set to 'y' to use POSIX compatibility layer 47 48 # … … 77 78 JOB = $(BINARY).job 78 79 OUTPUT = $(BINARY) 80 TEST_BINARY = test-$(BINARY) 79 81 EXTRA_OUTPUT += $(BINARY).disasm 80 82 EXTRA_CLEAN += $(BINARY).map … … 84 86 JOB = $(LIBRARY).job 85 87 OUTPUT = $(LIBRARY).a 86 endif 87 88 ifeq ($(CONFIG_BUILD_SHARED_LIBS), y) 88 TEST_BINARY = test-$(LIBRARY) 89 endif 90 91 ifeq ($(CONFIG_BUILD_SHARED_LIBS),y) 89 92 ifneq ($(SLIBRARY),) 90 93 LARCHIVE = $(LIBRARY).la … … 110 113 LIBSOFTINT_PREFIX = $(LIB_PREFIX)/softint 111 114 115 LIBMATH_PREFIX = $(LIB_PREFIX)/math 116 LIBMATH_INCLUDES_FLAGS = \ 117 -I$(LIBMATH_PREFIX)/include \ 118 -I$(LIBMATH_PREFIX)/arch/$(UARCH)/include 119 112 120 LIBPOSIX_PREFIX = $(LIB_PREFIX)/posix 113 121 122 LIBCRYPTO_PREFIX = $(LIB_PREFIX)/crypto 114 123 LIBBLOCK_PREFIX = $(LIB_PREFIX)/block 124 LIBFDISK_PREFIX = $(LIB_PREFIX)/fdisk 125 LIBLABEL_PREFIX = $(LIB_PREFIX)/label 115 126 LIBFS_PREFIX = $(LIB_PREFIX)/fs 116 127 LIBCLUI_PREFIX = $(LIB_PREFIX)/clui … … 131 142 132 143 LIBDRV_PREFIX = $(LIB_PREFIX)/drv 133 LIBNET_PREFIX = $(LIB_PREFIX)/net 144 LIBHOUND_PREFIX = $(LIB_PREFIX)/hound 145 LIBPCM_PREFIX = $(LIB_PREFIX)/pcm 134 146 LIBNIC_PREFIX = $(LIB_PREFIX)/nic 147 LIBIEEE80211_PREFIX = $(LIB_PREFIX)/ieee80211 135 148 LIBMINIX_PREFIX = $(LIB_PREFIX)/minix 149 LIBCOMPRESS_PREFIX = $(LIB_PREFIX)/compress 150 LIBDLTEST_PREFIX = $(LIB_PREFIX)/dltest 136 151 137 152 LIBSCSI_PREFIX = $(LIB_PREFIX)/scsi 153 LIBTRACKMOD_PREFIX = $(LIB_PREFIX)/trackmod 138 154 139 155 LIBBITHENGE_PREFIX = $(LIB_PREFIX)/bithenge 156 157 LIBHTTP_PREFIX = $(LIB_PREFIX)/http 158 LIBURI_PREFIX = $(LIB_PREFIX)/uri 159 160 LIBNETTL_PREFIX = $(LIB_PREFIX)/nettl 161 162 AFLAGS = --fatal-warnings 163 LFLAGS = --fatal-warnings 140 164 141 165 ifeq ($(STATIC_NEEDED),y) … … 145 169 STATIC_BUILD = y 146 170 else 147 ifeq ($(CONFIG_USE_SHARED_LIBS), 171 ifeq ($(CONFIG_USE_SHARED_LIBS),y) 148 172 STATIC_BUILD = n 149 173 else … … 153 177 endif 154 178 155 # Build static whenever we use libusb because that library uses156 # thread local variables157 ifneq ($(findstring usb, $(LIBS)),)158 STATIC_BUILD = y159 endif160 161 179 ifeq ($(STATIC_BUILD),y) 162 180 BASE_LIBS = $(LIBC_PREFIX)/libc.a $(LIBSOFTINT_PREFIX)/libsoftint.a 181 ifeq ($(MATH),y) 182 BASE_LIBS += $(LIBMATH_PREFIX)/libmath.a 183 endif 184 else 185 BASE_LIBS = $(LIBC_PREFIX)/libc.so.0 $(LIBSOFTINT_PREFIX)/libsoftint.so.0 186 LINK_DYNAMIC = y 187 ifeq ($(MATH),y) 188 BASE_LIBS += $(LIBMATH_PREFIX)/libmath.so.0 189 endif 190 endif 191 192 ifeq ($(LINK_DYNAMIC),y) 193 LFLAGS += -Bdynamic 194 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld 195 else 163 196 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld 164 else 165 BASE_LIBS = $(LIBC_PREFIX)/libc.so0 $(LIBSOFTINT_PREFIX)/libsofti.so0 166 LFLAGS = -Bdynamic 167 LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld 197 endif 198 199 ifeq ($(MATH),y) 200 INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS) $(LIBMATH_INCLUDES_FLAGS) 201 else 202 INCLUDES_FLAGS = $(LIBC_INCLUDES_FLAGS) 168 203 endif 169 204 … … 174 209 endif 175 210 211 # PCUT-based unit tests 212 ifneq ($(TEST_SOURCES),) 213 TEST_OUTPUT = $(TEST_BINARY) 214 TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__ 215 TEST_OUTPUT_LIBS = $(LIB_PREFIX)/pcut/libpcut.a 216 EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map 217 ifneq ($(LIBRARY),) 218 TEST_OUTPUT_LIBS += $(OUTPUT) 219 endif 220 TEST_OUTPUT_LIBS += $(TEST_LIBS) 221 endif 222 176 223 .PHONY: all clean 177 224 178 225 all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT) 179 226 -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV) 227 228 all-test: $(TEST_OUTPUT) 180 229 181 230 clean: … … 184 233 find . -name '*.lo' -follow -exec rm \{\} \; 185 234 186 GCC_CFLAGS = $( LIBC_INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \235 GCC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ 187 236 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \ 188 237 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \ … … 191 240 -pipe -ggdb -D__$(ENDIANESS)__ 192 241 193 ICC_CFLAGS = $( LIBC_INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \242 ICC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ 194 243 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \ 195 244 -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \ … … 201 250 # something won't break because of that: 202 251 # -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) -finput-charset=UTF-8 203 CLANG_CFLAGS = $( LIBC_INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \252 CLANG_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ 204 253 -ffreestanding -fno-builtin -nostdlib -nostdinc \ 205 254 -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \ 206 -Werror-implicit-function-declaration -Wwrite-strings \ 207 -integrated-as \ 208 -pipe -g -target $(CLANG_TARGET) -D__$(ENDIANESS)__ 209 210 LIB_CFLAGS = $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ 255 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \ 256 -integrated-as -pipe -g -target $(CLANG_TARGET) -D__$(ENDIANESS)__ 257 258 LIB_CFLAGS = $(CFLAGS) -fPIC 211 259 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive 212 260 … … 217 265 218 266 ifeq ($(CONFIG_LINE_DEBUG),y) 219 GCC_CFLAGS += -g 267 GCC_CFLAGS += -ggdb 220 268 ICC_CFLAGS += -g 221 269 CLANG_CFLAGS += -g 222 270 endif 223 271 272 # Prepare for POSIX before including platform specific stuff 273 ifeq ($(POSIX_COMPAT),y) 274 CFLAGS = -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/ 275 BASE_LIBS = $(LIBPOSIX_PREFIX)/libposixaslibc.a $(LIBPOSIX_PREFIX)/libc4posix.a $(LIBSOFTINT_PREFIX)/libsoftint.a 276 endif 277 224 278 ## Setup platform configuration 225 279 # … … 232 286 JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py 233 287 234 ifeq ($(POSIX_COMPAT),y)235 CFLAGS = -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/236 LIBS += $(LIBPOSIX_PREFIX)/libposix.a237 endif238 239 288 ifeq ($(COMPILER),gcc_cross) 240 CFLAGS += $(GCC_CFLAGS) $(EXTRA_CFLAGS)289 CFLAGS += $(GCC_CFLAGS) 241 290 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 242 291 endif 243 292 293 ifeq ($(COMPILER),gcc_helenos) 294 CFLAGS += $(GCC_CFLAGS) 295 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 296 endif 297 244 298 ifeq ($(COMPILER),gcc_native) 245 CFLAGS += $(GCC_CFLAGS) $(EXTRA_CFLAGS)299 CFLAGS += $(GCC_CFLAGS) 246 300 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 247 301 endif 248 302 249 303 ifeq ($(COMPILER),icc) 250 CFLAGS += $(ICC_CFLAGS) $(EXTRA_CFLAGS)304 CFLAGS += $(ICC_CFLAGS) 251 305 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 252 306 endif 253 307 254 308 ifeq ($(COMPILER),clang) 255 CFLAGS += $(CLANG_CFLAGS) $(EXTRA_CFLAGS) 256 GCC_CFLAGS += $(EXTRA_CFLAGS) 309 CFLAGS += $(CLANG_CFLAGS) 257 310 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 258 311 endif 259 312 313 ifneq ($(MAKECMDGOALS),clean) 260 314 -include $(DEPEND) 315 endif 261 316 262 317 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 263 318 LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES))) 319 TEST_OBJECTS := $(addsuffix .test.o,$(basename $(TEST_SOURCES))) 264 320 265 321 ifneq ($(BINARY),) … … 297 353 298 354 ifneq ($(LIBRARY),) 299 %.a: $(OBJECTS)355 $(LIBRARY).a: $(OBJECTS) 300 356 $(AR) rc $@ $(OBJECTS) 301 357 endif 302 358 303 ifneq ($( SLIBRARY),)304 %.la: $(LOBJECTS)359 ifneq ($(LARCHIVE),) 360 $(LARCHIVE): $(LOBJECTS) 305 361 $(AR) rc $@ $(LOBJECTS) 306 362 endif 307 363 364 ifneq ($(TEST_OUTPUT),) 365 $(TEST_OUTPUT): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS) 366 $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(TEST_OUTPUT).map -o $@ $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS) $(LIBS) $(BASE_LIBS) 367 ifeq ($(CONFIG_STRIP_BINARIES),y) 368 $(STRIP) $(TEST_OUTPUT) 369 endif 370 endif 371 308 372 %.o: %.S $(DEPEND) 309 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@310 ifeq ($(PRECHECK),y) 311 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__373 $(GCC) $(DEFS) $(GCC_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@ 374 ifeq ($(PRECHECK),y) 375 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ 312 376 endif 313 377 … … 319 383 320 384 %.o: %.c $(DEPEND) 321 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 322 ifeq ($(PRECHECK),y) 323 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) 385 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ 386 ifeq ($(PRECHECK),y) 387 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) 388 endif 389 390 %.test.o: %.c $(DEPEND) 391 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -c $< -o $@ 392 ifeq ($(PRECHECK),y) 393 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) 324 394 endif 325 395 326 396 %.lo: %.S $(DEPEND) 327 $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@328 ifeq ($(PRECHECK),y) 329 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $( CFLAGS) -D__ASM__397 $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@ 398 ifeq ($(PRECHECK),y) 399 $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ 330 400 endif 331 401 … … 337 407 338 408 %.lo: %.c $(DEPEND) 339 $(CC) $(DEFS) $(LIB_CFLAGS) -c $< -o $@340 ifeq ($(PRECHECK),y) 341 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $( CFLAGS)409 $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ 410 ifeq ($(PRECHECK),y) 411 $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) 342 412 endif 343 413 344 414 $(DEPEND): $(PRE_DEPEND) 345 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null415 makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -- $(SOURCES) $(TEST_SOURCES) > $@ 2> /dev/null 346 416 -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@ 347 417
Note:
See TracChangeset
for help on using the changeset viewer.