Changeset 30e9f42 in mainline for kernel/Makefile


Ignore:
Timestamp:
2018-04-15T21:39:04Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Children:
d9fdd5a
Parents:
902dd4b
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-04-15 21:38:52)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-04-15 21:39:04)
Message:

Instead of generating headers for certain structures,
write the headers manually and automate checking correctness instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r902dd4b r30e9f42  
    4848#
    4949
    50 AGDEPEND = Makefile.ag.depend
     50AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
    5151RAW = kernel.raw
    5252BIN = kernel.bin
     
    7373
    7474.PHONY: all clean autogen_clean depend
     75.DELETE_ON_ERROR:
    7576
    7677all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM)
     
    132133-include arch/$(KARCH)/Makefile.inc
    133134-include genarch/Makefile.inc
    134 -include $(AGDEPEND)
    135135
    136136## The at-sign
     
    346346endif
    347347
     348ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
     349GENARCH_SOURCES += $(GENARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
     350
    348351GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
    349352ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
     
    354357GENARCH_DEPENDS := $(addsuffix .d,$(basename $(GENARCH_SOURCES)))
    355358
    356 GENARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(GENARCH_AUTOGENS_AG)))
    357 GENARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(GENARCH_AUTOGENS_AG)))
    358 GENARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(GENARCH_AUTOGENS_AG)))
    359 
    360 ARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(ARCH_AUTOGENS_AG)))
    361 ARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(ARCH_AUTOGENS_AG)))
    362 ARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(ARCH_AUTOGENS_AG)))
    363 
    364 AUTOGENS_H := $(ARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_H)
    365 AUTOGENS_AG := $(ARCH_AUTOGENS_AG) $(GENARCH_AUTOGENS_AG)
    366 
    367359AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
    368360LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
     
    399391endif
    400392
    401 $(LINK): $(LINK).in | depend
     393$(LINK): $(LINK).in
    402394        $(CC) $(DEFS) $(CFLAGS) -D__ASSEMBLER__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
    403395
    404 %.h: %.ag
    405         $(AUTOGEN) probe $< >$<.probe.c
    406         $(CC_AUTOGEN) $(DEFS) $(CFLAGS) -S -o $<.probe.s $<.probe.c
    407         $(AUTOGEN) generate $< <$<.probe.s >$@
    408 
    409 %.o: %.S | depend
     396%.check.c: %.h $(AUTOCHECK)
     397        cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
     398
     399%.o: %.S
    410400        $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(AS_CFLAGS)
    411401
    412 %.o: %.s | depend
     402%.o: %.s
    413403        $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(AS_CFLAGS)
    414404
    415 %.o: %.c | depend
     405%.o: %.c
    416406        $(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION))
    417407
     
    440430        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
    441431        $(GENMAP) $(MAP_PREV) $(DUMP) $@
    442 
    443 $(AUTOGENS_H): $(AGDEPEND)
    444 
    445 $(AGDEPEND): $(AUTOGENS_AG)
    446         echo "# DO NOT EDIT" >$@
    447         for g in $^; do \
    448                 h=`dirname $$g`/`basename $$g .ag`.h; \
    449                 for l in `$(AUTOGEN) depend $$g`; do \
    450                         echo "$$h: $$l" >>$@; \
    451                 done \
    452         done
    453 
    454 depend: $(AUTOGENS_H)
    455 
    456 autogen_clean:
    457         -rm $(ARCH_AUTOGENS_H) $(ARCH_AUTOGENS_PROBE_C) $(ARCH_AUTOGENS_PROBE_S)
    458         -rm $(GENARCH_AUTOGENS_H) $(GENARCH_AUTOGENS_PROBE_C) $(GENARCH_AUTOGENS_PROBE_S)
    459         -rm $(AGDEPEND)
Note: See TracChangeset for help on using the changeset viewer.