Changes in uspace/Makefile.common [1ab3c4b:ea42e44] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r1ab3c4b rea42e44  
    174174endif
    175175
    176 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
    177         -ffreestanding -nostdlib -nostdinc -fexec-charset=UTF-8 \
    178         -finput-charset=UTF-8 -D__$(ENDIANESS)__ -D_HELENOS_SOURCE -fno-common \
     176# Flags that are not necessary, and can be overriden, but are used by default.
     177DEFAULT_CFLAGS = \
     178        -O$(OPTIMIZATION) \
     179        -ffunction-sections \
     180        -pipe \
     181        -Wall \
     182        -Wextra \
     183        -Wno-unused-parameter \
     184        -Wmissing-prototypes \
     185        -Wwrite-strings \
     186        -Werror-implicit-function-declaration
     187
     188ifeq ($(CONFIG_DEBUG),y)
     189        DEFAULT_CFLAGS += -Werror
     190endif
     191
     192ifeq ($(COMPILER),clang)
     193        DEFAULT_CFLAGS += \
     194                -Wno-missing-field-initializers \
     195                -Wno-typedef-redefinition \
     196                -Wno-unused-command-line-argument
     197else
     198        DEFAULT_CFLAGS += \
     199                -Wno-clobbered
     200endif
     201
     202ifeq ($(CONFIG_LINE_DEBUG),y)
     203        DEFAULT_CFLAGS += -ggdb
     204endif
     205
     206# Flags that should always be used, even for third-party software.
     207COMMON_CPPFLAGS = \
     208        -nostdinc \
     209        -D__$(ENDIANESS)__
     210
     211COMMON_CFLAGS = \
     212        -ffreestanding \
     213        -nostdlib
     214
     215# Flags that are always used for HelenOS code, but not for third-party.
     216HELENOS_CFLAGS = \
     217        -std=gnu99 \
     218        $(INCLUDES_FLAGS) \
     219        -imacros $(CONFIG_HEADER) \
     220        -D_HELENOS_SOURCE \
     221        -fexec-charset=UTF-8 \
     222        -finput-charset=UTF-8 \
     223        -fno-common \
    179224        -fdebug-prefix-map=$(realpath $(ROOT_PATH))=.
    180225
    181 GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \
    182         -Wno-unused-parameter -Wmissing-prototypes -std=gnu99 \
    183         -Werror-implicit-function-declaration \
    184         -Wwrite-strings -pipe
    185 
    186 # -Wno-missing-prototypes is there because it warns about main().
    187 # This should be fixed elsewhere.
    188 CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \
    189         -Wno-missing-prototypes -Wno-unused-command-line-argument \
    190         -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \
    191         -pipe -fno-stack-protector -fno-PIC
    192 
    193 ifeq ($(CONFIG_DEBUG),y)
    194         COMMON_CFLAGS += -Werror
    195 endif
    196 
    197 ifeq ($(CONFIG_LINE_DEBUG),y)
    198         GCC_CFLAGS += -ggdb
    199         CLANG_CFLAGS += -g
    200 endif
     226# TODO: Use a different name.
     227# CFLAGS variable is traditionally used for overridable flags.
     228CFLAGS = $(COMMON_CPPFLAGS) $(COMMON_CFLAGS) $(HELENOS_CFLAGS) $(DEFAULT_CFLAGS)
    201229
    202230## Setup platform configuration
     
    216244endif
    217245
    218 ifeq ($(COMPILER),clang)
    219         CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
    220 else
    221         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    222 endif
    223 
    224246ifeq ($(CONFIG_STRIP_BINARIES),y)
    225247        LFLAGS += --strip-all
     
    246268all-test: $(TEST_OUTPUTS)
    247269
    248 clean:
    249         rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
     270clean: fasterclean
    250271        find . -name '*.o' -follow -exec rm \{\} \;
    251272        find . -name '*.lo' -follow -exec rm \{\} \;
     
    253274
    254275fasterclean:
    255         rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
     276        rm -rf $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk
    256277
    257278depend: $(PRE_DEPEND)
Note: See TracChangeset for help on using the changeset viewer.