Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r58563585 rd75dc05  
    160160LIBNETTL_PREFIX = $(LIB_PREFIX)/nettl
    161161
    162 AFLAGS = --fatal-warnings
     162AFLAGS =
    163163LFLAGS = --fatal-warnings
     164
     165# FIXME: This condition is a workaround for issues #692 and #693.
     166ifneq ($(KARCH),ia64)
     167ifneq ($(KARCH),mips32)
     168        AFLAGS += --fatal-warnings
     169endif
     170endif
    164171
    165172ifeq ($(STATIC_NEEDED),y)
     
    203210endif
    204211
    205 ifeq ($(CONFIG_OPTIMIZE_FOR_SIZE),y)
    206         OPTIMIZATION = s
    207 else
    208         OPTIMIZATION = 3
    209 endif
    210 
    211212# PCUT-based unit tests
    212213ifneq ($(TEST_SOURCES),)
    213214        TEST_OUTPUT = $(TEST_BINARY)
     215        TEST_DISASM = $(TEST_BINARY).disasm
    214216        TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__
    215217        TEST_OUTPUT_LIBS = $(LIB_PREFIX)/pcut/libpcut.a
    216         EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map
     218        EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map $(TEST_DISASM)
    217219ifneq ($(LIBRARY),)
    218220        TEST_OUTPUT_LIBS += $(OUTPUT)
     
    226228        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    227229
    228 all-test: $(TEST_OUTPUT)
     230all-test: $(TEST_OUTPUT) $(TEST_DISASM)
    229231
    230232clean:
     
    233235        find . -name '*.lo' -follow -exec rm \{\} \;
    234236
    235 GCC_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 \
     237COMMON_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
     241GCC_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.
     248CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \
     249        -Wno-missing-prototypes -Wno-unused-command-line-argument \
    239250        -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
    240         -pipe -ggdb -D__$(ENDIANESS)__
    241 
    242 ICC_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
    252 CLANG_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)__
     251        -pipe -fno-stack-protector -fno-PIC
     252
     253ifeq ($(CONFIG_DEBUG),y)
     254        COMMON_CFLAGS += -Werror
     255endif
     256
     257ifeq ($(CONFIG_LINE_DEBUG),y)
     258        GCC_CFLAGS += -ggdb
     259        CLANG_CFLAGS += -g
     260endif
     261
     262# Prepare for POSIX before including platform specific stuff
     263ifeq ($(POSIX_COMPAT),y)
     264        CFLAGS += -I$(LIBPOSIX_PREFIX)/include/posix -I$(LIBPOSIX_PREFIX)/include/
     265        BASE_LIBS = $(LIBPOSIX_PREFIX)/libposixaslibc.a $(LIBPOSIX_PREFIX)/libc4posix.a $(LIBSOFTINT_PREFIX)/libsoftint.a
     266endif
     267
     268## Setup platform configuration
     269#
     270
     271-include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.common
     272
     273## Compilation options
     274#
     275
     276JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
     277
     278ifeq ($(COMPILER),gcc_cross)
     279        CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     280        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     281endif
     282
     283ifeq ($(COMPILER),gcc_helenos)
     284        CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     285        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     286endif
     287
     288ifeq ($(COMPILER),gcc_native)
     289        CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
     290        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     291endif
     292
     293ifeq ($(COMPILER),clang)
     294        CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
     295        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     296endif
    257297
    258298LIB_CFLAGS = $(CFLAGS) -fPIC
    259299LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
    260300
    261 ifeq ($(CONFIG_DEBUG),y)
    262         GCC_CFLAGS += -Werror
    263         ICC_CFLAGS += -Werror
    264 endif
    265 
    266 ifeq ($(CONFIG_LINE_DEBUG),y)
    267         GCC_CFLAGS += -ggdb
    268         ICC_CFLAGS += -g
    269         CLANG_CFLAGS += -g
    270 endif
    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 
    278 ## Setup platform configuration
    279 #
    280 
    281 -include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.common
    282 
    283 ## Compilation options
    284 #
    285 
    286 JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
    287 
    288 ifeq ($(COMPILER),gcc_cross)
    289         CFLAGS += $(GCC_CFLAGS)
    290         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    291 endif
    292 
    293 ifeq ($(COMPILER),gcc_helenos)
    294         CFLAGS += $(GCC_CFLAGS)
    295         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    296 endif
    297 
    298 ifeq ($(COMPILER),gcc_native)
    299         CFLAGS += $(GCC_CFLAGS)
    300         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    301 endif
    302 
    303 ifeq ($(COMPILER),icc)
    304         CFLAGS += $(ICC_CFLAGS)
    305         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    306 endif
    307 
    308 ifeq ($(COMPILER),clang)
    309         CFLAGS += $(CLANG_CFLAGS)
    310         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    311 endif
    312 
    313301ifneq ($(MAKECMDGOALS),clean)
    314302-include $(DEPEND)
    315303endif
     304
     305AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
     306LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
    316307
    317308OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
     
    320311
    321312ifneq ($(BINARY),)
    322 %.disasm: $(BINARY)
     313$(BINARY).disasm: $(BINARY)
    323314ifeq ($(CONFIG_LINE_DEBUG),y)
    324315        $(OBJDUMP) -d -S $< > $@
     
    335326
    336327ifneq ($(SLIBRARY),)
    337 %.disasm: $(LOUTPUT)
     328$(LOUTPUT).disasm: $(LOUTPUT)
    338329ifeq ($(CONFIG_LINE_DEBUG),y)
    339330        $(OBJDUMP) -d -S $< > $@
     
    368359        $(STRIP) $(TEST_OUTPUT)
    369360endif
     361$(TEST_BINARY).disasm: $(TEST_BINARY)
     362ifeq ($(CONFIG_LINE_DEBUG),y)
     363        $(OBJDUMP) -d -S $< > $@
     364else
     365        $(OBJDUMP) -d $< > $@
     366endif
    370367endif
    371368
    372369%.o: %.S $(DEPEND)
    373         $(GCC) $(DEFS) $(GCC_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@
     370        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    374371ifeq ($(PRECHECK),y)
    375372        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
     
    377374
    378375%.o: %.s $(DEPEND)
    379         $(AS) $(AFLAGS) -o $@ $<
     376        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    380377ifeq ($(PRECHECK),y)
    381378        $(JOBFILE) $(JOB) $< $@ as asm
     
    395392
    396393%.lo: %.S $(DEPEND)
    397         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__ -c $< -o $@
     394        $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    398395ifeq ($(PRECHECK),y)
    399396        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
     
    401398
    402399%.lo: %.s $(DEPEND)
    403         $(AS) $(AFLAGS) -o $@ $<
     400        $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    404401ifeq ($(PRECHECK),y)
    405402        $(JOBFILE) $(JOB) $< $@ as asm
     
    413410
    414411$(DEPEND): $(PRE_DEPEND)
    415         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -- $(SOURCES) $(TEST_SOURCES) > $@ 2> /dev/null
     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
    416414        -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
    417415
Note: See TracChangeset for help on using the changeset viewer.