Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    rd75dc05 r58563585  
    160160LIBNETTL_PREFIX = $(LIB_PREFIX)/nettl
    161161
    162 AFLAGS =
     162AFLAGS = --fatal-warnings
    163163LFLAGS = --fatal-warnings
    164 
    165 # FIXME: This condition is a workaround for issues #692 and #693.
    166 ifneq ($(KARCH),ia64)
    167 ifneq ($(KARCH),mips32)
    168         AFLAGS += --fatal-warnings
    169 endif
    170 endif
    171164
    172165ifeq ($(STATIC_NEEDED),y)
     
    210203endif
    211204
     205ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
     206        OPTIMIZATION = s
     207else
     208        OPTIMIZATION = 3
     209endif
     210
    212211# PCUT-based unit tests
    213212ifneq ($(TEST_SOURCES),)
    214213        TEST_OUTPUT = $(TEST_BINARY)
    215         TEST_DISASM = $(TEST_BINARY).disasm
    216214        TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__
    217215        TEST_OUTPUT_LIBS = $(LIB_PREFIX)/pcut/libpcut.a
    218         EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map $(TEST_DISASM)
     216        EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map
    219217ifneq ($(LIBRARY),)
    220218        TEST_OUTPUT_LIBS += $(OUTPUT)
     
    228226        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    229227
    230 all-test: $(TEST_OUTPUT) $(TEST_DISASM)
     228all-test: $(TEST_OUTPUT)
    231229
    232230clean:
     
    235233        find . -name '*.lo' -follow -exec rm \{\} \;
    236234
    237 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
    238         -ffreestanding -fno-builtin -nostdlib -nostdinc -fexec-charset=UTF-8 \
    239         -finput-charset=UTF-8 -D__$(ENDIANESS)__
    240 
    241 GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \
    242         -Wno-unused-parameter -Wmissing-prototypes -std=gnu99 \
    243         -Werror-implicit-function-declaration \
    244         -Wwrite-strings -pipe
    245 
    246 # -Wno-missing-prototypes is there because it warns about main().
    247 # This should be fixed elsewhere.
    248 CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \
    249         -Wno-missing-prototypes -Wno-unused-command-line-argument \
     235GCC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     236        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     237        -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
     238        -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
    250239        -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
    251         -pipe -fno-stack-protector -fno-PIC
     240        -pipe -ggdb -D__$(ENDIANESS)__
     241
     242ICC_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     243        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     244        -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
     245        -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
     246        -Werror-implicit-function-declaration -Wwrite-strings \
     247        -pipe -g -D__$(ENDIANESS)__
     248
     249# clang does not support following options but I am not sure whether
     250# something won't break because of that:
     251# -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) -finput-charset=UTF-8
     252CLANG_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     253        -ffreestanding -fno-builtin -nostdlib -nostdinc \
     254        -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
     255        -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
     256        -integrated-as -pipe -g -target $(CLANG_TARGET) -D__$(ENDIANESS)__
     257
     258LIB_CFLAGS = $(CFLAGS) -fPIC
     259LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
    252260
    253261ifeq ($(CONFIG_DEBUG),y)
    254         COMMON_CFLAGS += -Werror
     262        GCC_CFLAGS += -Werror
     263        ICC_CFLAGS += -Werror
    255264endif
    256265
    257266ifeq ($(CONFIG_LINE_DEBUG),y)
    258267        GCC_CFLAGS += -ggdb
     268        ICC_CFLAGS += -g
    259269        CLANG_CFLAGS += -g
    260270endif
     
    262272# Prepare for POSIX before including platform specific stuff
    263273ifeq ($(POSIX_COMPAT),y)
    264         CFLAGS += -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/
     274        CFLAGS = -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/
    265275        BASE_LIBS = $(LIBPOSIX_PREFIX)/libposixaslibc.a $(LIBPOSIX_PREFIX)/libc4posix.a $(LIBSOFTINT_PREFIX)/libsoftint.a
    266276endif
     
    277287
    278288ifeq ($(COMPILER),gcc_cross)
    279         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     289        CFLAGS += $(GCC_CFLAGS)
    280290        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    281291endif
    282292
    283293ifeq ($(COMPILER),gcc_helenos)
    284         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     294        CFLAGS += $(GCC_CFLAGS)
    285295        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    286296endif
    287297
    288298ifeq ($(COMPILER),gcc_native)
    289         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     299        CFLAGS += $(GCC_CFLAGS)
    290300        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    291301endif
    292302
     303ifeq ($(COMPILER),icc)
     304        CFLAGS += $(ICC_CFLAGS)
     305        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     306endif
     307
    293308ifeq ($(COMPILER),clang)
    294         CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
     309        CFLAGS += $(CLANG_CFLAGS)
    295310        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    296311endif
    297 
    298 LIB_CFLAGS = $(CFLAGS) -fPIC
    299 LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
    300312
    301313ifneq ($(MAKECMDGOALS),clean)
    302314-include $(DEPEND)
    303315endif
    304 
    305 AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
    306 LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
    307316
    308317OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
     
    311320
    312321ifneq ($(BINARY),)
    313 $(BINARY).disasm: $(BINARY)
     322%.disasm: $(BINARY)
    314323ifeq ($(CONFIG_LINE_DEBUG),y)
    315324        $(OBJDUMP) -d -S $< > $@
     
    326335
    327336ifneq ($(SLIBRARY),)
    328 $(LOUTPUT).disasm: $(LOUTPUT)
     337%.disasm: $(LOUTPUT)
    329338ifeq ($(CONFIG_LINE_DEBUG),y)
    330339        $(OBJDUMP) -d -S $< > $@
     
    359368        $(STRIP) $(TEST_OUTPUT)
    360369endif
    361 $(TEST_BINARY).disasm: $(TEST_BINARY)
    362 ifeq ($(CONFIG_LINE_DEBUG),y)
    363         $(OBJDUMP) -d -S $< > $@
    364 else
    365         $(OBJDUMP) -d $< > $@
    366 endif
    367370endif
    368371
    369372%.o: %.S $(DEPEND)
    370         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     373        $(GCC) $(DEFS) $(GCC_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@
    371374ifeq ($(PRECHECK),y)
    372375        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
     
    374377
    375378%.o: %.s $(DEPEND)
    376         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     379        $(AS) $(AFLAGS) -o $@ $<
    377380ifeq ($(PRECHECK),y)
    378381        $(JOBFILE) $(JOB) $< $@ as asm
     
    392395
    393396%.lo: %.S $(DEPEND)
    394         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     397        $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@
    395398ifeq ($(PRECHECK),y)
    396399        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
     
    398401
    399402%.lo: %.s $(DEPEND)
    400         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     403        $(AS) $(AFLAGS) -o $@ $<
    401404ifeq ($(PRECHECK),y)
    402405        $(JOBFILE) $(JOB) $< $@ as asm
     
    410413
    411414$(DEPEND): $(PRE_DEPEND)
    412         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
    413         makedepend -f - -o.test.o -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -- $(TEST_SOURCES) >> $@ 2> /dev/null
     415        makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -- $(SOURCES) $(TEST_SOURCES) > $@ 2> /dev/null
    414416        -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
    415417
Note: See TracChangeset for help on using the changeset viewer.