Changeset 147a066 in mainline


Ignore:
Timestamp:
2016-05-10T06:32:18Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2889634
Parents:
7ba16eb
Message:

Generate dependency rules between autogenerated headers automatically

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r7ba16eb r147a066  
    4848#
    4949
     50AGDEPEND = Makefile.ag.depend
    5051DEPEND = Makefile.depend
    5152DEPEND_PREV = $(DEPEND).prev
     
    138139-include genarch/Makefile.inc
    139140-include $(DEPEND)
     141-include $(AGDEPEND)
    140142
    141143## The at-sign
     
    385387ARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(ARCH_AUTOGENS_AG)))
    386388
     389AUTOGENS_H := $(ARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_H)
     390AUTOGENS_AG := $(ARCH_AUTOGENS_AG) $(GENARCH_AUTOGENS_AG)
     391
    387392LFLAGS_LTO := $(addprefix -Xlinker ,$(LFLAGS))
    388393
     
    464469        $(GENMAP) $(MAP_PREV) $(DUMP) $@
    465470
    466 $(DEPEND): $(COMMON_HEADER_ARCH) $(ARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_H)
     471$(AUTOGENS_H): $(AGDEPEND)
     472
     473$(AGDEPEND): $(AUTOGENS_AG)
     474        touch $@
     475        for g in $?; do \
     476                h=`dirname $$g`/`basename $$g .ag`.h; \
     477                for l in `$(AUTOGEN) depend $$g`; do \
     478                        echo "$$h: $$l" >>$@; \
     479                done \
     480        done
     481
     482$(DEPEND): $(COMMON_HEADER_ARCH) $(AUTOGENS_H)
    467483        makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > $@ 2> /dev/null
    468484        -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
     
    474490        -rm $(ARCH_AUTOGENS_H) $(ARCH_AUTOGENS_PROBE_C) $(ARCH_AUTOGENS_PROBE_S)
    475491        -rm $(GENARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_PROBE_C) $(GENARCH_AUTOGENS_PROBE_S)
     492        -rm $(AGDEPEND)
  • kernel/genarch/Makefile.inc

    r7ba16eb r147a066  
    178178        genarch/include/genarch/multiboot/multiboot_memmap_struct.ag \
    179179        genarch/include/genarch/multiboot/multiboot_info_struct.ag
    180 
    181 #
    182 # Currently there is no automated way to describe dependencies between two autogenerated headers,
    183 # so we need to do it manually
    184 genarch/include/genarch/multiboot/multiboot_memmap_struct.h: arch/$(KARCH)/include/arch/boot/memmap_struct.h
    185 
    186180endif
    187181
  • kernel/genarch/include/genarch/multiboot/multiboot_memmap_struct.ag

    r7ba16eb r147a066  
    3535                },
    3636                {
    37                         include : <arch/boot/memmap_struct.h>
     37                        include : <arch/boot/memmap_struct.h>,
     38                        depends: arch/$(KARCH)/include/arch/boot/memmap_struct.h,
    3839                }
    3940        ],
  • tools/autogen.py

    r7ba16eb r147a066  
    3434def usage():
    3535        print("%s - Automated structure and offsets generator" % sys.argv[0])
    36         print("%s file.ag probe|generate struct.ag" % sys.argv[0])
     36        print("%s file.ag depend|probe|generate struct.ag" % sys.argv[0])
    3737        sys.exit()
     38
     39def depend(struct):
     40        deps = ""
     41        for include in struct['includes']:
     42                if 'depends' in include.keys():
     43                        deps = deps + include['depends'] + "\n"
     44        return deps.strip()
    3845
    3946def generate_includes(struct):
     
    160167                struct = yaml.load(fp)
    161168
    162         if sys.argv[1] == "probe":
     169        if sys.argv[1] == "depend":
     170                deps = depend(struct)
     171                print(deps)
     172        elif sys.argv[1] == "probe":
    163173                code = probe(struct)
    164174                print(code)
Note: See TracChangeset for help on using the changeset viewer.