Changeset 5114


Ignore:
Timestamp:
Feb 11, 2010, 3:21:29 AM (6 years ago)
Author:
stepan
Message:

separate build.h and config.h usage (now possible because newconfig is gone)

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Patrick Georgi <patrick.georgi@…>

This patch is slightly reworked to include a necessary romcc change that allows
more than one -include specified on the command line, and gets rid of the
explicit build.h dependencies of all files. (The files do keep an explicit
config.h dependency though)

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r5113 r5114  
    149149
    150150define objs_c_template
    151 $(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
     151$(obj)/$(1)%.o: src/$(1)%.c $(obj)/config.h
    152152        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
    153153        $(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
     
    155155
    156156define objs_S_template
    157 $(obj)/$(1)%.o: src/$(1)%.S $(obj)/build.h
     157$(obj)/$(1)%.o: src/$(1)%.S $(obj)/config.h
    158158        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
    159159        $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
     
    161161
    162162define initobjs_c_template
    163 $(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
     163$(obj)/$(1)%.o: src/$(1)%.c $(obj)/config.h
    164164        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
    165165        $(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
     
    167167
    168168define initobjs_S_template
    169 $(obj)/$(1)%.o: src/$(1)%.S $(obj)/build.h
     169$(obj)/$(1)%.o: src/$(1)%.S $(obj)/config.h
    170170        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
    171171        $(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
     
    173173
    174174define drivers_c_template
    175 $(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
     175$(obj)/$(1)%.o: src/$(1)%.c $(obj)/config.h
    176176        @printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
    177177        $(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
     
    220220INCLUDES += -I$(shell $(CC) -print-search-dirs | head -n 1 | cut -d' ' -f2)include
    221221INCLUDES += -I$(top)/util/x86emu/include
    222 INCLUDES += -include $(obj)/build.h
     222INCLUDES += -include $(obj)/config.h
    223223
    224224CFLAGS = $(INCLUDES) -Os -nostdinc
     
    251251        @printf "    GEN        build.h\n"
    252252        rm -f $(obj)/build.h
    253         printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > $(obj)/build.ht
     253        printf "/* build system definitions (autogenerated) */\n" > $(obj)/build.ht
     254        printf "#ifndef __BUILD_H\n" >> $(obj)/build.ht
     255        printf "#define __BUILD_H\n\n" >> $(obj)/build.ht
     256        printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" >> $(obj)/build.ht
    254257        printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
    255258        printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
     
    262265        printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s)\"\n" >> $(obj)/build.ht
    263266        printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.ht
    264         printf "#include \"config.h\"\n" >> $(obj)/build.ht
     267        printf "#endif\n" >> $(obj)/build.ht
    265268        mv $(obj)/build.ht $(obj)/build.h
    266269
  • trunk/src/arch/i386/Makefile.inc

    r5108 r5114  
    8080
    8181$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h
    82         $(obj)/romcc $(ROMCCFLAGS) $(INCLUDES) $< -o $@
     82        $(obj)/romcc $(ROMCCFLAGS) -include $(obj)/build.h $(INCLUDES) $< -o $@
    8383
    8484else
    8585$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
    86         $(CC) $(DISTRO_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -I$(src) -I. -c -S $< -o - | sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' > $@.tmp
     86        $(CC) $(DISTRO_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o - | sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' > $@.tmp
    8787        mv $@.tmp $@
    8888endif
  • trunk/src/arch/i386/lib/console.c

    r5022 r5114  
     1#include <build.h>
    12#include <console/loglevel.h>
    23
     
    67#include "console_printk.c"
    78#endif /* CONFIG_USE_PRINTK_IN_CAR */
    8 
    9 #ifndef COREBOOT_EXTRA_VERSION
    10 #define COREBOOT_EXTRA_VERSION ""
    11 #endif
    129
    1310void console_init(void)
     
    2320}
    2421
    25 
    2622void die(const char *str)
    2723{
  • trunk/src/lib/version.c

    r4381 r5114  
    11#include <version.h>
     2#include <build.h>
    23
    34#ifndef CONFIG_MAINBOARD_VENDOR
  • trunk/util/romcc/romcc.c

    r4998 r5114  
    44#undef VERSION
    55#define VERSION_MAJOR "0"
    6 #define VERSION_MINOR "71"
    7 #define RELEASE_DATE "03 April 2009"
     6#define VERSION_MINOR "72"
     7#define RELEASE_DATE "10 February 2010"
    88#define VERSION VERSION_MAJOR "." VERSION_MINOR
    99
     
    128128 *   
    129129 */
     130
     131struct filelist {
     132        const char *filename;
     133        struct filelist *next;
     134};
     135
     136struct filelist *include_filelist = NULL;
     137
    130138static void die(char *fmt, ...)
    131139{
     
    2492824936}
    2492924937
    24930 static void compile(const char *filename, const char *includefile,
     24938static void compile(const char *filename,
    2493124939        struct compiler_state *compiler, struct arch_state *arch)
    2493224940{
     
    2493424942        struct compile_state state;
    2493524943        struct triple *ptr;
     24944        struct filelist *includes = include_filelist;
    2493624945        memset(&state, 0, sizeof(state));
    2493724946        state.compiler = compiler;
     
    2500325012
    2500425013        compile_file(&state, filename, 1);
    25005         if (includefile)
    25006                 compile_file(&state, includefile, 1);
     25014       
     25015        while (includes) {
     25016                compile_file(&state, includes->filename, 1);
     25017                includes=includes->next;
     25018        }
    2500725019
    2500825020        /* Stop if all we want is preprocessor output */
     
    2507125083{
    2507225084        const char *filename;
    25073         const char *includefile = NULL;
    2507425085        struct compiler_state compiler;
    2507525086        struct arch_state arch;
     
    2512225133                        }
    2512325134                        else if (strncmp(argv[1], "-include", 10) == 0) {
    25124                                 if (includefile) {
    25125                                         arg_error("Only one -include option may be specified.\n");
    25126                                 } else {
    25127                                         argv++;
    25128                                         argc--;
    25129                                         includefile = argv[1];
    25130                                         result = 0;
     25135                                struct filelist *old_head = include_filelist;
     25136                                include_filelist = malloc(sizeof(struct filelist));
     25137                                if (!include_filelist) {
     25138                                        die("Out of memory.\n");
    2513125139                                }
     25140                                argv++;
     25141                                argc--;
     25142                                include_filelist->filename = argv[1];
     25143                                include_filelist->next = old_head;
     25144                                result = 0;
    2513225145                        }
    2513325146                        if (result < 0) {
     
    2515025163                arg_error("No filename specified\n");
    2515125164        }
    25152         compile(filename, includefile, &compiler, &arch);
     25165        compile(filename, &compiler, &arch);
    2515325166
    2515425167        return 0;
Note: See TracChangeset for help on using the changeset viewer.