Changeset 98a4e76 in mainline for kernel/Makefile


Ignore:
Timestamp:
2009-02-12T20:12:51Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54b2e74
Parents:
fa024ce
Message:

centralize configuration data
use a header file for passing most of the configuration directives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    rfa024ce r98a4e76  
    3333include ../version
    3434-include ../Makefile.config
     35-include ../config.defs
    3536
    3637INCLUDES = generic/include
    3738OPTIMIZATION = 3
    3839
     40ifndef CROSS_PREFIX
     41        CROSS_PREFIX = /usr/local
     42endif
     43
    3944## Common compiler flags
    4045#
    4146
    42 DEFS = -D$(ARCH) -DARCH=\"$(ARCH)\" -DRELEASE=\"$(RELEASE)\" "-DNAME=\"$(NAME)\"" \
    43         -DKERNEL
    44 
    45 GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \
     47DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
     48
     49GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
    4650        -fno-builtin -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror \
    4751        -nostdlib -nostdinc -pipe
    4852
    49 ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) \
     53ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
    5054        -fno-builtin -Wall -Wmissing-prototypes -Werror \
    5155        -nostdlib -nostdinc \
     
    5963AFLAGS =
    6064
    61 ifdef REVISION
    62         DEFS += "-DREVISION=\"$(REVISION)\""
    63 endif
    64 
    65 ifdef TIMESTAMP
    66         DEFS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
    67 endif
    68 
    69 -include arch/$(ARCH)/Makefile.inc
     65-include arch/$(KARCH)/Makefile.inc
    7066-include genarch/Makefile.inc
    7167
     
    8480#
    8581SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;"
    86 
    87 ## Setup kernel configuration
    88 #
    89 ifeq ($(CONFIG_DEBUG),y)
    90         DEFS += -DCONFIG_DEBUG
    91 endif
    92 
    93 ifeq ($(CONFIG_LOG),y)
    94         DEFS += -DCONFIG_LOG
    95 endif
    96 
    97 ifeq ($(CONFIG_KCONSOLE),y)
    98         DEFS += -DCONFIG_KCONSOLE
    99 endif
    100 
    101 ifeq ($(CONFIG_DEBUG_SPINLOCK),y)
    102         DEFS += -DCONFIG_DEBUG_SPINLOCK
    103 endif
    104 
    105 ifeq ($(CONFIG_DEBUG_AS_WATCHPOINT),y)
    106         DEFS += -DCONFIG_DEBUG_AS_WATCHPOINT
    107 endif
    108 
    109 ifeq ($(CONFIG_FPU_LAZY),y)
    110         DEFS += -DCONFIG_FPU_LAZY
    111 endif
    112 
    113 ifeq ($(CONFIG_DEBUG_ALLREGS),y)
    114         DEFS += -DCONFIG_DEBUG_ALLREGS
    115 endif
    116 
    117 ifeq ($(CONFIG_VHPT),y)
    118         DEFS += -DCONFIG_VHPT
    119 endif
    120 
    121 ifeq ($(CONFIG_TSB),y)
    122         DEFS += -DCONFIG_TSB
    123 endif
    124 
    125 ifeq ($(CONFIG_Z8530),y)
    126         DEFS += -DCONFIG_Z8530
    127 endif
    128 
    129 ifeq ($(CONFIG_NS16550),y)
    130         DEFS += -DCONFIG_NS16550
    131 endif
    132 
    133 ifeq ($(CONFIG_I8042_INTERRUPT_DRIVEN),y)
    134         DEFS += -DCONFIG_I8042_INTERRUPT_DRIVEN
    135 endif
    136 
    137 ifeq ($(CONFIG_NS16550_INTERRUPT_DRIVEN),y)
    138         DEFS += -DCONFIG_NS16550_INTERRUPT_DRIVEN
    139 endif
    140 
    141 ifeq ($(CONFIG_IOSAPIC),y)
    142         DEFS += -DCONFIG_IOSAPIC
    143 endif
    144 
    145 ifeq ($(CONFIG_VIRT_IDX_DCACHE),y)
    146         DEFS += -DCONFIG_VIRT_IDX_DCACHE
    147 endif
    148 
    149 ifeq ($(CONFIG_FB),y)
    150         ifeq ($(ARCH),ia32)
    151                 DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
    152                 DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
    153                 DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
    154         endif
    155        
    156         ifeq ($(ARCH),amd64)
    157                 DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
    158                 DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
    159                 DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
    160         endif
    161        
    162         ifeq ($(ARCH),ia32xen)
    163                 DEFS += -DCONFIG_VESA_WIDTH=$(CONFIG_VESA_WIDTH)
    164                 DEFS += -DCONFIG_VESA_HEIGHT=$(CONFIG_VESA_HEIGHT)
    165                 DEFS += -DCONFIG_VESA_BPP=$(CONFIG_VESA_BPP)
    166         endif
    167 endif
    168 
    169 ifeq ($(CONFIG_UDEBUG),y)
    170         DEFS += -DCONFIG_UDEBUG
    171 endif
    17282
    17383## Simple detection for the type of the host system
     
    195105        LIBDIR = /usr/lib
    196106        CFLAGS = $(GCC_CFLAGS)
     107        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    197108endif
    198109
     
    206117        LIBDIR = /usr/lib
    207118        CFLAGS = $(ICC_CFLAGS)
     119        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    208120endif
    209121
     
    217129        LIBDIR = /usr/lib
    218130        CFLAGS = $(SUNCC_CFLAGS)
     131        DEFS += $(CONFIG_DEFS)
     132        DEPEND_DEFS = $(DEFS)
    219133endif
    220134
     
    228142        LIBDIR = $(TOOLCHAIN_DIR)/lib
    229143        CFLAGS = $(GCC_CFLAGS)
     144        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    230145endif
    231146
     
    326241
    327242ifeq ($(CONFIG_TEST),y)
    328         DEFS += -DCONFIG_TEST
    329243        CFLAGS += -Itest/
    330244        GENERIC_SOURCES += \
     
    335249                test/debug/mips1.c \
    336250                test/fault/fault1.c \
    337                 test/fpu/fpu1.c \
    338                 test/fpu/sse1.c \
    339                 test/fpu/mips2.c \
    340251                test/mm/falloc1.c \
    341252                test/mm/falloc2.c \
     
    354265                test/thread/thread1.c \
    355266                test/sysinfo/sysinfo1.c
     267       
     268        ifeq ($(CONFIG_FPU),y)
     269                ifeq ($(KARCH),ia32)
     270                        TEST_FPU1 = y
     271                        TEST_SSE1 = y
     272                endif
     273               
     274                ifeq ($(KARCH),amd64)
     275                        TEST_FPU1 = y
     276                        TEST_SSE1 = y
     277                endif
     278               
     279                ifeq ($(KARCH),ia64)
     280                        TEST_FPU1 = y
     281                endif
     282               
     283                ifeq ($(KARCH),mips32)
     284                        TEST_MIPS2 = y
     285                endif
     286        endif
     287       
     288        ifeq ($(TEST_FPU1),y)
     289                GENERIC_SOURCES += test/fpu/fpu1.c
     290        else
     291                GENERIC_SOURCES += test/fpu/fpu1_skip.c
     292        endif
     293       
     294        ifeq ($(TEST_SSE1),y)
     295                GENERIC_SOURCES += test/fpu/sse1.c
     296        else
     297                GENERIC_SOURCES += test/fpu/sse1_skip.c
     298        endif
     299       
     300        ifeq ($(TEST_MIPS2),y)
     301                GENERIC_SOURCES += test/fpu/mips2.c
     302        else
     303                GENERIC_SOURCES += test/fpu/mips2_skip.c
     304        endif
     305       
    356306endif
    357307
     
    362312.PHONY: all build clean archlinks depend disasm
    363313
    364 all: ../Makefile.config
     314all: ../Makefile.config ../config.h ../config.defs
    365315        -rm Makefile.depend
    366316        $(MAKE) -C . build
     
    371321
    372322clean:
    373         -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend* generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld
     323        -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend* generic/include/arch generic/include/genarch arch/$(KARCH)/_link.ld
    374324        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
    375325        for arch in arch/* ; do \
     
    378328
    379329archlinks:
    380         ln -sfn ../../arch/$(ARCH)/include/ generic/include/arch
     330        ln -sfn ../../arch/$(KARCH)/include/ generic/include/arch
    381331        ln -sfn ../../genarch/include/ generic/include/genarch
    382332
    383333depend: archlinks
    384         -makedepend -f - -- $(DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
    385 
    386 arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
     334        -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null
     335
     336arch/$(KARCH)/_link.ld: arch/$(KARCH)/_link.ld.in
    387337        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
    388338
    389 generic/src/debug/real_map.bin: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
     339generic/src/debug/real_map.bin: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
    390340        echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o
    391         $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/empty_map.o  -o $@ -Map kernel.map.pre
     341        $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/empty_map.o  -o $@ -Map kernel.map.pre
    392342        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
    393343        tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
     
    395345        # on architectures, that have bss after symtab
    396346        echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o
    397         $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre
     347        $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre
    398348        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump
    399349        tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
     
    402352        echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@
    403353
    404 kernel.raw: depend arch/$(ARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
    405         $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
     354kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) generic/src/debug/real_map.o
     355        $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/real_map.o -o $@ -Map kernel.map
    406356
    407357kernel.bin: kernel.raw
Note: See TracChangeset for help on using the changeset viewer.